Expand description
Schema diff (spec 0002 §9, §12).
A pure function producing a stable SchemaDiff between two
InMemorySchema values. The output is designed to be serialised
as JSON for CI “schema-compat” gates: consumer projects run
cypher schema diff old.toml new.toml and compare the breaking
list to decide whether the new schema is a drop-in replacement.
§What counts as “breaking”
At v0 the following changes are classed as breaking:
- A label is removed (existing queries that reference the label break).
- A property on an existing label loses
required = true, changes type, or is removed entirely. - A relationship type is removed.
- A rel type’s
start_labelsorend_labelsshrink (existing patterns may now be rejected by the semantic pass). - A rel type changes or loses a property (same rules as labels).
- A parameter is removed, or changes type, or loses its default value.
Non-breaking changes land in adds:
- New labels, rel types, parameters.
- New optional properties on an existing declaration.
- A rel type’s endpoint lists expanding (more labels allowed).
- A parameter gaining a default.
The diff is structural: it does not know about the semantic content of queries that depend on the schema. A downstream CI gate that wants stronger compatibility should check breakages against its own corpus.
Structs§
- Diff
Entry - One discrete change recorded in a
SchemaDiff. - Schema
Diff - Structured diff between two schemas.
Functions§
- diff
- Compute the diff between
oldandnew.