Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

[bug: API] Metal Gateway associated with a Vlan does not show up when fetching VirtualNetwork by ID #32

Open
rinzler-17 opened this issue Aug 5, 2022 · 5 comments

Comments

@rinzler-17
Copy link
Contributor

Sample instance returned by VlansApi.getVirtualNetwork(vlanId)

VirtualNetwork {
    assignedTo: class Href {
        href: /metal/v1/projects/{projectId}
        additionalProperties: null
    }
    assignedToVirtualCircuit: false
    description: null
    facility: null
    href: /metal/v1/virtual-networks/{vlanId}
    id: {vlanId}
    instances: []
    metalGateway: null
    metro: class Href {
        href: /metal/v1/locations/metros/{metroId}
        additionalProperties: null
    }
    metroCode: da
    vxlan: 200
    additionalProperties: {metal_gateways={}, created_at={timestamp}, facility_code=null}
}

metalGateway is null and metal_gateways under additionalProperties is empty. Also, what is the spec of value keyed by metal_gateways inside additionalProperties?

@rinzler-17
Copy link
Contributor Author

@displague @VamshikShetty

@displague
Copy link
Member

displague commented Aug 9, 2022

metalGateway is null and metal_gateways under additionalProperties is empty
what is the spec of value keyed by metal_gateways inside additionalProperties

The spec field metal_gateway should be metal_gateways and should be an array of Metal Gateway objects.

Using the include=metal_gateways parameter will expand the metal gateways from an href to the full object.

{...
"metal_gateways": [
  {
    "created_at": "2022-02-02T02:02:02Z"
    "gateway_address": "192.0.2.1/29"
    "href": "/metal-gateways/uuid-uuid-4b98-uuid-uuid"
    "id": "uuid-uuid-4b98-uuid-uuid"
    "state": "active"
    "updated_at": "2022-02-02T02:02:02Z"
    "vlan": 123
  }
]
}

@displague
Copy link
Member

#35 has been merged but I'd like to keep this open issue until we discuss:

@rinzler-17
Copy link
Contributor Author

In response to :

@displague
Copy link
Member

why is there a MetalGatewayLite when there’s already a MetalGateway in the spec? how are they being used?

The API Spec (and the actual API response) offer a different view of some objects based on the context.

A “Lite” response (typically those offered as a shallow value with an href property, expanded through ?include=foo) may contain fewer fields than the response at GET /foo (we'll call this Foo vs FooLite`).

I would like to say that FooLite is always a subset of Foo, but that is not the case. In some situations, FooLite contains fields that are not present in Foo. I believe there are some examples of Foo and FooLite sharing a common field name with different response formats or values.

In short, they should be treated as related, but not necessarily the same nor extending.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants