json-schema-diff
A work-in-progress tool to diff changes between JSON schemas. A lot of JSON schema features are not implemented and therefore ignored, such as:
required
patternProperties
(entirely ignored)const
(changes from{"const": "foo"}
to{"type": "string"}
are not detected)
Use this tool as a best-effort to find obviously breaking changes in CI, but not for much more.
This crate is used with draft-07 but even that is work in progress.
Usage via CLI
# {"type": "string"}
# {"type": "boolean"}
# {"path":"","change":{"TypeRemove":{"removed":"string"}},"is_breaking":true}
# {"path":"","change":{"TypeAdd":{"added":"boolean"}},"is_breaking":false}
Sentry uses this tool in
sentry-kafka-schemas
to
annotate pull requests with breaking changes made to schema definitions. It
invokes the CLI tool on the schema from master vs the schema in the PR, and
post-processes the output using a Python script for human consumption.
is_breaking
is just a suggestion. You may choose to ignore it entirely and
instead define which kinds of changes are breaking to you in wrapper scripts.
Usage as library
use *;
let lhs = json! ;
let rhs = json! ;
assert_eq!;
License
Licensed under Apache 2.0