Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds changes to allow open content within schema and adds APIs to retrieve open content #145

Merged
merged 3 commits into from
Feb 14, 2023

Conversation

desaikd
Copy link
Contributor

@desaikd desaikd commented Feb 1, 2023

Issue #6

Description of changes:

This PR works on adding changes for allowing open content within schema and adds APIs to retrieve open content.

List of changes:

  • adds open_content() in IslType as well IslSchema to retrieve open content
  • adds load_isl_schema() that load a schema content as an internal ISL model which can be programmatically manipulated
  • adds related tests for open content
    Note: IslSchema#open_content() only provides top level open content. For open content in type definition added IslType#open_content()

Test:

  • adds unit tests inside system and isl modules
  • allows test files from ion-schema-tests to verify open content is allowed

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…rive open content

* adds open_content() in IslType as well IslSchema to retrieve open
content
* adds load_isl_schema() that load a schema content as an intrernal ISL
model which can be programmaticlaly manipulated
* adds related tests for open content
ion-schema/src/isl/isl_constraint.rs Show resolved Hide resolved
ion-schema/src/isl/isl_type.rs Outdated Show resolved Hide resolved
ion-schema/src/isl/isl_type.rs Show resolved Hide resolved
ion-schema/src/system.rs Outdated Show resolved Hide resolved
ion-schema/src/isl/mod.rs Outdated Show resolved Hide resolved
ion-schema/src/system.rs Show resolved Hide resolved
@desaikd desaikd requested a review from popematt February 2, 2023 00:00
inline_imported_types: Vec<IslImportType>,
/// Represents open content as `Element`s
/// Note: This doesn't preserve the information about where the open content is placed in the schema file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you document why you have chosen to do it this way? It's possible that in a year, there will be a use case that requires the relative ordering of ISL and non-ISL. If that comes up, we need to understand why the decision was made so that we can make an informed decision about whether to change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of now I do not know of any use case for preserving this information and it requires storing the order for non ISL and ISL which could complicate the current IslSchema model by having to store the order and add a model to represent non ISL data. If a use case arrives we can change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@desaikd desaikd merged commit d121dd8 into main Feb 14, 2023
@desaikd desaikd deleted the desaikd-model-open-content branch May 1, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants