Skip to content

[BUG] VPS_getFirewallListV1 — 200 response schema declares a {data,meta} envelope, but the API returns a bare array #46

@rogermaiocchi

Description

@rogermaiocchi

Summary

The OpenAPI schema for GET /api/vps/v1/firewall (operationId: VPS_getFirewallListV1) declares its 200 response as an object envelope { data, meta }. However, the live API returns a bare JSON array of firewall resources — i.e. the VPS.V1.Firewall.FirewallCollection directly, with no wrapper object.

Evidence

Every other list endpoint in openapi.json references its *Collection schema directly. VPS_getFirewallListV1 is the only outlier:

operationId 200 response schema
billing_getCatalogItemListV1 Billing.V1.Catalog.CatalogItemCollection
billing_getPaymentMethodListV1 Billing.V1.PaymentMethod.PaymentMethodCollection
billing_getSubscriptionListV1 Billing.V1.Subscription.SubscriptionCollection
DNS_getDNSSnapshotListV1 DNS.V1.Snapshot.SnapshotCollection
domains_getDomainListV1 Domains.V1.Domain.DomainCollection
domains_getWHOISProfileListV1 Domains.V1.WHOIS.ProfileCollection
VPS_getDataCenterListV1 VPS.V1.DataCenter.DataCenterCollection
VPS_getProjectListV1 VPS.V1.DockerManager.ProjectCollection
VPS_getFirewallListV1 { "type": "object", "properties": { "data", "meta" } } ← outlier

Actual response body from GET /api/vps/v1/firewall (bare array, no envelope):

[
  {
    "id": 255211,
    "name": "...",
    "is_synced": true,
    "rules": [ { "id": 880659, "action": "accept", "protocol": "SSH", "port": "22", "source": "any", "source_detail": "any" } ],
    "created_at": "2026-03-31T20:35:32Z",
    "updated_at": "2026-04-05T23:48:01Z"
  }
]

Impact

This breaks the official CLI hostinger/api-cli. oapi-codegen generates ParseVPSGetFirewallListV1Response to unmarshal the 200 body into a struct { Data *...; Meta * }, which fails against the array:

json: cannot unmarshal array into Go value of type struct { Data *client.VPSV1FirewallFirewallCollection `json:"data,omitempty"`; Meta *client.CommonSchemaPaginationMetaSchema `json:"meta,omitempty"` }

As a result, hapi vps firewall list aborts (log.Fatal). All other list subcommands work because their schemas reference the collection directly.

Proposed fix

In openapi.json, change the 200 response schema of VPS_getFirewallListV1 to reference the collection directly, consistent with every other list endpoint:

"schema": {
    "$ref": "#/components/schemas/VPS.V1.Firewall.FirewallCollection"
}

(replacing the current { "type": "object", "properties": { "data": {...}, "meta": {...} } }).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions