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

camel-openapi-java - Empty server url due to X-Forward-Headers

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.5.0
    • camel-rest-openapi
    • None
    • Unknown

    Description

      This looks a bit mysterious as restConfiguration has `useXForwardHeaders=true` as default which causes the url to be empty or just the base path (but you can have / as base-path)

      {
        "openapi" : "3.0.0",
        "info" : { },
        "servers" : [ {
          "url" : ""
        } ],
        "paths" : {
          "/account" : {
            "get" : {
              "operationId" : "get-c5d3",
              "responses" : {
                "200" : {
                  "description" : "Output type",
                  "content" : {
                    "application/json" : {
                      "schema" : {
                        "$ref" : "#/components/schemas/Account"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "components" : {
          "schemas" : {
            "Account" : {
              "type" : "object",
              "properties" : {
                "accountNumber" : {
                  "type" : "string"
                },
                "accountName" : {
                  "type" : "string"
                },
                "balance" : {
                  "type" : "number",
                  "format" : "double"
                }
              }
            }
          }
        }
      }
      

      Notice how the server urls is "" (empty).

      But the server url has been computed to http://0.0.0.0:8080 by default prior to setupXForwardedHeaders is invoked.

      I am not sure why this line is as-is
      https://github.com/apache/camel/blob/f234dae17fa1c6090e13ffd898c8287bf149b57f/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiSupport.java#L136

      Attachments

        1. rest.camel.yaml
          0.8 kB
          Claus Ibsen
        2. Account.java
          0.6 kB
          Claus Ibsen

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              davsclaus Claus Ibsen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: