Publish a JSON Schema of jevgate.toml - #13
Merged
Merged
Conversation
jevgate.schema.json is generated by a test from the configuration types, with every rule name, level and limit, and the test fails when it is out of date. jevgate init writes a #:schema line so editors complete and check the file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Phase 3 of the roadmap: editors with TOML schema support (Even Better TOML, Taplo) can complete and check
jevgate.toml.jevgate.schema.jsonis generated from the configuration types (schemars, a dev-dependency only; the binary doesn't change size) with each field's doc comment as its description, then filled in with every rule ID, key and group, the gate levels, and the limits the loader enforces (concurrency 1-8, positive budgets). TOML has no null, so optional values are plain types, and generated defaults are dropped since the descriptions state the real ones.JEVGATE_WRITE_SCHEMA=1 cargo testrewrites it), so it can't drift from the loader.jevgate initwrites#:schema .../vX.Y.Z/jevgate.schema.json, pinned to its own release; this repository'sjevgate.tomluses the local file.How it was checked
With Python's
jsonschema, the schema is a valid draft 2020-12 schema; this repository'sjevgate.toml,jevgate init's output and the README example validate; a misspelled key, an unknown level, a misspelled rule andconcurrency = 9are rejected.Listing it in SchemaStore (so editors find it for any
jevgate.tomlwithout the directive) is a pull request to SchemaStore, left for later.