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

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

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment