Reputation: 6960
How to configure swaggerui to display correct parameter datatype for JAX-RS resources which have collection input parameters?
Below is a sample groovy JAX-RS resource. Its input is of type List<User>
@POST
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
@ApiOperation(value = "Create(s) users", response = User, responseContainer = "List")
Response createUsers(List<User> questions) {
}
In the swagger UI, I see the List with empty type populated instead of User
. It works fine for output parameters. Using ApiOperation
annotation, I could specify for response type.
@ApiOperation(value = "Create(s) users", response = User, responseContainer = "List")
For input parameters, How do I see List of User model schema in the swagger UI?
Upvotes: 3
Views: 4542
Reputation: 56
Try using @ApiParam on List:
@POST
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
@ApiOperation(value = "Create(s) users", response = User, responseContainer = "List")
Response createUsers(@ApiParam("description") List<User> questions) {
}
Upvotes: 4