Automation · Validation
Schema Validation
Cheat sheet · https://pcornel.dk/topic.php?topic=5917
Answer
Schema Validation checks structured automation data against a declared versioned shape, required fields, data types, constraints and allowed composition rules.
Remember
- 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.
First checks
check-jsonschema --schemafile schema.json data.yml— schema validationkubeconform -strict manifests/— Kubernetes schemas- Ansible argument_specs — role inputs
Commands
python -c "import json,jsonschema; jsonschema.validate(json.load(open('<document.json>')),json.load(open('<schema.json>')))"- Read-only/validation observation for whether the selected JSON document satisfies the selected JSON Schema.
Verify in this order
data + schema → validator
Where it usually breaks
Schema Validation proves conformance to the selected structural contract only; it does not prove business logic, reference integrity, authorization or target outcome.
Schema Validation validation proof-boundary map
| 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 |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5917