Skip to content

fix(yaml): do not double quote keys in stringify() with condenseFlow - #7363

Open
sebxt wants to merge 1 commit into
denoland:mainfrom
sebxt:fix/yaml-condenseflow-quoted-keys
Open

sebxt wants to merge 1 commit into
denoland:mainfrom
sebxt:fix/yaml-condenseflow-quoted-keys

Conversation

@sebxt

@sebxt sebxt commented Oct 19, 2026

Copy link
Copy Markdown

With condenseFlow: true, stringify() wrapped every flow mapping key in double quotes, including keys that were already serialized as quoted scalars. { "1": 1 } became {"'1'":1}, which parses back as { "'1'": 1 }, and keys such as a"b or a\nb produced output that parse() rejects. Plain keys were wrapped without escaping, so a plain key containing a backslash changed meaning, and the ? marker for keys over 1024 characters ended up inside the quotes.

This change leaves keys that are already quoted as they are, escapes plain keys before wrapping them in double quotes, and keeps the ? marker outside the key.

Added a test covering the affected keys and a round trip through parse(). deno task test for yaml and deno fmt --check / deno lint pass.

Fixes #7362

Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>
@github-actions github-actions Bot added the yaml label Oct 19, 2026
@CLAassistant

CLAassistant commented Oct 19, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.06%. Comparing base (f834d02) to head (9cece57).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7363      +/-   ##
==========================================
+ Coverage   95.04%   95.06%   +0.02%     
==========================================
  Files         619      618       -1     
  Lines       52012    51763     -249     
  Branches     9450     9407      -43     
==========================================
- Hits        49434    49208     -226     
+ Misses       2031     2014      -17     
+ Partials      547      541       -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@std/yaml: stringify() with condenseFlow wraps already quoted keys in a second pair of quotes

2 participants