TOML all the way down
Schemas are valid TOML files, conventionally stored with the required .tosd extension.
TOML Schema describes the structure, names, value types, and constraints of TOML configuration documents using TOML syntax itself.
TOML Schema is intentionally smaller than general-purpose schema systems. It focuses on the TOML value model and keeps schemas readable for people who already know TOML.
Schemas are valid TOML files, conventionally stored with the required .tosd extension.
Define required fields, scalar types, arrays, tables, dynamic collections, unions, ranges, and patterns.
Java, Go, and Rust implementations validate examples, self-schema behavior, and CLI workflows in CI.
A schema starts with versioned metadata, then describes the TOML document
under [elements]. Reusable shapes live under [types].
Every schema document starts with [toml-schema] and a full SemVer version.
[toml-schema]
version = "1.0.0"
Each entry under [elements] maps to a TOML key, table, or nested value.
[elements.title]
type = "string"
[elements.database]
type = "table"
[elements.database.enabled]
type = "boolean"
Arrays can validate homogeneous item types or reference reusable item schemas.
[elements.database.ports]
type = "array"
arraytype = "integer"
minlength = 1
Reusable [types] definitions keep repeated structures in one place.
[types.server]
type = "table"
[types.server.ip]
type = "string"
pattern = "^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$"
[types.server.role]
type = "string"
A collection validates user-defined keys, such as named servers or environments.
[elements.servers]
type = "collection"
typeof = "types.server"
minlength = 1
Values can be constrained with allowed values, numeric ranges, string lengths, or patterns.
[elements.environment]
type = "string"
allowedvalues = ["dev", "stage", "prod"]
[elements.retries]
type = "integer"
min = 0
max = 10
The language is built around three top-level tables: [toml-schema],
optional reusable [types], and required document [elements].
[toml-schema] declares SemVer language compatibility.[types] definitions keep schemas compact and consistent.collection validates user-provided table keys.oneof and anyof model alternative valid forms.arraytype, itemtype, and items cover homogeneous and positional arrays..tosd and application/tosd.The repository includes implementation work for multiple ecosystems and a shared conformance expectation for schema validation.
Uses Tomlj to parse TOML and validates documents against .tosd schemas.
Uses go-toml and supports explicit schema validation and schema-location lookup.
Uses the Rust toml crate and mirrors cross-language behavior.