Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.17.0
-
None
-
Unknown
-
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.