Crate jsoncompat

Source
Expand description

Back‑compatibility checking library.

This crate depends on json_schema_ast, which provides a strict in‑memory representation (SchemaNode) of a Draft 2020‑12 JSON Schema. The only responsibility of this crate is to offer algorithms that compare two schemas and decide whether a change is backward‑compatible from the point of view of a serializer or deserializer.

Enums§

Role
The role under which a compatibility check is performed.
SchemaNode
An internal Abstract Syntax Tree (AST) representing a fully‑resolved JSON Schema draft‑2020‑12 document. The node types are deliberately very close to the JSON Schema specification so that higher‑level crates (e.g. the back‑compat checker or fuzz generator) can reason about schemas without constantly reparsing raw JSON values. TODO: need roundtrip tests

Functions§

build_and_resolve_schema
Build and fully resolve a schema node from raw JSON + a base URL.
build_schema_ast
Build the high-level AST without immediately resolving references.
check_compat
Top‑level convenience wrapper:
is_subschema_of
Returns true if every instance that satisfies sub also satisfies sup.
resolve_refs
Recursively resolves SchemaNode::Ref by looking up fragments in root_json.
type_constraints_subsumed
Compare the constraints of two nodes of the same basic type.