Publish a JSON Schema for node YAML #121
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/yaml-schema"
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-4.
scripts/node_schema.pywritesnodes/node.schema.json(draft 2020-12,$idthe raw URL on main) from the generator's own tables, so boards, pins, fields and limits live in one place. To drive both,yaml_node.py's per-field defaults and limits moved into afieldSpecstable that the parser also reads, and the pin rules into onepin_problemfunction. Per-board pin enums come fromif/thenonnode.board, with strapping and CAN-board pins left out and input-only pins limited to inputs. The rules a schema cannot express are listed in its top-leveldescription.The generator gains no runtime dependency.
jsonschemais used by the tests only and is installed in CI, where a new step also regenerates the schema and fails on a diff. One README line points front-end authors at the schema.One behaviour note: a
frequencyabove 312500 Hz now fails the plain range check ("not between 1 and 312500") instead of the old "fewer than 8 bits of duty" message. The limit is the same.Tested: new
test_node_schema.pychecks the schema is valid, that the sample and all fixtures validate, that strapping, CAN-board and input-only pins and out-of-type fields are rejected, and that the committed file matches the generator. Breaking the strapping rule fails two of them. All 24 Python tests pass locally, withjsonschemain a throwaway venv; without it the 6 schema-validation tests skip. The sample and fixtures still build.Review findings addressed in the follow-up commit: bind, frequency and hold cases added to the schema tests;
commonFieldsback to a set; duplicate index and pin added to the generator-only rules in the schema description; the in-test stale check dropped so the CI diff step is the one check. Duplicate-index and the Python float/newline quirks otherwise need no change.