Two body parameters, one as ApiParam the other as ApiImplicitParam, not working

3,184 views
Skip to first unread message

Tommaso Bianco

unread,
Jun 30, 2015, 1:11:24 PM6/30/15
to swagger-sw...@googlegroups.com
Hi,
I am trying to get two parameters of "paramType" "body" to work without results.

The method likes like the following

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Create new pet", notes = "Create new pet", response = PetResource.class)
@ApiImplicitParams({@ApiImplicitParam(name = "Pet", value = "Pet to be created", required = true, dataType = "PetResource", paramType = "body")})
public Response create(@Context UriInfo info,
    @ApiParam(value = "Pet to be created",  access = "internal") Pet pet,
    @Context ContainerRequestContext context)
{



My need is the following:
The POST method argument is a POJO class (Pet), which is what the json in the payload is actually converted into. This class is actually for internal use, and I don't want to have Swagger annotations in it.
The class to be returned, documented, and actually what the client supposes to send is the PetResource

What I would like to have is
1. Hide
@ApiParam(value = "Pet to be created",  access = "internal") Pet pet from the documentation, but I cannot filter this parameter out by means of a SwaggerSpecFilter

2. Show @ApiImplicitParams({@ApiImplicitParam(name = "Pet", value = "Pet to be created", required = true, dataType = "PetResource", paramType = "body")})but it seems that when there are two parameters my application raises an error

Any help would be greatly appreciated!

System info
jersey version 2.17
swagger-core version 1.5.0
swagger-jersey2-jaxrs version 1.5.0

Ron Ratovsky

unread,
Jul 5, 2015, 3:43:17 PM7/5/15
to swagger-sw...@googlegroups.com
Once https://github.com/swagger-api/swagger-core/issues/1188 is resolved, you should have an easy solution for your use case.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

Tommaso Bianco

unread,
Jul 6, 2015, 9:18:51 AM7/6/15
to swagger-sw...@googlegroups.com
Thanks Ron! I'll keep you posted about the problem/solution
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages