Use it when gating automation around Schema Validation. Keep authoritative criteria, immutable source/input, exact target identity, validator version, observed/effective state and workload acceptance as separate proof boundaries.
Schema Validation
Schema Validation checks structured automation data against a declared versioned shape, required fields, data types, constraints and allowed composition rules.
1. Schema validation checks structure and types.
2. Versioned schemas.
3. Validate data files and API payloads.
4. Strict mode.
5. Generate docs.
data + schema → validator
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
python -c "import json,jsonschema; jsonschema.validate(json.load(open('<document.json>')),json.load(open('<schema.json>')))"Primary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
structured artifact → decode → schema id/version → structural/type constraints → compatibility policy → schema verdict → semantic/target validation
Healthy evidence: the exact artifact validates against the intended schema version with controlled unknown-field and compatibility behavior.
Step 2 Command read-back and what it shows Verify boundary
For Validation → Schema Validation, read back with python -c "import json,jsonschema; jsonschema.validate(json.load(open('<document.json>')),json.load(open('<schema.json>')))". Success is discriminated by the document validates against the explicitly intended schema revision, required/custom-format checks used by the consumer pass, and representative consumer processing accepts the same document; failure remains when parse or constraint errors, unexpected schema revision, permissive validation that ignores required contract elements or consumer rejection despite nominal schema pass. The JSON Schema validation shows encoded structural constraints for the chosen schema, but it does not show business semantics, authorization, freshness or consumer behavior outside the schema.
Step 3 Common mistakes Verify boundary
- Schemas out of date.
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: a stale or wrong schema is used, unknown fields are silently ignored, or structural validity is mistaken for operational correctness.
Schema Validation shows conformance to the selected structural contract only, but it does not show business logic, reference integrity, authorization or target outcome.
Step 5 Observation-driven branch and next-check logic Narrow the fault
Start Validation → Schema Validation from one identified target/request/artifact and timestamp. Decision path: if document cannot parse, fix serialization first; if schema validator reports field/type/enum errors, inspect producer data; if data matches an older/newer schema unexpectedly, resolve contract version before adding permissive workarounds.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Schema valid ≠ business semantics correct.
- Schema version known ≠ producer and consumer behavior compatible.
- Required fields present ≠ referenced values exist.
- Additional properties allowed ≠ additional properties understood or safe.
check-jsonschema --schemafile schema.json data.yml— schema validationkubeconform -strict manifests/— Kubernetes schemas- Ansible argument_specs — role inputs
ReferenceWhat it is1 section · depth on demand
Core model
Identify the schema identity/version, decode the document, validate required/optional fields, types, enums, patterns, cardinality and additional-property policy, then handle compatibility and semantic checks separately.
ReferenceHow it works1 section · depth on demand
How it works
Validation → Schema Validation owns serialized input/output documents, the exact schema revision selected for them and constraints such as required fields, types, enums, patterns and nested object structure. Schema validation parses a document and evaluates structural constraints against a versioned schema; schema identity must travel with the data contract so producers and consumers do not silently validate against different revisions. Keep these adjacent boundaries separate: semantic cross-record rules, authoritative lookups, backward compatibility and custom formats are separate things to check unless encoded by validators. A key diagnostic distinction is that schema-valid data can still be semantically wrong, and schema failure can indicate either bad data or a producer/consumer contract-version mismatch.
ReferenceImportant terms & boundaries2 sections · depth on demand
What this shows and what it does not
Schema Validation owns structural contracts; JSON/YAML/XML, API and platform branches own encoding details and domain semantics.
In depth
Schema validation checks structured data (YAML/JSON) against a formal schema — required keys, types, allowed values, patterns — so data errors are caught before templates or APIs consume them.
# schemas/vlan.schema.yaml
type: object
required: [id, name]
properties:
id: { type: integer, minimum: 2, maximum: 4094 }
name: { type: string, pattern: "^[a-z0-9-]+$" }
additionalProperties: false
check-jsonschema --schemafile schemas/vlan.schema.yaml data/vlans/*.yml
additionalProperties: false catches misspelled keys that would otherwise be ignored silently.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Validation > Schema Validation. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://json-schema.org/learn/getting-started-step-by-step · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Schema Validation validation proof-boundary map
Fast criteria/scope, execution and effective-outcome proof boundaries for Schema Validation.
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Criteria / input | Criteria, source revision, validator and exact target identity are explicit | A generic pass exists without versioned criteria or target correlation |
| Preconditions / operation | Current authoritative facts are bound to the exact operation | Stale preflight or requested state substitutes for execution-time facts |
| Effective outcome | Authoritative state/read-back and service-relevant evidence match the expected result | Tool/test/validator success substitutes for effective target or workload proof |
| Limits / next action | Coverage limits, unknowns and failures drive the next narrower check | Unknown evidence becomes pass, retries hide failures or broad success is inferred from one check |