You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by wheadonj <ja...@gmail.com> on 2015/10/12 04:53:21 UTC

camel-swagger-java model api not including nested objects

Hi,

I have just upgraded my project to camel version 2.16.0 so I can use the new
camel-swagger-java component a specify header params in my swagger
documentation (which works great, thanks).

I noticed that after upgrading, the import for the swagger annotations
changed from com.wordnik.swagger.annotations.* to io.swagger.annotations.*,
and now the swagger model schema documentation no longer includes the schema
for nested objects.

For example, I have a request that has a List<SomeObject> someObjects and in
the swagger model schema documentation all I see is:

{
  "someObjects": [
    "SomeObject"
  ]
}

Before the upgrade the swagger model schema documentation would be
(displaying all properties of the "SomeObject"):

{
  "someObjects": [
    {
      "someObjectProperty1": "",
      "someObjectProperty2": ""
    }
  ]
}

All models have the @ApiModel annotation and all properties within the
models have the @ApiModelProperty annotation. Is this a bug that has been
introduced with the new camel-swagger-java component or is there some extra
configuration/annotations required to get the swagger schema documentation
working on nested objects?

Cheers, Jason



--
View this message in context: http://camel.465427.n5.nabble.com/camel-swagger-java-model-api-not-including-nested-objects-tp5772542.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-swagger-java model api not including nested objects

Posted by wheadonj <ja...@gmail.com>.
I'm using spring boot with the camel-servlet component and the rest dsl.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-swagger-java-model-api-not-including-nested-objects-tp5772542p5772546.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-swagger-java model api not including nested objects

Posted by minikiller <mi...@qq.com>.
Do you use camel-swagger-java under osgi envirnment? I also found a error
when run it in karaf.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-swagger-java-model-api-not-including-nested-objects-tp5772542p5772544.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-swagger-java model api not including nested objects

Posted by wheadonj <ja...@gmail.com>.
Thanks Claus.

I have raised JIRA CAMEL-9220
<https://issues.apache.org/jira/browse/CAMEL-9220>.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-swagger-java-model-api-not-including-nested-objects-tp5772542p5772627.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-swagger-java model api not including nested objects

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Thanks you are welcome to log a JIRA ticket
http://camel.apache.org/support.html

We use the swagger model reader, but it may be that we need to add
some logic to walk down nested objects which it seems it doesn't do
now.

On Mon, Oct 12, 2015 at 12:28 PM, wheadonj <ja...@gmail.com> wrote:
> The outer class (that has a List<SomeObject>) has @ApiModel at the class
> level and @ApiModelProperty on the only field "someObjects".
>
> The SomeObject class has @ApiModel at the class level and @ApiModelProperty
> on all fields ("someObjectProperty1", "someObjectProperty2".
>
> All these annotations are in the same place that they were before upgrading,
> after upgrading all I have changed is the imports.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-swagger-java-model-api-not-including-nested-objects-tp5772542p5772565.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Re: camel-swagger-java model api not including nested objects

Posted by wheadonj <ja...@gmail.com>.
The outer class (that has a List<SomeObject>) has @ApiModel at the class
level and @ApiModelProperty on the only field "someObjects".

The SomeObject class has @ApiModel at the class level and @ApiModelProperty
on all fields ("someObjectProperty1", "someObjectProperty2".

All these annotations are in the same place that they were before upgrading,
after upgrading all I have changed is the imports.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-swagger-java-model-api-not-including-nested-objects-tp5772542p5772565.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-swagger-java model api not including nested objects

Posted by Claus Ibsen <cl...@gmail.com>.
How is your pojo class annotated?

On Mon, Oct 12, 2015 at 4:53 AM, wheadonj <ja...@gmail.com> wrote:
> Hi,
>
> I have just upgraded my project to camel version 2.16.0 so I can use the new
> camel-swagger-java component a specify header params in my swagger
> documentation (which works great, thanks).
>
> I noticed that after upgrading, the import for the swagger annotations
> changed from com.wordnik.swagger.annotations.* to io.swagger.annotations.*,
> and now the swagger model schema documentation no longer includes the schema
> for nested objects.
>
> For example, I have a request that has a List<SomeObject> someObjects and in
> the swagger model schema documentation all I see is:
>
> {
>   "someObjects": [
>     "SomeObject"
>   ]
> }
>
> Before the upgrade the swagger model schema documentation would be
> (displaying all properties of the "SomeObject"):
>
> {
>   "someObjects": [
>     {
>       "someObjectProperty1": "",
>       "someObjectProperty2": ""
>     }
>   ]
> }
>
> All models have the @ApiModel annotation and all properties within the
> models have the @ApiModelProperty annotation. Is this a bug that has been
> introduced with the new camel-swagger-java component or is there some extra
> configuration/annotations required to get the swagger schema documentation
> working on nested objects?
>
> Cheers, Jason
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-swagger-java-model-api-not-including-nested-objects-tp5772542.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition