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: camel-swagger-java - Help needed with documentation
Date Tue, 02 Feb 2016 07:20:21 GMT
Try upgrading to 2.16.2, we had some fixes in camel-swagger-java

On Tue, Feb 2, 2016 at 12:18 AM, ytatyaLij <amare.aderajew@gmail.com> wrote:
> Hi,
>
> We are using Camel-Swagger-Java v 2.16 for documenting the REST services
> generated using CamelREST DSL.
> We are able to integrate the swagger with the application and can get the
> Swagger document laying down the full API specification.
>
> The problem we are getting is in describing the Model in the document.
> Currently it is giving the Model as empty.
> ------------------------------------------------
> Below is the REST definiton snippet:
> ------------------------------------------------
> <camel:get uri="/v1/my_service" outType="com.mypackage.vo.ResponseVO">
> ....param definition etc....
> </camel:get>
>
> --------------------------------
> Below is my Model:
> --------------------------------
> package com.mypackage.vo;
> @ApiModel(description = "Represents the request attribute for the services")
> public class ResponseVO{
> @ApiModelProperty(value = "Status Block", required = true, dataType =
> "com.mypackage.vo.StatusVO")
> private StatusVO status;
> @ApiModelProperty(value = "Response Block", required = true, dataType =
> "java.util.List")
> private List<ResultVO> response;
> ....Getter/Setters.....
> }
>
> ---------------------------------------
> Below is my ResultVO:
> ---------------------------------------
> @ApiModel(description = "Represents the response attribute for the
> services")
> public class ResultVO {
>
> @ApiModelProperty(value = "code for the product", required = true)
> private String id;
> @ApiModelProperty(value = "name for the product", required = false)
> private String name;
>
> //many more properties
> //getter/setter methods
> }
>
>
> Now with this I get the below snippet in swagger.json
>
>     "ResponseVO" : {
>       "type" : "object",
>       "required" : [ "response", "status" ],
>       "properties" : {
>         "status" : {
>           "description" : "Status Block",
>           "$ref" : "#/definitions/StatusVO"
>         },
>         "response" : {
>           "type" : "array",
>           "description" : "Response Block",
>           "items" : {
>             "type" : "object"
>           }
>         }
>       },
>       "description" : "Represents the request attribute for the services",
>       "x-className" : {
>         "type" : "string",
>         "format" : "com.mypackage.vo.ResponseVO"
>       }
>     }
>   }
>
>
>  The above swagger.json codes transforms into the below in my Swagger-ui
> page:
> {
>   "getAllServiceResponse": [
>     {}
>   ]
> }
>
>
> In the swagger.json for the REST Service - I do see
>  "schema" : {
>    "$ref" : "#/definitions/ResponseVO"
>  }
> but it does not describes the list of attributes defined inside the
> ResponseVO class or the ResultVO class. It simply shows as {} like
> ResponseVO {} as shown above.
> My understanding is that i should have got something like below:(might be
> the json format i gave is wrong,just for illustrative purpose i am
> mentioning it)
>
> {
>   "getAllServiceResponse": [
>     {
>                 "status" : "String",
>                 resultVO : [
>                         {
>                                 "id" : String,
>                                 "name" : String
>                         }
>                 ]
>         }
>   ]
> }
>
> Kindly advice why attributes in the ResponseVO model are not getting listed.
>
> Thanks!!!
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-swagger-java-Help-needed-with-documentation-tp5777125.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Mime
View raw message