Iyamlschema Processor
Purpose
Validates YAML files against JSON schemas referenced by a $schema URL field in each file. Checks both schema conformance and property ordering. Native (in-process, no external tools required).
How It Works
For each YAML file:
- Parses the YAML content
- Reads the
$schemafield to get the schema URL - Fetches the schema (cached in
.rsconstruct/webcache.redb) - Validates the data against the schema (including resolving remote
$refreferences) - Checks that object keys appear in the order specified by
propertyOrderingfields in the schema
Fails if any file is missing $schema, fails schema validation, or has keys in the wrong order.
Configuration
[processor.iyamlschema]
src_dirs = ["yaml"]
check_ordering = true # Check propertyOrdering (default: true)
| Key | Type | Default | Description |
|---|---|---|---|
check_ordering | boolean | true | Whether to check property ordering against propertyOrdering in the schema |
dep_inputs | string[] | [] | Extra files whose changes trigger rebuilds |
Schema Requirements
Each YAML file must contain a $schema field with a URL pointing to a JSON schema:
$schema: "https://example.com/schemas/mydata.json"
name: Alice
age: 30
The schema is fetched via HTTP and cached locally. Subsequent builds use the cached version. Use rsconstruct webcache clear to force re-fetching.
Property Ordering
If the schema contains propertyOrdering arrays, the processor checks that data keys appear in the specified order:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" }
},
"propertyOrdering": ["name", "age"]
}
Set check_ordering = false to disable this check.
Batch Support
Files are validated individually within a batch. Partial failure is handled correctly.