Generate air.schema.json
using schemars
#212
Merged
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.
First step of #106
This PR:
"schemars"
feature to thesettings
andworkspace
crates that optionally deriveJsonSchema
. Note thatschemars
is smart enough to respect serde attributes, likerename_all = "kebab-case"
anddeny_unknown_fields
, which is awesomeair.schema.json
using a new xtask helper, callable throughjust gen-schema
TomlOptions
struct. If the options struct is updated, the schema must also be updated.This is a first step, we also need to either:
tomlValidation
contribution point, which Even Better Toml will look for and load automatically https://taplo.tamasfe.dev/configuration/developing-schemas.html#visual-studio-code-extensions. This will not benefit other IDEs than VS Code and Positron. It has the small benefit of not needing to PR into schemastore when we make a change, but I'm hoping that won't matter much, so I don't think we should do this approach.To immediately try this out, you can put this in your settings, then make sure to run
Developer: Restart Extension Host
Then open an
air.toml
and it should do thisScreen.Recording.2025-02-07.at.1.20.54.PM.mov
As you can see in the video, there are some issues with field duplication. I do not believe this is our fault, I think this is this taplo issue tamasfe/taplo#514. Ruff also has the same issues. I do not believe we should let this block us, as this is still quite useful even with the duplication.