fix: upgrade invopop/jsonschema to v0.14.0 and switch ordered-map to pb33f#326
fix: upgrade invopop/jsonschema to v0.14.0 and switch ordered-map to pb33f#326denniszag wants to merge 1 commit into
Conversation
…pb33f invopop/jsonschema v0.14.0 switched its Properties field type from wk8/go-ordered-map to pb33f/ordered-map. Go MVS selects the max version across the build graph, so consuming modules that pull in v0.14.0 fail to compile. Swap the import and dependency to stay aligned with the upstream library. Fixes anthropics#325
There was a problem hiding this comment.
Pull request overview
This PR resolves a build incompatibility caused by github.com/invopop/jsonschema v0.14.0 changing Schema.Properties to use github.com/pb33f/ordered-map/v2, by upgrading the dependency and switching this repo’s ordered-map imports accordingly.
Changes:
- Upgrade
github.com/invopop/jsonschemato v0.14.0 and switch ordered-map dependency togithub.com/pb33f/ordered-map/v2. - Update
schemautil.goandschemautil_test.goto importpb33f/ordered-map/v2. - Update module metadata (
go.mod/go.sum) to reflect dependency (and Go version) changes.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
schemautil.go |
Switch ordered-map import to pb33f/ordered-map/v2 to match jsonschema v0.14.0 types. |
schemautil_test.go |
Switch ordered-map import to pb33f/ordered-map/v2 for test helpers/fixtures. |
go.mod |
Bump jsonschema, add pb33f/ordered-map/v2, update other requirements, and bump the go directive. |
go.sum |
Refresh dependency checksums for the upgraded requirements. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| module github.com/anthropics/anthropic-sdk-go | ||
|
|
||
| go 1.23.0 | ||
| go 1.24 |
There was a problem hiding this comment.
The go directive was bumped to 1.24, but the PR description doesn’t mention a Go version requirement change. This also makes the README’s stated requirement (Go 1.22+) inaccurate. If a Go version bump isn’t intended, keep the go directive at the previous value; otherwise, please update the README (and consider calling out the compatibility change in the PR/release notes).
Summary
Fixes #325.
invopop/jsonschemav0.14.0 changed the type ofSchema.Propertiesfrom*wk8/go-ordered-map/v2to*pb33f/ordered-map/v2. Because Go MVS selects the maximum version across the entire build graph, any consuming module that directly or transitively depends oninvopop/jsonschema v0.14.0causesschemautil.goto fail compilation:Changes
go.mod: bumpinvopop/jsonschemav0.13.0 → v0.14.0, replacewk8/go-ordered-map/v2withpb33f/ordered-map/v2 v2.3.1schemautil.go: swap import alias (import path only, no logic changes)schemautil_test.go: swap import alias (import path only, no logic changes)pb33f/ordered-map/v2is a drop-in replacement for the subset used here (New,Oldest(),pair.Next(),pair.Key,pair.Value) — no call-site changes were needed.Test plan
go build ./...passesgo test -run "TestTransformSchema |TestTransformSchemaMap|TestStructuredSchema" ./...— all 39 schema tests pass