Deduplicate node.schema.json with defs and refs #145
Loading…
Reference in a new issue
No description provided.
Delete branch "chore/schema-defs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
YN-29.
nodes/node.schema.jsongoes from 2,733 lines to 720.scripts/node_schema.pyregisters each shared fragment once under$defsand returns a$refto it:index,label,pin,pins,rx,tx, every per-field spec, the three bind kinds (and the bind and measure-bind objects inside them), the literal-or-setting-label shapes, and each board's input, output and touch pin sets. Ashared(name, spec)helper dedupes by content, so a new field or bind kind that reuses an existing shape picks up the same definition without any extra code; where a spec differs from the common one (the blower'sfrequency, each setting type'smin,maxanddefault) it gets an owner-prefixed name. Where a place only changes the description, the$refcarries it as a sibling keyword.The output is also written by a small
dumpfunction, so a container that fits in 120 columns stays on one line. A$refcosts a line instead of three, and that accounts for most of the second half of the saving. It is plain JSON with two-space indent where it expands.Validation is unchanged.
test_node_schema.pyis untouched and passes, and every fixture validates. I also compared the old and new schemas on 6,496 mutated copies of the fixtures (every field deleted or replaced with 24 odd values, and each fixture on each board) and they agree on every one. No change to the YAML format, the README or the generator's own checks. CI's stale check regenerates and diffs as before.Sizes:
nodes/node.schema.json2,733 to 720 lines;scripts/node_schema.py247 to 295.Tested: Python 145, none skipped locally.