Json Schema
TOML itself may add schema specifications, but like Taplo, Tombi is also trying to add validation functions to the linter that support JSON Schema.
Currently, we are considering adding special information called x-tombi-*
to JSON Schema.
Schema Priority
This section will discuss how to prioritize the application of x-tombi-*
keys in your JSON Schema.
#:schema
directive in the top comment of the TOML file (Same as Taplo)- JSON Schema specified in the tombi configuration file
- JSON Schema specified in the JSON Schema Store
Formatting
x-tombi-toml-version
This key is for automatically determining the TOML version.
Currently, only v1.0.0
is supported.
v1.1.0-preview
is also available to experience, which proposes awesome features such as allowing the trailing comma in Inline Table.
Until v1.1.0
is released officially, please specify v1.0.0
.
x-tombi-table-keys-order
For automatically sorting table keys like [dependencies]
There are three strategies.
ascending
descending
schema
If you use schema
, it is not recommended to use additionalProperties
or patternProperties
.
They are not sorted after properties
and placed at the end.
Linting
Strict Mode
Tombi enables strict
mode by default, and objects without additionalProperties
are treated as additionalProperties: false
, which is different from the JSON Schema specification.
This choice resolves the ambiguity of JSON Schema and performs more strict validation.
If you want to disable strict mode, add schema.strict = false
to tombi.toml
.
Language Gap
TOML is a different language from JSON, so applying JSON Schema to TOML is not a one-to-one relationship.
However, JSON Schema is useful as a tool for representing the structure of TOML. And there are already many schema assets.
Tombi overcomes the language gap by using an abbreviation to represent JSON Schema that does not exist in TOML.
If you are interested, check out the Hover section to see how it represents concepts in JSON Schema.