State whether the final newline matters too. A configuration review that checks only indentation can miss the exact character that changes the result.
Compare two valid documents with different values
This original teaching fixture stores a two-line notice in a fictional application's notice field. The required value is the first line, one newline, then the second line, with no final newline:
notice: |-
Doors open at 09:00.
Bring your ticket.
The expected parsed string, expressed with an escaped newline, is:
"Doors open at 09:00.\nBring your ticket."
Changing only the scalar header changes the text:
notice: >-
Doors open at 09:00.
Bring your ticket.
For these ordinary equally indented lines, the expected parsed value becomes "Doors open at 09:00. Bring your ticket." The line break between the sentences has become a space. In both examples the minus sign strips the final newline. Removing it from the literal header gives the default clipping behavior, retaining one final newline for this block.
The YAML 1.2.2 specification, checked October 24, 2026, defines block scalar styles and chomping. Folding has additional rules for blank and more-indented lines; do not extrapolate this two-line example to every block.
Give ChatGPT the value contract as well as the YAML
Review this YAML multiline string without changing unrelated settings.
Application and YAML loader/version: [ENTER]
Relevant YAML including the scalar's indentation and following key: [PASTE]
Required parsed string, with newline characters made explicit: [PASTE]
Required final-newline behavior: [KEEP ONE / STRIP / PRESERVE ALL]
Explain the current scalar style and chomping indicator. Show the exact
parsed string as JSON so spaces and newline escapes are visible.
Propose the smallest change preserving the required string. Distinguish
YAML parsing from the application's later interpretation of that field.
Do not replace literal with folded style as a cosmetic cleanup, expand
environment variables, change keys, or claim application execution.
Flag behavior dependent on the supplied loader or missing schema.
OpenAI's prompting guidance recommends providing relevant context and boundaries. An exact target string is useful context here: “make this YAML cleaner” does not say whether the newline is meaningful.
Verify the parsed value with the consuming loader
For a local Python inspection when PyYAML is already installed, a minimal check is:
import json
import yaml
with open("notice.yaml", encoding="utf-8") as source:
notice = yaml.safe_load(source)["notice"]
print(json.dumps(notice))
assert notice == "Doors open at 09:00.\nBring your ticket."
Use the loader your application actually uses for the final acceptance check. Passing this Python assertion confirms the string under that loader; it does not establish that another application displays the notice on two lines. A web interface can collapse whitespace after parsing, which is a separate presentation issue.
For GitHub workflow dependency conditions, use the Actions guide. That problem concerns when jobs run. Here, keep the escaped expected string with the configuration review and compare the actual loaded value before replacing the maintained file.