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

Swagger seems to inject empty headers

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.17.0
    • Fix Version/s: 2.17.1, 2.18.0
    • Component/s: camel-swagger
    • Labels:
      None
    • Estimated Complexity:
      Unknown
    • Regression:
      Regression

      Description

      See http://camel.465427.n5.nabble.com/swagger-injects-empty-headers-in-2-17-0-td5780620.html
      key part copied below.

      I have routes built using REST DSL, and this includes swagger definitions.
      With 2.1.6.2 all was good.
      On switching to 2.17.0 I find that having a swagger query parameter definition causes a header property to be defined as an empty string even when there is no query parameter defined.
      As an example, the REST DSL snippet looks like this:

      .post("/

      {notebookid}

      /e").description("Description ...")
      .bindingMode(RestBindingMode.json).produces("application/json")
      .outType(Foo.class)
      .param().name("notebookid").type(path).description("Notebook ID").dataType("long").endParam()

      .param().name("parent").type(query).description("The parent").dataType("long").required(false).endParam()
      .route()
      .process((Exchange exch) -> {
      Long parent = exch.getIn().getHeader("parent", Long.class);
      ...
      })
      .endRest()

      "parent" is an optional query param.
      With 2.16.2 there was no "parent" header.
      With 2.17.0 a "parent" header is magically added with the value being the empty string, which causes the TypeConversion to Long to blow up.

      If I remove the swagger params then it works OK again.

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              tdudgeon Tim Dudgeon

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment