Skip to content

chore: move to github.com/pb33f/go-yaml - #642

Open
daveshanley wants to merge 1 commit into
claude/lipopen-performance-optimization-9ad48ffrom
claude/go-yaml-fork-migration
Open

daveshanley wants to merge 1 commit into
claude/lipopen-performance-optimization-9ad48ffrom
claude/go-yaml-fork-migration

Conversation

@daveshanley

Copy link
Copy Markdown
Member

Stacked on #641. Review and merge that PR first. This diff shows only the migration.

libopenapi moves from go.yaml.in/yaml/v4 v4.0.0-rc.6 to github.com/pb33f/go-yaml v0.1.0, pb33f's maintained fork. The fork is upstream's main plus the emitter event-queue fix (pb33f/go-yaml#1), under a new module path (pb33f/go-yaml#2).

jsonpath, ordered-map and testify pass yaml.Node values across their APIs, so they are moving to the same module:

module PR required here
github.com/pb33f/testify pb33f/testify#4 (merged) pseudo-version of master 5ea68ea
github.com/pb33f/ordered-map/v2 pb33f/ordered-map#4 (merged) pseudo-version of master 68eb83f
github.com/pb33f/jsonpath pb33f/jsonpath#8 (open) pseudo-version of its PR branch, 26d48cf

Before merging: merge jsonpath#8, tag all three, then replace the pseudo-versions in go.mod with the tags. go mod graph no longer contains go.yaml.in/yaml/v4 at all.

Changes

  • Import paths. go.yaml.in/yaml/v4 becomes github.com/pb33f/go-yaml in 455 files. The package name is still yaml, so no code referencing it changes.
    • Imports were re-sorted with gofmt. Three files that weren't gofmt-clean on main were left unformatted; two of them had their import line moved by hand.
  • RenderWithIndention. The fork removed Dumper.SetIndent. Its replacement, WithIndent, rejects indents outside 2 to 9.
    • rc.6 accepted any indent and the emitter quietly used 2 instead. OriginalIndentation can be 0, e.g. for minified JSON.
    • RenderWithIndention now clamps those values to 2 itself, so output is unchanged.
    • A negative indent used to panic in SetIndent. It now renders with 2 as well.
    • New test: TestDocument_RenderWithIndention_OutOfRange.
  • TestDocument_RenderAndReload_ChangeCheck_Stripe now expects 0 changes instead of 9.
    • rc.6 re-emitted some folded (>) block scalars with a spurious trailing blank line. The reloaded Stripe spec therefore showed 9 description changes against the original.
    • Upstream fixed this after rc.6, so Stripe now round-trips with no changes.
  • Comments and AGENTS.md no longer name yaml v4.

Output changes

A golden harness hashes every public output for all 72 spec fixtures. It covers:

  • Render, RenderInline and RenderJSON
  • Per-schema inline renders
  • Bundles and composed bundles
  • what-changed reports

Compared with #641, 69 fixtures are byte-identical. The other three change for the same reason, the folded-scalar fix described above: rc.6 added a blank line after some folded block scalars, and the new output drops it, which now matches the source files. The three are:

  • test_specs/minimal_remote_refs/openapi.yaml
  • test_specs/minimal_remote_refs/schemas/components.openapi.yaml
  • test_specs/redocly-starter.yaml

Tests

  • go build ./..., go vet ./... and go test ./... pass.
  • The generator round-trip tests pass against the real module versions.

🤖 Generated with Claude Code

Replace go.yaml.in/yaml/v4 v4.0.0-rc.6 with github.com/pb33f/go-yaml
v0.1.0, pb33f's maintained fork: upstream main plus the emitter event
queue fix, under a module path we control. jsonpath, ordered-map and
testify move to the same module; they are required at pseudo-versions
until they are tagged.

The fork drops Dumper.SetIndent. WithIndent rejects indents outside 2-9,
which rc.6 accepted and emitted with 2, so RenderWithIndention clamps
them to 2 itself (OriginalIndentation is 0 for minified JSON).

Upstream no longer adds a blank line after folded block scalars, so the
Stripe render/reload check drops from 9 description changes to 0, and 3
of the 72 golden fixtures now render as their sources do. Every other
output is byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant