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

Can't create a VRF Metal Gateway #128

Closed
ctreatma opened this issue Aug 14, 2023 · 4 comments
Closed

Can't create a VRF Metal Gateway #128

ctreatma opened this issue Aug 14, 2023 · 4 comments

Comments

@ctreatma
Copy link
Contributor

When I use this SDK to create a VRF Metal Gateway, the gateway is created but I get an error that the response is not valid:

Error when calling `MetalGatewaysApi.CreateMetalGateway`: data matches more than one schema in oneOf(FindMetalGatewayById200Response)

This is happening because a VRF Metal Gateway matches both the MetalGateway.yaml schema and the VrfMetalGateway.yaml schema. In order to avoid this error, either the VrfMetalGateway and MetalGateway schemas need to be collapsed into a single schema that represents both types, or the MetalGateway schema has to be updated so that a VRF Metal Gateway is not a valid example of that schema.

@ctreatma
Copy link
Contributor Author

In metal-java, this was done by setting additionalProperties: false on the MetalGateway schema, but this means that if non-VRF Metal Gateways ever gain a new property, existing SDKs will fail to validate new API responses. One alternative would be to add an invalid property specification to MetalGateway (for example, declaring vrf as an integer) so that a valid VRF gateway will not match that schema.

@ctreatma
Copy link
Contributor Author

Note: the model name FindMetalGatewayById200Response is also a problem; the oneOf construct for Metal Gateways is duplicated inline in a few places in the spec, and should be extracted to a named component to simplify the generated code.

@ctreatma
Copy link
Contributor Author

This can be worked around by adding include=ip_reservation on all requests for Metal Gateways. The IP reservation schemas have clear, reliable type differentiation, and we can leverage that to distinguish Metal Gateway types, at least until the API includes an attribute or attributes to Metal Gateways that can be used to more directly determine types.

@ctreatma
Copy link
Contributor Author

This repo is deprecated. A corresponding issue has been created on the equinix-sdk-go repo, which replaces this one: equinix/equinix-sdk-go#64

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

1 participant