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

Camel Swagger API response message headers of type string generate an empty enum even when allowableValues are not specified.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.11.1, 3.11.0
    • Fix Version/s: 3.11.2, 3.12.0
    • Component/s: camel-swagger-java
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      Response message headers are configured like so 

      rest().get("/test") 
      .responseMessage().code(200).header("header1").description("test_header")
      .endHeader().endResponseMessage() .to("log:log1?showBody=true");
      
      

       But there is an empty enum in the resulting API doc that generates an error if parsed on swagger's online editor.

      {
        "swagger" : "2.0",
        "info" : {
          "version" : "1.0",
          "title" : "Test API"
        },
        "host" : "localhost:8080",
        "basePath" : "/rest",
        "schemes" : [ "http" ],
        "paths" : {
          "/test" : {
            "get" : {
              "operationId" : "verb1",
              "responses" : {
                "200" : {
                  "description" : "success",
                  "headers" : {
                    "header1" : {
                      "type" : "string",
                      "description" : "test_header",
                      "enum" : [ ]
                    }
                  }
                }
              }
            }
          }
        }
      }
      

      This doesn't happen with other data types.

        Attachments

        1. empty_enum.png
          150 kB
          Avinash Dongre

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                avi5kdonrh Avinash Dongre
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: