JSON Schemas¶
Each component's options are published as a JSON Schema, generated from its spec on every build of this site. An editor that knows the schema completes option names, shows their documentation, and flags a misspelled option or a wrong type before the file runs. That matters because most components ignore an option they do not know.
| Schema | For |
|---|---|
schemas/wmtk_app.json |
any wmtk_app file: it picks the component's schema by application |
schemas/<component>.json |
one component, e.g. schemas/tetwild.json |
In a file¶
Name the schema in the file itself; wmtk_app ignores the $schema key:
{
"$schema": "https://wildmeshing.github.io/wildmeshing-toolkit/schemas/wmtk_app.json",
"application": "qslim",
"input": "Octocat.obj",
"target_rel": 0.1
}
In VS Code¶
Or map files to the schema in the settings (.vscode/settings.json), with no change to the
files:
{
"json.schemas": [
{
"fileMatch": ["wmtk/*.json"],
"url": "https://wildmeshing.github.io/wildmeshing-toolkit/schemas/wmtk_app.json"
}
]
}
From the specs¶
The schemas are generated by docs/tools/gen_reference.py from the same *_spec.json files that
the components validate their options against; python docs/tools/gen_reference.py --out DIR
writes them locally. They mirror the specs' rules: types, defaults, allowed values, bounds, and
which options are required. The components remain the authority: a file the schema accepts can
still be refused for a combination of options the spec cannot express.