TOML Schema is a TOML-based schema language for describing and validating the structure, names, and value types of TOML configuration files.
A TOML Schema document is itself a valid TOML document. Validators can use it to catch misconfiguration before production and tooling can use it for editor validation, completion, and hints.
- Specification - the TOML Schema language, validation semantics, file extension, MIME type, and TOML schema-reference metadata.
- ABNF grammar - a compact grammar for the TOML Schema vocabulary and document shape, layered on top of TOML 1.0.
- Self-schema - a TOML Schema document for TOML Schema documents.
- Example schema and example TOML document - a worked example used by the reference implementation tests.
- Reference implementations - implementation status, Java CLI/library usage, and conformance expectations.
TOML document:
title = "TOML Example"
[database]
enabled = true
ports = [8000, 8001, 8002]TOML Schema document:
[toml-schema]
version = "1.0.0"
[elements.title]
type = "string"
[elements.database]
type = "table"
[elements.database.enabled]
type = "boolean"
[elements.database.ports]
type = "array"
arraytype = "integer"Java, Go, and Rust reference implementations live under reference-implementations/. See Reference implementations for implementation status, build/test commands, CLI usage, schema extraction, and conformance expectations.
A TOML document can point to a schema with reserved metadata:
[toml-schema]
version = "1.0.0"
location = "config.tosd"See SPEC.md for the full behavior.
There is an ongoing effort to bring schema support for TOML under toml-lang/toml#792. This proposal intentionally focuses on a smaller TOML-native schema language.
Thanks to my friends!
- Andres Almiray @aalmiray
TOML Schema is licensed under the MIT License.