Tim Dudgeon created CAMEL-9828:
----------------------------------

             Summary: Swagger seems to inject empty headers
                 Key: CAMEL-9828
                 URL: https://issues.apache.org/jira/browse/CAMEL-9828
             Project: Camel
          Issue Type: Bug
          Components: camel-swagger
    Affects Versions: 2.17.0
            Reporter: Tim Dudgeon


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.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to