Skip to content

fix: upgrade invopop/jsonschema to v0.14.0 and switch ordered-map to pb33f#326

Open
denniszag wants to merge 1 commit into
anthropics:mainfrom
denniszag:fix/invopop-jsonschema-v014
Open

fix: upgrade invopop/jsonschema to v0.14.0 and switch ordered-map to pb33f#326
denniszag wants to merge 1 commit into
anthropics:mainfrom
denniszag:fix/invopop-jsonschema-v014

Conversation

@denniszag
Copy link
Copy Markdown

Summary

Fixes #325.

invopop/jsonschema v0.14.0 changed the type of Schema.Properties from *wk8/go-ordered-map/v2 to *pb33f/ordered-map/v2. Because Go MVS selects the maximum version across the entire build graph, any consuming module that directly or transitively depends on invopop/jsonschema v0.14.0 causes schemautil.go to fail compilation:

schemautil.go:99:19: cannot use orderedmap.New[string, *jsonschema.Schema]()
  (value of type *"github.com/wk8/go-ordered-map/v2".OrderedMap[...])
  as *"github.com/pb33f/ordered-map/v2".OrderedMap[...] value in assignment

Changes

  • go.mod: bump invopop/jsonschema v0.13.0 → v0.14.0, replace wk8/go-ordered-map/v2 with pb33f/ordered-map/v2 v2.3.1
  • schemautil.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/v2 is 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 ./... passes
  • go test -run "TestTransformSchema |TestTransformSchemaMap|TestStructuredSchema" ./... — all 39 schema tests pass

…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
Copilot AI review requested due to automatic review settings April 24, 2026 16:34
@denniszag denniszag requested a review from a team as a code owner April 24, 2026 16:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/jsonschema to v0.14.0 and switch ordered-map dependency to github.com/pb33f/ordered-map/v2.
  • Update schemautil.go and schemautil_test.go to import pb33f/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.

Comment thread go.mod
module github.com/anthropics/anthropic-sdk-go

go 1.23.0
go 1.24
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
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.

Build failure: invopop/jsonschema v0.14.0 incompatibility (pb33f vs wk8 ordered-map type mismatch in schemautil.go)

2 participants