In case API : POST /projects/{id}/ips i.e. requestIPReservation function response structure is oneOf response between IPReservation and VrfIpReservation. Response provided by server when we try to reserve public IPv4 throws following error :
Caused by: java.io.IOException: Failed deserialization for RequestIPReservation201Response: 2 classes match result, expected 1. Detailed failure message for oneOf schemas: []. JSON: {"id":"9abf77b3-705f-4d49-84fd-f8f638ec7eb0","address_family":4,"netmask":"255.255.255.252","created_at":"2022-08-02T15:51:54Z","details":null,"tags":[],"public":true,"cidr":30,"management":false,"manageable":true,"enabled":true,"global_ip":false,"customdata":{},"addon":true,"bill":true,"state":"created","project":{"href":"/metal/v1/projects/d52cf346-cd0e-4d4f-828a-29e4c5e60f72"},"project_lite":{"href":"/metal/v1/projects/d52cf346-cd0e-4d4f-828a-29e4c5e60f72"},"assignments":[],"metal_gateway":null,"requested_by":{"href":"/metal/v1/users/d5c43ee4-676d-4098-b769-23c03626f59d"},"network":"147.28.154.156","address":"147.28.154.158","gateway":"147.28.154.157","available":"/metal/v1/ips/9abf77b3-705f-4d49-84fd-f8f638ec7eb0/available","href":"/metal/v1/ips/9abf77b3-705f-4d49-84fd-f8f638ec7eb0","facility":null,"metro":{"id":"d3d6b29f-042d-43b7-b3ce-0bf53d5754ca","name":"Dallas","code":"da","country":"US"},"type":"public_ipv4"}
at com.equinix.openapi.metal.v1.model.RequestIPReservation201Response$CustomTypeAdapterFactory$1.read(RequestIPReservation201Response.java:154)
at com.equinix.openapi.metal.v1.model.RequestIPReservation201Response$CustomTypeAdapterFactory$1.read(RequestIPReservation201Response.java:88)
at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
JSON response is valid against both schema i.e.IPReservation and VrfIpReservation. In case of VrfIpReservation response structure contains "vrf" param which is not marked required hence above mentioned exception occurs.
Possible fix, VrfIpReservation should be update to have required param :
"VrfIpReservation": {
"properties": {
"address_family": {
"type": "integer"
},
"cidr": {
"type": "integer"
},
"created_at": {
"format": "date-time",
"type": "string"
},
"created_by": {
"$ref": "#/components/schemas/Href"
},
"details": {
"type": "string"
},
"href": {
"type": "string"
},
"id": {
"format": "uuid",
"type": "string"
},
"metal_gateway": {
"$ref": "#/components/schemas/MetalGatewayLite"
},
"netmask": {
"type": "string"
},
"network": {
"type": "string"
},
"project": {
"$ref": "#/components/schemas/Project"
},
"state": {
"type": "string"
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
},
"type": {
"type": "string",
"example": "vrf"
},
"vrf": {
"$ref": "#/components/schemas/Vrf"
}
},
"required": [
"vrf"
],
"type": "object"
},
In case API :
POST /projects/{id}/ipsi.e. requestIPReservation function response structure is oneOf response between IPReservation and VrfIpReservation. Response provided by server when we try to reserve public IPv4 throws following error :JSON response is valid against both schema i.e.IPReservation and VrfIpReservation. In case of VrfIpReservation response structure contains "vrf" param which is not marked required hence above mentioned exception occurs.
Possible fix, VrfIpReservation should be update to have required param :