How to Validate YAML Syntax
YAML Validation
When to Validate YAML
Validate YAML before deploying configs, pushing CI workflow changes, or applying Kubernetes manifests. Catch indentation errors and syntax issues early instead of at deploy time.
Common YAML Errors
- Tabs instead of spaces for indentation
- Inconsistent indent levels in nested structures
- Unquoted special characters in scalar values
- Missing colons after keys
Common Mistakes
- Assuming valid syntax means valid Kubernetes schema — use kubeval separately
- YAML 1.1 truthy values (
yes/no) surprising JSON converts
Developer Tips
- Validate in CI:
yamllintor parse step before deploy - Format after fixing errors for readable error context
- Quote strings that look like booleans or numbers if you need literal text
Frequently asked questions
Does validation check schema or just syntax?
This tool checks YAML syntax only. It does not validate against Kubernetes, OpenAPI, or other schemas.
Can I validate multi-document YAML?
Yes. Files with --- separators are validated document by document. Each document is reported separately in the output.