Skip to content

CLI gateway list-routes fails with JSON parsing error - API returns object, SDK expects array #462

@poyrazK

Description

@poyrazK

Why is this an issue?

Running cloud gateway list-routes produces an error instead of listing routes. This is the same pattern as container list, snapshot list, and cron list — API returns object, SDK expects array.

What is causing it?

The API endpoint returns a JSON object, but the SDK expects an array type []sdk.GatewayRoute. The Go json decoder fails with: json: cannot unmarshal object into Go value of type []sdk.GatewayRoute

How can it be solved?

Fix the API to return an array or update the SDK response type to match.

Category

  • Small
  • Medium
  • Large

Severity

  • Low
  • Medium
  • High
  • Critical

Steps to reproduce

cloud gateway list-routes
# Output: Error: request failed: json: cannot unmarshal object into Go value of type []sdk.GatewayRoute

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions