Bug Report
Description
anthropic-sdk-go v1.38.0 fails to compile when the consuming module's resolved invopop/jsonschema version is v0.14.0 or later.
Error
/home/runner/go/pkg/mod/github.com/anthropics/anthropic-sdk-go@v1.38.0/schemautil.go:99:19:
cannot use orderedmap.New[string, *jsonschema.Schema]()
(value of type *"github.com/wk8/go-ordered-map/v2".OrderedMap[string, *jsonschema.Schema])
as *"github.com/pb33f/ordered-map/v2".OrderedMap[string, *jsonschema.Schema] value in assignment
Root Cause
invopop/jsonschema switched its Properties field type between versions:
| Version |
ordered-map dependency |
| v0.13.0 |
github.com/wk8/go-ordered-map/v2 |
| v0.14.0 |
github.com/pb33f/ordered-map/v2 |
anthropic-sdk-go v1.38.0 declares invopop/jsonschema v0.13.0 in its own go.mod and imports wk8/go-ordered-map in schemautil.go. However, Go's MVS selects the maximum version across all modules in the build graph. Any consuming module that directly or transitively requires invopop/jsonschema v0.14.0 will cause schemautil.go to fail compilation because jsonschema.Schema.Properties is now typed as *pb33f/ordered-map while the SDK still calls orderedmap.New from wk8/go-ordered-map.
Workaround
Pin invopop/jsonschema to v0.13.0 in the consuming module's go.mod:
github.com/invopop/jsonschema v0.13.0 // indirect
Expected Fix
Update schemautil.go (and any other files importing wk8/go-ordered-map) to use pb33f/ordered-map/v2 and bump the invopop/jsonschema requirement to v0.14.0 in the SDK's own go.mod.
Environment
anthropic-sdk-go: v1.38.0
invopop/jsonschema (resolved): v0.14.0
- Go: 1.23+
Bug Report
Description
anthropic-sdk-go v1.38.0fails to compile when the consuming module's resolvedinvopop/jsonschemaversion isv0.14.0or later.Error
Root Cause
invopop/jsonschemaswitched itsPropertiesfield type between versions:github.com/wk8/go-ordered-map/v2github.com/pb33f/ordered-map/v2anthropic-sdk-go v1.38.0declaresinvopop/jsonschema v0.13.0in its owngo.modand importswk8/go-ordered-mapinschemautil.go. However, Go's MVS selects the maximum version across all modules in the build graph. Any consuming module that directly or transitively requiresinvopop/jsonschema v0.14.0will causeschemautil.goto fail compilation becausejsonschema.Schema.Propertiesis now typed as*pb33f/ordered-mapwhile the SDK still callsorderedmap.Newfromwk8/go-ordered-map.Workaround
Pin
invopop/jsonschematov0.13.0in the consuming module'sgo.mod:Expected Fix
Update
schemautil.go(and any other files importingwk8/go-ordered-map) to usepb33f/ordered-map/v2and bump theinvopop/jsonschemarequirement tov0.14.0in the SDK's owngo.mod.Environment
anthropic-sdk-go: v1.38.0invopop/jsonschema(resolved): v0.14.0