fix: replace gopkg.in/yaml.v3 with go.yaml.in/yaml/v3#207
Conversation
gopkg.in/yaml.v3 is unmaintained and flagged by security scanners (kubernetes-sigs/yaml#117). go.yaml.in/yaml/v3 is the canonical successor maintained by the same authors with ongoing support. Replace all import paths across .go source files and update go.mod to reference go.yaml.in/yaml/v3 v3.0.4. Closes speakeasy-api#201
There was a problem hiding this comment.
Pull request overview
Replaces the unmaintained gopkg.in/yaml.v3 import path with the canonical successor go.yaml.in/yaml/v3 (v3.0.4) throughout the repository, closing #201. The change is mechanical — only import paths and the root go.mod requirement are touched; no functional logic changes.
Changes:
- Updated
import "gopkg.in/yaml.v3"toimport "go.yaml.in/yaml/v3"in ~110 Go source/test files across packages (arazzo, openapi, swagger, overlay, marshaller, jsonschema, linter, etc.). - Bumped the root
go.moddirect dependency fromgopkg.in/yaml.v3 v3.0.1togo.yaml.in/yaml/v3 v3.0.4. - Sibling sub-modules'
go.mod/go.sumfiles (e.g.cmd/openapi,openapi/linter/customrules,jsonschema/oas3/tests,openapi/linter/converter/tests) and the rootgo.sumwere not updated in this PR.
Reviewed changes
Copilot reviewed 162 out of 162 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| go.mod | Swap root direct dependency to go.yaml.in/yaml/v3 v3.0.4 |
| ~110 *.go files across arazzo/, openapi/, overlay/, swagger/, marshaller/, jsonschema/, linter/, sequencedmap/, values/, validation/, references/, jsonpointer/, json/, yml/, hashing/, extensions/, expression/, internal/, oq/, cmd/openapi/ | Mechanical import path rewrite from gopkg.in/yaml.v3 to go.yaml.in/yaml/v3 |
| cmd/openapi/commands/{overlay/apply.go, overlay/compare.go, openapi/bootstrap.go} | Import swap, but the cmd/openapi submodule's own go.mod still pins the old package |
| openapi/linter/customrules/runtime.go | Import swap, but the customrules submodule's own go.mod still pins the old package |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "github.com/dop251/goja" | ||
| "github.com/speakeasy-api/openapi/validation" | ||
| "gopkg.in/yaml.v3" | ||
| "go.yaml.in/yaml/v3" |
There was a problem hiding this comment.
Addressed in a985f2b. openapi/linter/customrules/go.mod now requires go.yaml.in/yaml/v3 v3.0.4, the module was tidied, and go.sum includes the new module hashes. Note: gopkg.in/yaml.v3 can still appear indirectly because current transitive dependencies still require it; see the PR tracking comment for follow-up.
| "github.com/speakeasy-api/openapi/overlay/loader" | ||
| "github.com/spf13/cobra" | ||
| "gopkg.in/yaml.v3" | ||
| "go.yaml.in/yaml/v3" |
There was a problem hiding this comment.
Addressed in a985f2b. cmd/openapi/go.mod now requires go.yaml.in/yaml/v3 v3.0.4, the module was tidied, and go.sum includes the new module hashes. Note: gopkg.in/yaml.v3 can still appear indirectly because current transitive dependencies still require it; see the PR tracking comment for follow-up.
| golang.org/x/sync v0.20.0 | ||
| golang.org/x/text v0.35.0 | ||
| gopkg.in/yaml.v3 v3.0.1 | ||
| go.yaml.in/yaml/v3 v3.0.4 |
There was a problem hiding this comment.
Addressed in a985f2b. Root and sibling module metadata were tidied: root go.sum now has go.yaml.in/yaml/v3 hashes, cmd/openapi and openapi/linter/customrules direct deps were moved to go.yaml.in/yaml/v3 v3.0.4, and the test modules now include the new module in their tidied graphs. I also updated the stale overlay/README.md reference and ran formatting. Remaining old yaml entries are transitive, not direct; see the PR tracking comment for dependency follow-up.
|
Dependency migration follow-up discovered while addressing review feedback:
Remaining blockers to track before this migration can fully pass builds/tests:
Validation notes:
|
Problem
gopkg.in/yaml.v3is unmaintained and flagged by security scanners (kubernetes-sigs/yaml#117). It is no longer receiving updates.Fix
Replace all usages across the codebase with
go.yaml.in/yaml/v3, the canonical successor package maintained by the same upstream authors.go.modupdated togo.yaml.in/yaml/v3 v3.0.4The API is identical — no code logic changes, import path only.
Closes #201