Skip to content

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

@denniszag

Description

@denniszag

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+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions