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

Should Ion Schema support multiple versions of the same schema(s) and type(s)? #66

Open
popematt opened this issue Jun 30, 2022 · 1 comment

Comments

@popematt
Copy link
Contributor

As data models evolve, the schemas and types for the data models must also evolve. Users of Ion Schema may need to interact with one or more out of many versions of the same schema(s) and/or type(s).

The Problem

Even if we can start by assuming there is a single version numbering system that works for everyone (a dubious possibility), it is unlikely that there can be a one-size-fits-all solution for everyone—there are at least three dimensions to this problem.

At what level does the versioning occur?

  • For a directory (or other group) of schema documents?
  • For individual schema documents?
  • For types within a schema document?
  • A combination of the above?

What sort of version resolution is needed?

  • Get an exact version
  • Resolve to latest in range of versions
  • Resolve to a union of a range of versions (E.g. my_type-2.x is equivalent to any_of: [my_type-2.0, my_type-2.1, ...] )
  • Resolve to an intersection of a range of versions (E.g. my_type-2.x is equivalent to all_of: [my_type-2.0, my_type-2.1, ...] )
  • Some combination of the above?

Can dependency versions be locked/pinned?

  • Yes? (E.g. type customer-1.1 has a dependency on address-1.any which resolves to a union of address-1.0 and address-1.1. Once address-1.2 exists, the customer-1.1 dependency on address-1.any still resolves to a union of address-1.0 and address-1.1.)
  • No? (E.g. type customer-1.1 has a dependency on address-1.any which resolves to a union of address-1.0 and address-1.1. Once address-1.2 exists, the customer-1.1 dependency on address-1.any now resolves to a union of address-1.0, address-1.1, and address-1.2.)
  • Some combination of the two?

Initial Thoughts

Ion Schema does not permit two types with the same name to exist in any particular scope. However two versions of the same type can co-exist by mangling the type name with a version number. Resolving (some) ranges of dependencies can be done by creating new types that are aliases to another type or a union or intersection of multiple other types. These same principles can also be applied to schemas. The difficulty with this approach is that name mangling requires increasing amounts of effort to maintain as the size of a project and the number of versions grows.

@popematt
Copy link
Contributor Author

Also something to keep in mind—ion-schema-schemas will need some sort of solution to this problem when we have an updated version of the Ion Schema Language.

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

No branches or pull requests

1 participant