Skip to main content
Back to Blog

Review YAML Conversion Before Changing a CI File

A CI YAML parsing example and the cost of rewriting comments and aliases.

Shashank Rawlani

Engineering Leader | Builder | Problem Solver | AI Engineer

Published Oct 25, 20262 min read
View AI-ready Markdown
Two linked green YAML rows in the left pane become two separate green rows in the JSON pane; an orange source comment above them stops at a crossed-out marker.
Listen to this article · 3 min

Use the YAML Formatter to check syntax, choose indentation, and inspect how a CI configuration parses. Review the output before replacing the source file: formatting reconstructs the document and may discard comments or rename anchors.

A workflow file looks aligned, yet the runner rejects it. Read what the parser sees before moving spaces around at random. The tool can format YAML or show its JSON shape; those are different checks.

See the object behind the indentation

In the left pane, enter:

jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 15

Choose YAML → JSON. The live result contains jobs.test["runs-on"] as "ubuntu-latest" and jobs.test["timeout-minutes"] as the number 15. That confirms the indentation and scalar type the converter inferred. It does not confirm that a particular CI service accepts those keys or values; use that service’s workflow validator for its schema. For a promptfoo eval file, the LLM Eval Test-Case Builder does that second check against the promptfoo config schema, including assertion types and misspelt keys a YAML parser cannot know about.

Formatting is a rewrite

Try # test runner above job: &common with second: *common below it. The live Format result dropped the comment and renamed the anchor to &ref_0 while keeping the alias relationship. In YAML → JSON mode, the shared mapping appeared twice, once under each key. JSON has no anchor syntax, so that expansion is expected. The implementation also refuses conversion when an expanded document would exceed its two-million-character estimate; Format retains aliases instead.

YAML 1.2 defines comments and anchor syntax as part of its text representation. A converter can preserve data meaning while changing the file a reviewer sees. If comments carry operational guidance, edit the original file and validate it with the CI platform’s own parser after using this page for diagnosis.

Compare before replacing

Paste one failing job, inspect the validity message and JSON shape, then compare any formatted output against the original before committing. Keep comments and deliberately named anchors in the source file unless the rewrite is intended.

YAML references