TOML all the way down
Schemas are valid TOML files, conventionally stored with the required .tosd extension.
A TOML-native schema language
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].
The examples below are fragments of one schema, not standalone files.
Metadata
Every schema document starts with [toml-schema] and a full SemVer version.
[toml-schema]
version = "1.0.0"
Elements
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
Arrays can validate homogeneous item types or reference reusable item schemas.
[elements.database.ports]
type = "array"
arraytype = "integer"
minlength = 1
Types
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"
Collections
A collection validates user-defined keys, such as named servers or environments.
[elements.servers]
type = "collection"
typeof = "types.server"
minlength = 1
Constraints
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].
Versioned metadata[toml-schema] declares SemVer language compatibility.
Type referencestypeof, itemtype, items, oneof, and anyof can reference built-in type names or reusable [types].
Dynamic keyscollection validates user-provided table keys.
Union shapesoneof and anyof model alternative valid forms.
Arrays and tuplesarraytype, itemtype, and items cover homogeneous and positional arrays.
Media typeTOML Schema files use .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.