camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: swagger injects empty headers in 2.17.0
Date Thu, 07 Apr 2016 05:12:00 GMT
Hi

Ah can you log that in the JIRA

On Wed, Apr 6, 2016 at 10:42 PM, Tim Dudgeon <tdudgeon.ml@gmail.com> wrote:
> I'm hit a wierd problem when trying to upgrade from 2.16.2 to 2.17.0
>
> 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.
>
> Presumably this is a bug?
>
> Tim
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message