Emitter has no width-based line wrapping or canonical-mode controls #10
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Status (2026-07-10)
Open. Found by a public-API feature-parity audit against Yams
(NodetteHQ/PureYAMLYamsComparison,
Reports/macos-2026-07-10-apisguru-sample-504/FEATURE-PARITY.md),not by a corpus parse-success run: this is a capability gap in the dump/emit
side, not a correctness bug.
Yams's
Emitter.Optionsexposes: canonical mode, indent width, line width,allowUnicode, line-break style, explicit document start/end, YAML version,sortKeys, per-collection style (flow/block), scalar style, and aredundancy/aliasing strategy.
PureYAML's
Emitting.Options(Sources/Emitting/Options.swift) has exactlytwo knobs:
scalarStyle(.quoted/.plainWhenSafe/.literalBlockWhenMultiline),applied uniformly across the whole document.
collectionStyle(.block/.flow), also applied uniformly.Missing entirely: indent width, line width/wrapping, canonical mode,
sortKeys(key order is always insertion-preserving; this is a deliberatedesign choice since it also preserves duplicate keys, not itself a bug, but
it means there is no opt-in sorted output either), explicit document
start/end control, and any way to override style on a single node rather
than the whole document.
Impact
Anything that needs specific, tool-facing output formatting (a fixed line
width for readability, deterministic sorted-key output for diffable
generated files, canonical form for a strict-comparison use case) cannot get
it from PureYAML today; the emitted YAML's exact shape is far less
controllable than Yams's.
Work
indent,width, andsortKeyslook like the highest-value additions based on what Yams exposes and what
real consumers are likeliest to reach for.
Emitting.Optionsand thread the new settings throughEmitting.Dumper(Sources/Emitting/Dumper*.swift).here or belong with the Node-equivalent type work (#9), since per-node
style really only makes sense once there is a node-level type to attach it
to.
existing
Emittingtest conventions.See NodetteHQ/PureYAMLYamsComparison's
FEATURE-PARITY.mdfor the fullaudit.
Part of #8.
indentWidthandsortKeysare done (Emitting.Options, threaded throughDumper.swift/Dumper.Mapping.swift), verified with round-trip tests and no regression against the official yaml-test-suite (still 333/333 parse-level, 208/208 value-level).sortKeysonly sorts a mapping when every key in it is a plain string; a mapping with any complex (mapping/sequence) key stays in insertion order, since there's no well-defined ordering across mixed key kinds to sort by.Not done, deliberately:
width-based line wrapping (real line-folding logic) and canonical mode (needs its own definition of what "canonical" means for this emitter) are each a correctness surface of their own, bigger and riskier than the two mechanical options above, and remain open. Leaving this issue open, narrowed to just those two.