Toml schema
TOML Schema is a TOML-based schema language for describing and validating the structure, names, and value types of TOML configuration files. The project is written primarily in Java, distributed under the MIT License license, first published in 2020. Key topics include: toml, toml-language, toml-parser, toml-parsing, toml-validation.
TOML Schema
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.
Documentation
- 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.
Quick example
TOML document:
tomltitle = "TOML Example" [database] enabled = true ports = [8000, 8001, 8002]
TOML Schema document:
toml[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"
Reference implementations
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.
Schema reference from TOML
A TOML document can point to a schema with reserved metadata:
toml[toml-schema] version = "1.0.0" location = "config.tosd"
See SPEC.md for the full behavior.
Related work
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.
Contributors
Thanks to my friends!
- Andres Almiray @aalmiray
License
TOML Schema is licensed under the MIT License.
Contributors
Showing top 3 contributors by commit count.
