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

Ability to check compatibility of two schemas #140

Open
pbcornell opened this issue May 13, 2020 · 0 comments
Open

Ability to check compatibility of two schemas #140

pbcornell opened this issue May 13, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@pbcornell
Copy link

pbcornell commented May 13, 2020

This is a feature request for a function that identifies whether two schemas are "compatible," and if not, potentially provides information about any discovered incompatibilities.

Consider use cases in which ISL defines a contract, and another ISL defines a portion of the contract actually consumed by a consumer (e.g., APIs, data publisher/consumer contracts, etc.). Before evolving a contract in a backwards incompatible way, it would be helpful to know which consumers (if any) would be affected by the breaking change.

A collapsed, canonical form of each schema with all imports inlined is likely a helpful starting point for such a compatibility check.

This is a non-trivial feature request, and any such feature would need to be precise about what "compatible" means, and clear about its limitations. The following is a non-exhaustive list of complications that come to mind:

  • determining compatibility between two regex constraints is challenging at best
  • logic constraints present interesting challenges, especially not
  • some changes identified as incompatible may or may not actually break consumers (e.g., allowing a string to be longer), but knowing this for certain requires understanding the code that will process the data
  • ...

An initial approach to this (and one that probably covers a large percentage of use cases while reducing complexity) would likely:

  • focus on a structural comparison of schemas (are they of the same type? do structs have a compatible set of fields? etc.)
  • avoid any comparison logic based on value constraints (e.g., regex, valid_values, length, precision)
  • the not constraint is a curious one, and might be supported if the context is within a known, "closed" universe of types (in which case not can be rewritten as an any_of constraint)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant