YAML

YAML validator

YAML errors are usually one misplaced space. DocuFormat parses the file, reports where it stops making sense, and highlights the line.

app.yamlDetected: YAML ✓
server:  host: localhost   port: 8080
✗ line 2: Nested mappings are not allowed in compact mappings

Where YAML usually goes wrong

  • Inconsistent indentation. A key indented one space further than its siblings turns into a parse error.
  • Tabs. YAML indentation must use spaces.
  • Duplicate keys. The same key twice in one mapping is rejected.
  • Unquoted special characters. A value containing : or starting with *, & or @ needs quotes.
  • Unclosed flow collections. A [ or { that never closes.

Errors with positions

Each reported problem includes a line and column where the parser noticed it. Note that the position is where the parser noticed the issue, which can be a line or two after the real mistake, so read the lines just above it too.

Deterministic, then optional AI

Parsing is done locally with a standard YAML library. If the cause still is not clear, Explain can describe what is wrong in plain language, and AI Fix can propose a corrected file. Both are explicit, and neither is needed to validate. Once the file parses, run it through the YAML formatter.

Questions, answered

Does it validate Kubernetes or CI schemas?

No. It checks that the file is valid YAML, not that its keys match any particular tool’s schema.

Why does the error point to the wrong line?

Parsers report where they detect the problem, which can be after the actual mistake. Check the lines above the reported one.

Are tabs allowed?

No. YAML indentation must use spaces.

Try the YAML formatter on your own input.

Paste it, format it, and fix it if it is broken, once DocuFormat opens.