PureYAML/docs/releases/pureyaml-0-4-0.md
Mihaela Mihaljevic d5b8da8d8b
Some checks failed
rules-freshness / rules (push) Failing after 3s
chore(release): stamp 0.4.0
Section the changelog, add the release notes with the WASM and Windows disclosures, update the current-release stamps. The changelog entry of the string fixes had raw characters where it names escapes; they are written as text.
2026-11-15 13:04:51 +01:00

3.1 KiB

PureYAML 0.4.0

A release of the string fixes: a string no longer changes on the way through YAML or JSON. It adds three names to the public API and changes what dump and the JSON writer write for a few characters, so read the first section before updating.

Changed (behavior callers can meet)

  • PureYAML.dump writes a string that holds a control character, DEL, a C1 control, U+2028, U+2029, U+FEFF, U+FFFE or U+FFFF as a double-quoted string with the escape that stands for each (\x01, \N, \L, \P, \uFEFF). It wrote them as they are before, and a reader refused them, folded U+0085, U+2028 and U+2029 to a space without a word, or dropped a leading U+FEFF as a byte order mark. Such a string is never written plain or in a literal block now. Strings without those characters are written as before.
  • PureYAML.JSON.Writer escapes the same characters (\u007f, \u2028, and so on), which RFC 8259 allows and a YAML reader needs. The text it writes means the same value; its bytes differ for a string that holds one of them.

Added

  • PureYAML.JSON.parse(_:) and PureYAML.JSON.parseLocated(_:) read JSON and keep every character of its strings, including those RFC 8259 lets a string hold as they are and the YAML reader folds or refuses (U+0085, U+2028, U+2029, U+007F to U+009F, U+FFFE, U+FFFF). Each such character inside a string is held back from the reader as one scalar for one scalar and given back in the value, so every span of parseLocated is where the text has it.
  • PureYAML.JSON.Convert.convert(_:from:to:pretty:) takes the format of the source. With from: .json the source is read with PureYAML.JSON.parse; without it (the default) the source is read as YAML, as before.

Fixed

  • The three faults above, found by an oracle that does not use the reader: a string is held to the value written down for it, because the converter's own check (its reading of the source against its reading of the output) cannot see a fault of the reader that is the same on both sides.

Verification

  • macOS: scripts/check-all.sh (style, namespacing, forbidden patterns, changelog, swiftformat, swiftlint strict, build and test): 692 tests in 152 suites.
  • Linux: build and test through the Linux relay: 692 tests in 152 suites.
  • A consumer, PureTree, passes its own suite against this tree: a law that JSON converts to YAML and back with every string kept (300 generated documents, 104 strings and as many keys, 25 numbers, the shapes), and an editor outline of a JSON document that holds those characters.

Known deferred issues

  • WASM was NOT built for this release: the swift-6.3.2-RELEASE_wasm SDK is not installed on the machine the gate ran on.
  • Windows build and test were NOT run: there is no runner for it yet. The tree is pure Swift.
  • The reader is still the libyaml port and folds U+0085, U+2028 and U+2029 as line breaks in YAML text, which YAML 1.2 does not. It is unchanged; the fix is in what is written (dump) and in reading JSON (JSON.parse).
  • The hosted CI run of this commit was not watched: this server's API does not list runs, so the authoritative platform gates are the local ones above.