Pcornel
Automation · Data Formats › YAML

Validation

Cheat sheet · https://pcornel.dk/topic.php?topic=5829

Back to the Topic

Answer

Validate YAML with yamllint for syntax and style, then against a schema or the tool's own checks (ansible-lint, kubectl --dry-run, docker compose config) before using it.

Remember

  • yamllint checks syntax and style.
  • Tools add their own validation.
  • Schemas catch structural errors.

First checks

  • check-jsonschema --schemafile schema.json file.yaml — schema validation
  • yamllint file.yaml — style
  • kubeconform manifest.yaml — Kubernetes schema

Verify in this order

YAML → lint + schema → pass/fail

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5829

Confirmation

Confirm action

Continue?