jsonschema_diff.cli¶
A tiny command-line front-end around jsonschema_diff
that highlights semantic differences between two JSON-Schema
documents directly in your terminal.
Typical usage¶
>>> jsonschema-diff old.schema.json new.schema.json
>>> jsonschema-diff --no-color --legend old.json new.json
>>> jsonschema-diff --exit-code old.json new.json # useful in CI
Exit status¶
0 – the two schemas are semantically identical
1 – at least one difference was detected (only when
--exit-code
is given)
The CLI is intentionally minimal: all comparison options are taken
from jsonschema_diff.ConfigMaker()
, so the behaviour stays
in sync with the library defaults.
Functions¶
|
CLI entry-point (invoked by |
Module Contents¶
- main(argv: list[str] | None = None) None [source]¶
CLI entry-point (invoked by
python -m jsonschema_diff
or by thejsonschema-diff
console script).- Parameters:
argv – Command-line argument vector excluding the executable name. When None (default)
sys.argv[1:]
is used – this is the behaviour required by setuptools console-scripts.
Note
The function performs four sequential steps:
Build a
JsonSchemaDiff
instance.Compare the two user-supplied schema files.
Print a colourised diff (optionally with a legend).
Optionally exit with code 1 if differences are present.