Claus Ibsen created CAMEL-20490:
-----------------------------------

             Summary: camel-openapi-java - Empty server url due to 
X-Forward-Headers
                 Key: CAMEL-20490
                 URL: https://issues.apache.org/jira/browse/CAMEL-20490
             Project: Camel
          Issue Type: Improvement
          Components: camel-rest-openapi
            Reporter: Claus Ibsen
             Fix For: 4.x


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)

{code}
{
  "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"
          }
        }
      }
    }
  }
}
{code}

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



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to