-
Notifications
You must be signed in to change notification settings - Fork 30
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
flexible version handling with tag #271
Comments
I like this idea a lot! We actually have a situation where extensions across multiple packages depend on one another, and updating a tag lower down in the dependency tree causes us a lot of tedious work updating the schemas that depend on it. We're moving away from strict requirements on the structure of the URI, so I'd suggest that we allow the tag: http://stsci.edu/schemas/asdf/core/software-* # allow every version
tag: http://stsci.edu/schemas/asdf/core/software-1.* # fix major version
tag: http://stsci.edu/schemas/asdf/core/software-2.1.* # fix major and minor version but we could also do this: tag: http://stsci.edu/schemas/asdf/transform/* # allow any transform tag
tag: http://stsci.edu/schemas/asdf/transform/*-2.* # allow any 2.x transform tag I guess we'd express a >= version like this: # equivalent to software >= 1.3
allOf:
- tag: http://stsci.edu/schemas/asdf/core/software-1.*
- not:
anyOf:
- tag: http://stsci.edu/schemas/asdf/core/software-1.1.*
- tag: http://stsci.edu/schemas/asdf/core/software-1.2.* A little clumsy, but a necessary sacrifice I think if we want to support free-form URIs. |
Glad to hear, I could really see this simplifying some things From my understanding whatever goes into the |
Looking at the other JSON schema features, it seems that regular expressions are the pattern matching tool of choice. For example: https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.3.3 and some general guidance on how to use them here: https://json-schema.org/draft/2019-09/json-schema-core.html#regex We could add an additional property that validates the tag against a regular expression, something like tagPattern: '^http://stsci\.edu/schemas/asdf/core/software-1\..*$' but the flexibility makes this feature useful beyond just pinning version numbers. |
Using regex would certainly be more powerful, especially when trying to parse the string part of the URI. Personally I would prefer keeping it simple wherever possible. In this case +1 for creating When using tag: http://stsci.edu/schemas/asdf/core/software # allow every version
tag: http://stsci.edu/schemas/asdf/core/software-1 # fix major version
tag: http://stsci.edu/schemas/asdf/core/software-1.2 # fix minor version
tag: http://stsci.edu/schemas/asdf/core/software-1.2.3 # fix patch version should be possible with a simple change to asdf-format/asdf#838, I will see if I can add it soon. This should keep it readable, completely backwards compatible and simple when using |
What I mean about relaxing the URI structure is that I want to allow tags like this:
or anything else that users want to do. Splitting on hyphen and matching the prefix won't be appropriate in every case. |
I have a proposed implementation here: asdf-format/asdf#858. That PR is branched off of another open PR, so here's a link to the relevant commit: asdf-format/asdf@1a33ab1 @CagtayFabry does that work for you? It allows patterns like the following:
but would not automatically match a pattern like |
See my comment on asdf-format/asdf#858 (which apparently I was typing at the same time ;) ) besides I don't mind using If tag and version validation are separated it should also be very easy to implement various syntax versions later on. |
Since using
tag
seems the way to go (#268) I was thinking about ways to be more flexible with tag versioning inside ASDF schema definitions.Currently an exact match of the tag+version string like
tag: http://stsci.edu/schemas/asdf/core/software-1.0.0
is needed for validation. This leads to minor changes and version bumps in core schemas likendarray
resulting in necessary changes in higher level schemas (and maybe more changes higher up because of that)Since
tag
should allow more flexibility regarding implementations in the asdf API, what do you think about supporting a subset of versions withtag
by pinning Major/Minor/Patch versions?for example:
Resolving the actual tags on read/write would still be handled on the API side (and throw any related errors)
Since this would be optional and basically include the old behavior the impact of any weird side effects (like changing version numbers on a simple read/write cycle?) could be decided per schema/extension.
The text was updated successfully, but these errors were encountered: