equinix / equinix-sdk-go

Golang client for Equinix APIs
https://deploy.equinix.com/labs/equinix-sdk-go
MIT License
2 stars 6 forks source link

[Metal] Interconnections retrieve fails with schema error #16

Closed aayushrangwala closed 6 months ago

aayushrangwala commented 8 months ago

What problem are you facing?

While retrieving connections for a project, using endpoint https://api.equinix.com/metal/v1/projects/{project_id}/connections and below sdk, getting json unmarshalling error for speed parameter for the connection

apiClient.InterconnectionsApi.
    ProjectListInterconnections(context.Background(), project.GetId()).
    Execute()

Note: Any available value of the speed (ex: 5000000 etc) is provided, the error remains the same

Error:

json: cannot unmarshal number 10000000000 into Go struct field _InterconnectionList.interconnections of type int32

How could the Equinix Metal Go SDK help solve this problem?

There seems to be a mismatch in the schema validation on the server and published api doc. Need to fix the marshalling of speed parameter from the server

ctreatma commented 8 months ago

Copying these lines from https://github.com/equinix/equinix-sdk-go/pull/22#issuecomment-1900912753 for broader visibility:

It's worth noting that the VlanVirtualCircuitUpdateInput and VrfVirtualCircuitUpdateInput schemas specify that speed is a string, which makes sense for the inputs since we document those fields as accepting, e.g., 10Gbps, which is not an integer.

ctreatma commented 6 months ago

This was resolved in #34, which was included in the v0.34.0 release.