Expand description
Non-destructive structural diagnostics for a schema. Ported from
~/dev/omnist/omnist/ops/lint.py.
Schema::validate checks a document against a schema; lint checks
the schema itself for structural problems that parse fine but mean
parts of the schema can never do anything. It reports, never
mutates – prune/normalize are the transforms that fix these
issues; lint only diagnoses them.
Four checks:
lint.unsatisfiable-record(warning) – a reachable record no finite document can match (e.g. a mandatory ref cycle). Reusessuper::prune::satisfiable_set(its complement), intersected with reachable.lint.unreachable-record(warning) – a record defined in the env but not reachable from root by following any ref. A plain reachability walk (no pruning): everyRef-typed field is followed regardless of cardinality.lint.duplicate-record(warning) – two or more structurally identical records under different names. Reusessuper::minimize::equivalence_classeson the raw schema, so duplicates are reported as authored.lint.any-field(info) – an inventory of everyany-typed field, so a human can audit the schema’s deliberate openings. Advisory only; never affects a caller’s exit code on its own.
Structs§
- Lint
Finding - One structural diagnostic.
codeis a stable machine-readable identifier (lint.unsatisfiable-record,lint.unreachable-record,lint.duplicate-record,lint.any-field);severityiswarningorinfo;locationis a record name (orRecord.labelforlint.any-field);messageis a human-readable, actionable description.
Functions§
- lint
- Structural diagnostics for
s– see the module doc comment for the checks. Returns findings sorted deterministically by(code, location). Never mutatess.