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

[bug : requestIPReservation] Response structure matches multiple oneOf schemas #30

@VamshikShetty

Description

@VamshikShetty

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"
       },

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