Skip to content

chore: use github.com/pb33f/go-yaml for YAML support - #8

Open
daveshanley wants to merge 1 commit into
mainfrom
go-yaml-fork
Open

daveshanley wants to merge 1 commit into
mainfrom
go-yaml-fork

Conversation

@daveshanley

Copy link
Copy Markdown
Member

Moves YAML support from go.yaml.in/yaml/v4 (rc.4) to github.com/pb33f/go-yaml v0.1.0, pb33f's maintained fork of the YAML library. libopenapi, ordered-map and testify are moving to the same module. Queries and overlays take and return *yaml.Node, so everything has to share one yaml package.

Changes

  • Import paths in 29 Go files and the two README examples, plus go.mod/go.sum.
  • Overlay output is pinned. The fork includes upstream's rc.5+ encoder defaults, which wrap long lines at 80 columns. Before this change, Overlay.Format and ToString used NewEncoder + SetIndent(2). They now write through a Dumper with WithV3Defaults(), WithIndent(2) and WithLineWidth(-1), so overlays render exactly as before. ToString now calls Format instead of building its own encoder.
  • The NodeMatchesFile test helper uses the same settings. Without them, TestParse rewrote testdata/overlay.yaml with wrapped lines. The fixture is unchanged in this PR.
  • The other NewEncoder uses (yamlEquals in compare.go and a test helper) only compare encoder output with itself, so layout doesn't affect them.

Tests

go build ./... and go test ./... pass. The Spectral compliance test needs the git submodule, which CI already checks out (submodules: true).

🤖 Generated with Claude Code

Replace go.yaml.in/yaml/v4 (rc.4) with github.com/pb33f/go-yaml v0.1.0,
pb33f's maintained fork of the YAML library, so jsonpath queries and
overlays work on the same yaml.Node type as libopenapi and the other pb33f
modules.

The fork carries upstream's later encoder defaults, which wrap long lines
at 80 columns. Overlay.Format and ToString now write with a Dumper pinned
to the layout overlays have always had (V3 defaults, two space indent, no
wrapping), so their output is unchanged. The overlay test helper uses the
same settings.

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