linkml validate

Validate data against a LinkML schema, or validate a schema itself against the metamodel.

Usage

Validate data against a schema:

linkml validate -s schema.yaml data.yaml

Validate a schema against the metamodel (no -s flag):

linkml validate schema.yaml

When -s/--schema is omitted, positional arguments are treated as schema files and validated against the LinkML metamodel — verifying required fields, correct types, valid URIs, and NCName constraints.

Validate and fix data:

linkml validate -s schema.yaml --fix data.yaml

With --fix, data is normalized before validation: types are coerced (e.g. "5"5), collection forms are restructured, and the corrected data is output. Any issues that couldn’t be fixed are reported.

For schema quality checks (naming conventions, recommended fields, canonical prefixes), use linkml lint instead.

Deprecated

  • linkml-normalize — deprecated in favor of linkml validate --fix. The linkml-normalize CLI performed the same normalization and validation but as a standalone entry point in linkml-runtime.

Reference

linkml validate

Validate data against a LinkML schema, or validate a schema against the metamodel.

When -s/–schema is provided, positional arguments are data files to validate against that schema.

When -s/–schema is omitted, positional arguments are treated as schema files and validated against the LinkML metamodel.

linkml validate [OPTIONS] [DATA_SOURCES]...

Options

-s, --schema <schema>

Schema file to validate data against. When omitted, positional arguments are treated as schemas and validated against the LinkML metamodel.

-C, --target-class <target_class>

Class within the schema to validate data against

--config <config>

Validation configuration YAML file.

--exit-on-first-failure

Exit after the first validation failure is found. If not specified all validation failures are reported.

-D, --include-context, --no-include-context

Include additional context when reporting of validation errors.

Default:

False

--allow-null-for-optional-enums

Downgrade enum validation errors to warnings when the value is null/empty and the slot is not required. Prevents ‘None is not one of […]’ and “’’ is not one of […]” errors for optional enum slots.

--fix

Normalize a YAML/JSON data file to conform to the schema (type coercion, collection form restructuring) and write the corrected data to stdout. Diagnostics go to stderr. The normalized output is then validated to report any remaining issues.

-V, --version

Show the version and exit.

Arguments

DATA_SOURCES

Optional argument(s)