Skip to content
Latchkey

taplo lint: Validate TOML Against a Schema

taplo lint parses TOML and, when a schema is associated, validates the data against it, exiting non-zero on any error.

Beyond formatting, taplo can validate TOML against a JSON Schema, so a malformed pyproject.toml or Cargo.toml fails the build with a precise message.

What it does

taplo lint parses each TOML file, reports syntax and semantic errors (duplicate keys, wrong types), and, when a JSON Schema is associated via --schema or a [schema] rule in taplo.toml, validates the document against it. It exits 1 on any diagnostic.

Common usage

Terminal
# lint for syntax and duplicate-key errors
taplo lint Cargo.toml

# validate against an explicit schema
taplo lint --schema taplo://cargo taplo Cargo.toml

# validate a file against a local schema
taplo lint --schema ./pyproject.schema.json pyproject.toml

Options

FlagWhat it does
--schema <url|path>JSON Schema to validate against
--config <file>taplo.toml with schema associations
--default-schema-catalogsUse the built-in schema catalog
--cache-path <dir>Where downloaded schemas are cached
--no-schemaSkip schema validation, syntax only

In CI

Associate schemas in taplo.toml (for example map Cargo.toml to the Cargo schema) and run taplo lint in the pipeline. A schema violation exits non-zero and fails the build, catching an invalid dependency table or a mistyped edition before it reaches a builder.

Common errors in CI

expected string, found integer (or similar) with a line/column marks a schema type mismatch. key ... is not allowed flags an unknown field when the schema forbids additional properties. duplicate key "..." is a TOML error caught even without a schema. failed to fetch schema means a remote schema URL is unreachable; cache it or point --schema at a local file.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →