-
Notifications
You must be signed in to change notification settings - Fork 14
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
Testing compatibility of type definitions #126
Comments
Any thoughts on this? |
I am sorry for not responding to this sooner. I don't see an easy solution, but will share a few thoughts below.... Ion Schema constraints are primarily oriented toward narrowing the universe of values. The universe of values is narrowed by constraints in type X, type X' further narrows type X with additional constraints, X'' narrows X', etc. This guarantees that code processing a value of type X can also process a value of type X'. Your schema evolution use case appears to be the opposite--you want to guarantee that A' is broader than A. Ion Schema doesn't really help here, although I do wonder if defining a meta-type with the constraint The behavior of the Note also that use of constraint such as I suspect such a safeguard would have to compare A and A' on a constraint-by-constraint basis and reject A' if any of its constraints are found to narrow A, or if it is unknown whether a constraint in A' narrows A. |
Thanks for the insight Peter.
I hadn't considered this. I'll have to think about it some more.
Right; In our case we default to populating
Agreed, I would be fine with excluding |
I'm using Ion Schema to allow my customers to describe type definitions for data stored in a database. I have a use case now where customers would like to evolve their type definitions (modeled as Ion Schema "types"), e.g., adding new fields, changing constraints, etc.
Since the existing data in the database matches the original type definition, I'd like to put some kind of safeguard into place to prevent customers from making backwards incompatible changes to their type definitions, i.e., modifying the type definition in such a way that existing data becomes invalid under the new definition (examples include adding a new required field, or adding a new value constraint).
In more abstract terms, I'd like to test whether for a given type definition A and a modified version A', the set of valid values for A' is a superset of those for A.
I'm wondering if you have any suggested approaches or thoughts on how to achieve this using Ion Schema.
The text was updated successfully, but these errors were encountered: