Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21076

camel-openapi-java: Incorrect schema is generated for array type request

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.x, 4.x
    • 4.8.0
    • camel-openapi-java
    • None
    • Unknown

    Description

      When specifying an array of objects as a request type (in PUT/POST methods), the generated OpenAPI schema does not match the expected result.

      For example:

      .post()
        .type(User[].class)
        .to("bean:....")

      Will generate:

      "requestBody" : {
        "description" : "",
        "content" : {
          "application/json" : {
            "schema" : {
              "type" : "string"
            }
          }
        },
        "required" : true
      }, 

      While expected schema should be:

      "requestBody" : {
        "description" : "",
        "content" : {
          "application/json" : {
            "schema" : {
              "type" : "array",
              "items" : {
                "$ref" : "#/components/schemas/User"
              }
            }
          }
        },
        "required" : true
      } 

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            iliya.gr Iliya Grushevskiy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: