JSON Schemas
Retake’s formats are described by hand-written JSON Schemas (draft 2020-12) in
schema/:
| File | Describes |
|---|---|
take-v1.schema.json | One line (record) of a format-1 take |
retake-toml.schema.json | retake.toml |
check-v1.schema.json | retake check --json output |
ls-v1.schema.json | retake ls --json output |
They are a contract: retake check validates every take against the schema of its
format, and Retake’s test suite checks every take, retake.toml and --json output it
produces against them. Takes do not name their schema; the header’s format selects it.
Each schema’s $id is its URL on this site,
https://simdugas.github.io/retake/schema/<file name>; building the guide copies the
schemas there. The site is deployed from each release, so it serves the schemas of the
latest release; the repository’s schema/ directory has those of any other version.
Editor support for retake.toml
Editors using Taplo (e.g. the Even Better TOML extension for
VS Code) can validate and complete retake.toml with the schema. Either put a directive
on the first line of the file:
#:schema https://simdugas.github.io/retake/schema/retake-toml.schema.json
or associate it in a .taplo.toml at the project root:
[[rule]]
include = ["retake.toml"]
[rule.schema]
path = "https://simdugas.github.io/retake/schema/retake-toml.schema.json"
A local copy of the file works too (path = "./retake-toml.schema.json"), and is the
way to pin the schema to the Retake version you run: the site serves the schema of the
version the guide was last built from.