Replace the in-tree YAML emitter with the yaml-flock dependency - #156
Merged
Merged
Conversation
jmsfx-generator carried its own mixed flow/block YAML emitter, duplicated in another ctgnz project. It now depends on io.github.ctgnz:yaml-flock, which is that code extracted and specified in its own right. Five files go: JmsfxYamlFactory, JmsfxYamlGenerator, JmsfxPrettyPrinter and the two annotations. JmsfxParser stays and is rebuilt on FlockYamlFactory, since it configures a mapper for jmsfx's own model, which is not shared and should not be. The swap is mechanical because the library's API is compatible by construction: YamlForceQuote is identical, YamlFlowStyle widens @target from TYPE to {TYPE, FIELD, METHOD} so every existing use still compiles, and the factory's constructor signature matches. So this is an import swap plus one class name. Corrects a premise in the issue. #155 anticipated replacing JmsfxPrettyPrinter's two hardcoded field lists with a @YamlBlockStyle annotation, and called `country` a latent trap that removing one @YamlFlowStyle would spring. Neither holds: JmsfxPrettyPrinter has zero references anywhere in the project - never instantiated, never installed on a mapper - so both lists were unreachable rather than merely inert. Jackson consults a DefaultPrettyPrinter for JSON output only, and YAMLGenerator emits through SnakeYAML without ever asking it. The faithful migration therefore adds no annotation at all, since adding one would introduce behaviour that never existed. Verified against both of the issue's acceptance criteria: - all three model.yml files round-trip byte-identically through the swapped emitter - 451788, 40018 and 1043 bytes - checked in memory so that 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 of them to the committed source, which is the property #127 established Both library profiles build: mvn -Pstandard verify and mvn -Phistorical verify, Spotless check included. The dependency is 1.0.0-SNAPSHOT behind a yaml.flock.version property, and moves to 1.0.0 from Central once that is published. Addresses #155 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
io.github.ctgnz:yaml-flock:1.0.0 is published, so the dependency moves off the locally installed snapshot and the comment stops describing a future that has happened. This is what CI was waiting for: the build here failed only because a GitHub runner had no way to resolve a snapshot that existed in one local repository, which was expected and deliberate rather than a problem to fix. Addresses #155 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces
jmsfx-generator's in-tree YAML emitter with a dependency on yaml-flock.Five files go —
JmsfxYamlFactory,JmsfxYamlGenerator,JmsfxPrettyPrinter,YamlFlowStyle,YamlForceQuote.JmsfxParserstays, rebuilt onFlockYamlFactory, since it configures a mapper for jmsfx's own model.The swap is mechanical because the library's API is compatible by construction:
YamlForceQuoteis identical,YamlFlowStylewidens@TargetfromTYPEto{TYPE, FIELD, METHOD}so every existing use still compiles, and the factory constructor signature matches. Import swap plus one class name, across 19 files.yaml-flockis still1.0.0-SNAPSHOTand exists only in a local.m2. A GitHub runner has no way to resolve it, so the build here will fail on dependency resolution until one of:yaml.flock.versionto1.0.0— this is what Replace the in-tree YAML emitter with the yaml-flock dependency #155 always planned, and the simplest path. The PR waits.<repository>— more moving parts, and it makes jmsfx's build depend on a snapshot, which is not something to carry long-term.Option 1 unless there's a reason to prefer otherwise. The version sits behind a
yaml.flock.versionproperty so that switch is one line.Correcting a premise in #155
The issue anticipated replacing
JmsfxPrettyPrinter's two hardcoded field lists with a@YamlBlockStyleannotation, and describedcountryas a latent trap that removing one@YamlFlowStylewould spring.Neither holds.
JmsfxPrettyPrinterhas zero references anywhere in the project — never instantiated, never installed on a mapper. Jackson consults aDefaultPrettyPrinterfor JSON output only, andYAMLGeneratoremits through SnakeYAML without ever asking it. So both field lists were unreachable, not merely inert, andcountrywas never going to spring: removing that@YamlFlowStylewould change nothing.So this adds no annotation at all. Adding one would introduce behaviour that never existed. (This is the same discovery that killed the equivalent class in yaml-flock itself, where a probe showed identical output for every shape with the printer installed and removed.)
Acceptance criteria, both verified
All three
model.ymlfiles round-trip byte-identically through the swapped emitter:Checked by reading each real file and calling
writeLibraryModelin memory, comparing bytes — deliberately nothing written into the repo. Their on-disk SHA-256 hashes are also unchanged after a full regeneration of all three libraries.Regeneration plus one
spotless:applylands on the committed sources. Regenerating left 133 files differing in raw output; onespotless:applyreturned every one to the committed source, leaving a clean tree. That is the property #127 established, still holding.Build
mvn -Pstandard verify— BUILD SUCCESSmvn -Phistorical verify— BUILD SUCCESSSpotless
checkincluded in both, so the re-sorted imports are compliant (io.github.ctgnz.jmsfx.*sorts beforeio.github.ctgnz.yamlflock.*in the trailing group).Addresses #155 — not closing it, since the switch to
1.0.0from Central is part of the same issue.🤖 Generated with Claude Code