{"title":"Review YAML Conversion Before Changing a CI File","excerpt":"A CI YAML parsing example and the cost of rewriting comments and aliases.","canonicalUrl":"https://automationtester.in/blog/tools-reviews/review-yaml-conversion-before-ci","category":{"name":"Tools & Reviews","slug":"tools-reviews"},"tags":["yaml","ci-cd","configuration"],"author":{"name":"Shashank Rawlani","url":"https://shashank.rawlani.com","linkedin":"https://www.linkedin.com/in/shashankrawlani/"},"datePublished":"2026-10-25T05:30:00.000Z","dateModified":"2026-10-25T05:30:00.000Z","coverImage":{"url":"https://ik.imagekit.io/automationtester/automationtester-in/blog/covers/v3/review-yaml-conversion-before-ci.webp","alt":"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."},"contentHtml":"<p>Use the <a href=\"https://automationtester.in/tools/yaml-formatter\">YAML Formatter</a> 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.</p>\n\n<p>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.</p>\n\n<h2 id=\"yaml-parse-job\">See the object behind the indentation</h2>\n<p>In the left pane, enter:</p>\n<pre class=\"language-yaml\"><code class=\"language-yaml\">jobs:\n  test:\n    runs-on: ubuntu-latest\n    timeout-minutes: 15</code></pre>\n<p>Choose <strong>YAML → JSON</strong>. The live result contains <code>jobs.test[\"runs-on\"]</code> as <code>\"ubuntu-latest\"</code> and <code>jobs.test[\"timeout-minutes\"]</code> as the number <code>15</code>. 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 <a href=\"https://automationtester.in/tools/llm-eval-case-builder\">LLM Eval Test-Case Builder</a> does that second check against the promptfoo config schema, including assertion types and misspelt keys a YAML parser cannot know about.</p>\n\n<h2 id=\"yaml-roundtrip-cost\">Formatting is a rewrite</h2>\n<p>Try <code># test runner</code> above <code>job: &amp;common</code> with <code>second: *common</code> below it. The live <strong>Format</strong> result dropped the comment and renamed the anchor to <code>&amp;ref_0</code> while keeping the alias relationship. In <strong>YAML → JSON</strong> 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.</p>\n<p>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.</p>\n\n<h2 id=\"yaml-apply\">Compare before replacing</h2>\n<p>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.</p>\n\n<h2 id=\"yaml-references\">YAML references</h2>\n<ul><li><a href=\"https://yaml.org/spec/1.2.2/\">YAML 1.2.2 specification</a>: mappings, scalars, comments, and aliases.</li><li><a href=\"https://automationtester.in/tools/yaml-formatter\">YAML Formatter</a>: observed conversion and formatting behavior.</li></ul>"}