You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gregor Zurowski <gr...@list.zurowski.org> on 2016/03/30 23:08:55 UTC

Path Parameters with REST DSL and Swagger

Hi Everyone:

I have a problem with path parameters when using the REST DSL with
Camel 2.16.2 and the camel-swagger-java module.  Path parameters are
always exposed as enum types through Swagger.

The simplified REST part in my route builder looks as follows:

===
[...]
rest("/test-api/v1").description("...")
    .consumes("application/json").produces("application/json")
    .put("/tests/{testNumber}/details").description("...")
        .param().name("testNumber").type(RestParamType.path)
            .dataType("string").description("...").endParam()
[...]
===

The path parameter "testNumber" is exposed as an enum type through
Swagger, see the corresponding Swagger JSON document excerpt:

===
[...]
"parameters" : [ {
  "name" : "testNumber",
  "in" : "path",
  "description" : "...",
  "required" : true,
  "type" : "string",
  "enum" : [ ]
}, [...]
===

Is this a bug or have I missed something?

Thanks in advance,
Gregor

Re: Path Parameters with REST DSL and Swagger

Posted by Gregor Zurowski <gr...@list.zurowski.org>.
Hi Claus,

I ran the code with 2.16.3-SNAPSHOT and the problem is fixed with that
version.  The path parameter is returned as a regular string
parameter:

===
[...]
"parameters" : [ {
  "name" : "testNumber",
  "in" : "path",
  "description" : "...",
  "required" : true,
  "type" : "string"
}, [...]
===

Thanks for your help.

Gregor


On Fri, Apr 1, 2016 at 6:46 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Can you try with 2.16.3 SNAPSHOT. We got a git of fix in there, and
> combiend with the swagger upgrade it fixed some issues in the past.
>
> On Thu, Mar 31, 2016 at 11:37 PM, Gregor Zurowski
> <gr...@list.zurowski.org> wrote:
>> Hi Claus,
>>
>> Thanks for your quick response.  I installed version 1.5.8 of
>> swagger-core, which is the latest stable version, but the problem
>> remains the same.
>>
>> Thanks,
>> Gregor
>>
>> On Thu, Mar 31, 2016 at 7:44 AM, Claus Ibsen <cl...@gmail.com> wrote:
>>> Try upgrade swagger-core to newer version
>>>
>>> On Wed, Mar 30, 2016 at 11:08 PM, Gregor Zurowski
>>> <gr...@list.zurowski.org> wrote:
>>>> Hi Everyone:
>>>>
>>>> I have a problem with path parameters when using the REST DSL with
>>>> Camel 2.16.2 and the camel-swagger-java module.  Path parameters are
>>>> always exposed as enum types through Swagger.
>>>>
>>>> The simplified REST part in my route builder looks as follows:
>>>>
>>>> ===
>>>> [...]
>>>> rest("/test-api/v1").description("...")
>>>>     .consumes("application/json").produces("application/json")
>>>>     .put("/tests/{testNumber}/details").description("...")
>>>>         .param().name("testNumber").type(RestParamType.path)
>>>>             .dataType("string").description("...").endParam()
>>>> [...]
>>>> ===
>>>>
>>>> The path parameter "testNumber" is exposed as an enum type through
>>>> Swagger, see the corresponding Swagger JSON document excerpt:
>>>>
>>>> ===
>>>> [...]
>>>> "parameters" : [ {
>>>>   "name" : "testNumber",
>>>>   "in" : "path",
>>>>   "description" : "...",
>>>>   "required" : true,
>>>>   "type" : "string",
>>>>   "enum" : [ ]
>>>> }, [...]
>>>> ===
>>>>
>>>> Is this a bug or have I missed something?
>>>>
>>>> Thanks in advance,
>>>> Gregor
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2

Re: Path Parameters with REST DSL and Swagger

Posted by Claus Ibsen <cl...@gmail.com>.
Can you try with 2.16.3 SNAPSHOT. We got a git of fix in there, and
combiend with the swagger upgrade it fixed some issues in the past.

On Thu, Mar 31, 2016 at 11:37 PM, Gregor Zurowski
<gr...@list.zurowski.org> wrote:
> Hi Claus,
>
> Thanks for your quick response.  I installed version 1.5.8 of
> swagger-core, which is the latest stable version, but the problem
> remains the same.
>
> Thanks,
> Gregor
>
> On Thu, Mar 31, 2016 at 7:44 AM, Claus Ibsen <cl...@gmail.com> wrote:
>> Try upgrade swagger-core to newer version
>>
>> On Wed, Mar 30, 2016 at 11:08 PM, Gregor Zurowski
>> <gr...@list.zurowski.org> wrote:
>>> Hi Everyone:
>>>
>>> I have a problem with path parameters when using the REST DSL with
>>> Camel 2.16.2 and the camel-swagger-java module.  Path parameters are
>>> always exposed as enum types through Swagger.
>>>
>>> The simplified REST part in my route builder looks as follows:
>>>
>>> ===
>>> [...]
>>> rest("/test-api/v1").description("...")
>>>     .consumes("application/json").produces("application/json")
>>>     .put("/tests/{testNumber}/details").description("...")
>>>         .param().name("testNumber").type(RestParamType.path)
>>>             .dataType("string").description("...").endParam()
>>> [...]
>>> ===
>>>
>>> The path parameter "testNumber" is exposed as an enum type through
>>> Swagger, see the corresponding Swagger JSON document excerpt:
>>>
>>> ===
>>> [...]
>>> "parameters" : [ {
>>>   "name" : "testNumber",
>>>   "in" : "path",
>>>   "description" : "...",
>>>   "required" : true,
>>>   "type" : "string",
>>>   "enum" : [ ]
>>> }, [...]
>>> ===
>>>
>>> Is this a bug or have I missed something?
>>>
>>> Thanks in advance,
>>> Gregor
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2



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

Re: Path Parameters with REST DSL and Swagger

Posted by Gregor Zurowski <gr...@list.zurowski.org>.
Hi Claus,

Thanks for your quick response.  I installed version 1.5.8 of
swagger-core, which is the latest stable version, but the problem
remains the same.

Thanks,
Gregor

On Thu, Mar 31, 2016 at 7:44 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Try upgrade swagger-core to newer version
>
> On Wed, Mar 30, 2016 at 11:08 PM, Gregor Zurowski
> <gr...@list.zurowski.org> wrote:
>> Hi Everyone:
>>
>> I have a problem with path parameters when using the REST DSL with
>> Camel 2.16.2 and the camel-swagger-java module.  Path parameters are
>> always exposed as enum types through Swagger.
>>
>> The simplified REST part in my route builder looks as follows:
>>
>> ===
>> [...]
>> rest("/test-api/v1").description("...")
>>     .consumes("application/json").produces("application/json")
>>     .put("/tests/{testNumber}/details").description("...")
>>         .param().name("testNumber").type(RestParamType.path)
>>             .dataType("string").description("...").endParam()
>> [...]
>> ===
>>
>> The path parameter "testNumber" is exposed as an enum type through
>> Swagger, see the corresponding Swagger JSON document excerpt:
>>
>> ===
>> [...]
>> "parameters" : [ {
>>   "name" : "testNumber",
>>   "in" : "path",
>>   "description" : "...",
>>   "required" : true,
>>   "type" : "string",
>>   "enum" : [ ]
>> }, [...]
>> ===
>>
>> Is this a bug or have I missed something?
>>
>> Thanks in advance,
>> Gregor
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2

Re: Path Parameters with REST DSL and Swagger

Posted by Claus Ibsen <cl...@gmail.com>.
Try upgrade swagger-core to newer version

On Wed, Mar 30, 2016 at 11:08 PM, Gregor Zurowski
<gr...@list.zurowski.org> wrote:
> Hi Everyone:
>
> I have a problem with path parameters when using the REST DSL with
> Camel 2.16.2 and the camel-swagger-java module.  Path parameters are
> always exposed as enum types through Swagger.
>
> The simplified REST part in my route builder looks as follows:
>
> ===
> [...]
> rest("/test-api/v1").description("...")
>     .consumes("application/json").produces("application/json")
>     .put("/tests/{testNumber}/details").description("...")
>         .param().name("testNumber").type(RestParamType.path)
>             .dataType("string").description("...").endParam()
> [...]
> ===
>
> The path parameter "testNumber" is exposed as an enum type through
> Swagger, see the corresponding Swagger JSON document excerpt:
>
> ===
> [...]
> "parameters" : [ {
>   "name" : "testNumber",
>   "in" : "path",
>   "description" : "...",
>   "required" : true,
>   "type" : "string",
>   "enum" : [ ]
> }, [...]
> ===
>
> Is this a bug or have I missed something?
>
> Thanks in advance,
> Gregor



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