Plugin Reference
linkml-term-validator provides LinkML ValidationPlugin implementations plus a standalone schema validator. Import plugins from linkml_term_validator.plugins unless you need an internal module directly.
Shared Options
The ontology-backed plugins share these constructor options:
| Parameter | Default | Description |
|---|---|---|
oak_adapter_string |
sqlite:obo: |
Default OAK adapter string |
cache_labels |
True |
Write ontology labels to the file cache |
cache_dir |
cache |
Directory for label and enum caches |
oak_config_path |
None |
Path to oak_config.yaml |
offline |
False |
Read only from cache; never build OAK adapters |
severity_overrides |
None |
Map an error mode to the severity it is reported at |
Dynamic enum capable plugins also accept:
| Parameter | Default | Description |
|---|---|---|
cache_enum_expansions |
True |
Write dynamic enum expansion caches |
saturate_enum_caches |
False |
Materialize full closures during progressive validation |
cache_strategy |
progressive |
progressive or greedy |
Severity Overrides
Every result the plugins emit carries an error mode (the result's type) and a
default severity. severity_overrides remaps any of them:
from linkml_term_validator.plugins import BindingValidationPlugin
plugin = BindingValidationPlugin(
severity_overrides={"binding_label_mismatch": "WARN"},
)
This matters most in CI. linkml-validate exits non-zero only when a result
has severity ERROR, so anything reported at WARN is printed while the
process still exits 0. Remapping a single mode lets a project tighten or relax
one specific check without touching the severity of everything else.
The available error modes, and the severity each is reported at by default:
| Error mode | Default | Emitted by |
|---|---|---|
binding_validation |
ERROR |
BindingValidationPlugin |
binding_label_invalid |
ERROR |
BindingValidationPlugin |
binding_label_mismatch |
ERROR |
BindingValidationPlugin |
term_not_found |
ERROR |
BindingValidationPlugin |
dynamic_enum_validation |
ERROR |
DynamicEnumPlugin |
permissible_value_meaning |
ERROR |
PermissibleValueMeaningPlugin |
permissible_value_obsolete |
ERROR |
PermissibleValueMeaningPlugin |
permissible_value_label_mismatch |
WARN (ERROR under strict_mode) |
PermissibleValueMeaningPlugin |
Keys and values accept either strings or the ErrorMode / Severity enum
members; severities are case-insensitive and WARNING is accepted as an alias
for WARN. An unrecognized key or severity raises ValueError rather than
being ignored, so a typo cannot silently leave a problem at its default
severity.
The mapping may also live in oak_config.yaml, alongside the adapter map:
ontology_adapters:
GO: sqlite:obo:go
severity_overrides:
binding_label_mismatch: WARN
Constructor arguments win over the config file. For
permissible_value_label_mismatch, an explicit override wins over strict_mode.
Which commands honor it
severity_overrides changes the severity a plugin reports at, so it takes
effect wherever that plugin runs — but whether the severity changes an exit code
depends on the command:
| Command | Effect |
|---|---|
linkml-validate |
Full effect: exits non-zero only on ERROR |
linkml-term-validator validate-data |
Results are reported at the new severity, but the default --fail-on any exits 1 on any result regardless. Pass --fail-on error to make the severity decide. There is no severity_overrides CLI flag — set it in oak_config.yaml and pass that with -c, as with other plugin config |
linkml-term-validator validate-schema |
No effect. This command uses EnumValidator, a separate implementation that does not run PermissibleValueMeaningPlugin. Use strict_mode there |
PermissibleValueMeaningPlugin
Validates schema enum permissible value meaning fields. It checks that each CURIE resolves and that the ontology label matches one of the schema-provided labels.
from linkml_term_validator.plugins import PermissibleValueMeaningPlugin
plugin = PermissibleValueMeaningPlugin(
oak_adapter_string="sqlite:obo:",
oak_config_path="oak_config.yaml",
strict_mode=False,
cache_labels=True,
cache_dir="cache",
offline=False,
)
Additional option:
| Parameter | Default | Description |
|---|---|---|
strict_mode |
False |
Treat warnings as errors |
For direct schema validation outside LinkML's plugin lifecycle, use EnumValidator:
from linkml_term_validator.models import ValidationConfig
from linkml_term_validator.validator import EnumValidator
config = ValidationConfig(
oak_config_path="oak_config.yaml",
cache_dir="cache",
)
validator = EnumValidator(config)
result = validator.validate_schema("schema.yaml")
if result.has_errors():
for issue in result.issues:
print(f"{issue.severity}: {issue.message}")
DynamicEnumPlugin
Validates data values whose slot range is a dynamic enum.
from linkml.validator import Validator
from linkml.validator.loaders import YamlLoader
from linkml_term_validator.plugins import DynamicEnumPlugin
plugin = DynamicEnumPlugin(
oak_adapter_string="sqlite:obo:",
oak_config_path="oak_config.yaml",
cache_strategy="progressive",
)
validator = Validator(schema="schema.yaml", validation_plugins=[plugin])
loader = YamlLoader("data.yaml")
report = validator.validate_source(loader, target_class="Sample")
It validates:
reachable_from: descendants by default, or ancestors whentraverse_up: trueinclude_self: source nodes are excluded by default and included only when trueconcepts: explicit concept listsinclude,minus, andinherits: enum expression composition- static
permissible_values: both permissible value names andmeaningCURIEs
matches expressions are recognized as dynamic enum definitions and included in cache keys, but full pattern-match validation is not implemented yet.
BindingValidationPlugin
Validates LinkML bindings on nested objects and, by default, validates labels on the same nested object.
from linkml.validator import Validator
from linkml.validator.loaders import YamlLoader
from linkml_term_validator.plugins import BindingValidationPlugin
plugin = BindingValidationPlugin(
oak_adapter_string="sqlite:obo:",
oak_config_path="oak_config.yaml",
validate_labels=True,
strict=True,
)
validator = Validator(schema="schema.yaml", validation_plugins=[plugin])
loader = YamlLoader("data.yaml")
report = validator.validate_source(loader, target_class="GeneAnnotation")
Additional options:
| Parameter | Default | Description |
|---|---|---|
validate_labels |
True |
Check nested label fields against ontology labels |
strict |
True |
Fail when configured term IDs cannot be resolved |
The plugin:
- Recursively walks nested objects, including multivalued nested objects
- Applies
binds_value_ofto extract the field constrained by the binding - Validates static and dynamic enum ranges
- Uses slots with
implements: [rdfs:label]orslot_uri: rdfs:labelas label fields - Falls back to a field named
labelwhen no label property is declared
Composition
Use both data plugins when a schema has direct dynamic enum slots and nested binding objects:
from linkml.validator import Validator
from linkml.validator.loaders import YamlLoader
from linkml_term_validator.plugins import DynamicEnumPlugin, BindingValidationPlugin
plugins = [
DynamicEnumPlugin(oak_config_path="oak_config.yaml"),
BindingValidationPlugin(oak_config_path="oak_config.yaml"),
]
validator = Validator(schema="schema.yaml", validation_plugins=plugins)
report = validator.validate_source(YamlLoader("data.yaml"), target_class="Sample")
The CLI validate-data command creates this composition by default. Disable either part with --no-dynamic-enums or --no-bindings.
linkml-validate Configuration
All plugins can be configured for linkml-validate:
schema: schema.yaml
target_class: Sample
data_sources:
- data.yaml
plugins:
"linkml_term_validator.plugins.DynamicEnumPlugin":
oak_adapter_string: "sqlite:obo:"
oak_config_path: oak_config.yaml
cache_dir: cache
cache_strategy: progressive
"linkml_term_validator.plugins.BindingValidationPlugin":
oak_adapter_string: "sqlite:obo:"
oak_config_path: oak_config.yaml
validate_labels: true
cache_dir: cache
cache_strategy: progressive
linkml-validate --config validation_config.yaml