Skip to content

Configure the YAML mapper with FlockYamlFactory.builder() - #158

Merged
ctgnz merged 1 commit into
masterfrom
chore/157-use-flock-factory-builder
Oct 1, 2026
Merged

ctgnz merged 1 commit into
masterfrom
chore/157-use-flock-factory-builder

Conversation

@ctgnz

@ctgnz ctgnz commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Fourteen lines of DumperOptions and feature configuration become one:

ObjectMapper mapper = new ObjectMapper(FlockYamlFactory.builder().lineBreak(LineBreak.WIN).build());

The builder carries exactly what this file was assembling by hand — block default flow style, width 480, pretty flow and canonical off, MINIMIZE_QUOTES on, no document start marker, a 16 MiB code point limit — which is unsurprising, since those defaults were measured from this file and hallux's equivalent before being chosen.

The one call left is load-bearing

yaml-flock defaults to LF, deliberately: wanting CRLF is a property of a project whose files are already committed with CRLF rather than a property of YAML, so it is asked for rather than assumed. Without .lineBreak(WIN) every line of all three model.yml files would be rewritten on the first save — the churn the emitter exists to prevent.

Acceptance, unchanged from #155

All three model.yml files round-trip byte-identically through the builder-configured mapper:

IDENTICAL  jmsfx-standard     on disk=451788 written=451788
IDENTICAL  jmsfx-historical   on disk=40018  written=40018
IDENTICAL  jmsfx-battleorder  on disk=1043   written=1043

Checked in memory via writeLibraryModel, so nothing was written into the repo, and their on-disk SHA-256 hashes are unchanged after a full regeneration of all three libraries.

Regeneration still lands on the committed sources. Regenerating left 133 files differing in raw output; one spotless:apply returned every one of them, leaving a clean tree. #127's property holds.

That first result is worth more than it looks — it is yaml-flock#4's acceptance criterion exercised against real production data rather than against the library's own catalogue fixture. The fixture says the builder reproduces a hand-rolled configuration; a 451 KB model file written by the previous code and read back unchanged says it rather more convincingly.

Build

mvn -Pstandard verify and mvn -Phistorical verify both pass, Spotless check included.

Closes #157

🤖 Generated with Claude Code

Fourteen lines of DumperOptions and feature configuration become one. The
builder carries exactly what this file was assembling by hand - block default
flow style, width 480, pretty flow and canonical off, MINIMIZE_QUOTES on, no
document start marker, a 16 MiB code point limit - because those defaults were
measured from this file and hallux's equivalent before being chosen.

The line break is the one thing the library does not assume, and the one call
left. It defaults to LF, on the grounds that wanting CRLF is a property of a
project whose files are already committed with CRLF rather than a property of
YAML. Without .lineBreak(WIN) every line of all three model files would be
rewritten on the first save, which is the churn the emitter exists to prevent.

Both acceptance criteria hold, unchanged from #155:

- the three model.yml files round-trip byte-identically through the
  builder-configured mapper - 451788, 40018 and 1043 bytes - checked in memory
  so nothing was written into the repo, and their on-disk hashes are unchanged
  after a full regeneration
- regenerating all three libraries left 133 files differing in raw output, and
  one spotless:apply returned every one to the committed source

That first result is worth more than it looks: it is yaml-flock#4's acceptance
criterion tested against real production data rather than against the library's
own catalogue fixture.

mvn -Pstandard verify and mvn -Phistorical verify both pass.

Closes #157

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ctgnz
ctgnz merged commit a278803 into master Oct 1, 2026
1 check passed
@ctgnz
ctgnz deleted the chore/157-use-flock-factory-builder branch October 1, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure the YAML mapper with FlockYamlFactory.builder()

1 participant