Closed paul-bayleaf closed 10 months ago
Awesome!
I think there needs to be some .github actions workflow added that checks examples against the schema. Doesn't have to be with this PR but the schema is certain to be immediately out-of-date without an automated check.
What did you use to test the schema against examples? Paste your script here?
Thank you. I agree using a schema to automatically test the examples, and equally using the examples to test the schema, would be very useful. Currently, as far as I can see, the examples only exist in this repo as html, so in order to test them I had to manually copy each example from https://w3c.github.io/mnx/docs/mnx-reference/examples/ and paste into a corresponding .mnx text file. To automate testing we need to either generate .mnx files from the html, or perhaps better, generate the html from the .mnx files.
I used jsonschema under Linux openSUSE 15.5 to test my schema against the examples. (Other validators are available).
My script is nothing special, it simply invokes jsonschema for each .mnx file with my schema.
jsonschema -i file.mnx mnx_schema.json
Cool, that would be pretty easy to script in github actions provided the examples could be separated from the HTML in the repo.
I've updated the schema to reflect pull request #312 . I'll aim to keep this schema up to date with future developments.
@paul-bayleaf Thanks Paul! This is still on my to-do list to review, with the eventual goal of automatically generating the schema from our documentation system (using your work as a guide).
I've updated the schema to reflect commit 98b1a43, "Added way to encode inner-bar clef changes". Example Clef changes validates.
I've updated the schema to reflect commit c5e1db9 , "Added staff position type; changed clef to use it".
Closing this now, since we've added an automatically generated JSON Schema. Big thanks again to @paul-bayleaf for helping make this happen!
Implements a JSON schema for MNX. Tested against all the examples https://w3c.github.io/mnx/docs/mnx-reference/examples/
All verify with the exception of Accidentals (issue #307) and Orchestral layout and Systems layouts which fail by design (issue #306). Tested using jsonschema v3.2.0 under openSUSE Linux v15.5.
All objects have "additionalProperties": false, this is to spot mistyped optional properties, we might want to reconsider this for production.