hotg-ai / rune

Rune provides containers to encapsulate and deploy edgeML pipelines and applications
Apache License 2.0
133 stars 15 forks source link

Create a JSON schema for the Runefile #349

Closed Michael-F-Bryan closed 2 years ago

Michael-F-Bryan commented 2 years ago

This uses the schemars crate to automatically generate a JSON schema for our Runefile format.

I've deliberately committed a copy of this schema to the repository (crates/compiler/runefile-schema.json) and added a test that makes sure our hotg_rune_compiler::parse::yaml types are kept in sync with the JSON schema. If it changes at any point (e.g. because we've added docs to an item) then a test will fail, telling us to run cargo xtask update-schema.

We also make sure all the example Runefiles validate using the JSON schema.

Some useful helper programs: