Query Params within Swagger UI

202 views
Skip to first unread message

Jonathan Lemon

unread,
Mar 10, 2014, 3:32:46 PM3/10/14
to swagger-sw...@googlegroups.com
Hi everyone,

Loving Swagger thus far, but have run into an issue I was hoping you could help with.

I am trying to get a query param to display in the UI. I want to be able to differentiate between it and a standard GET call.

So, I want to display the full path, along query parameter like 'customers?members={ids}'. At the moment it just displays 'customers'. Is this even possible.

My GET method, and annotations, looks as follows:

@GET
@ApiOperation(
value = "Retrieve specified customers by their ids", 
notes = "Returns a collection of customes. IDs are delimitted by a comma.",
response = Customer.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 404, message = "No customers found"),
@ApiResponse(code = 500, message = "Something wrong in Server")})
public Response getCustomersById(
@ApiParam(value = "Customer IDs to search for", required = true, allowMultiple = true) @QueryParam("ids") String ids)
{
// empty for this post
}

Any input would be greatly appreciated.

Thanks!
Jon

Ron R

unread,
Mar 15, 2014, 3:56:42 PM3/15/14
to swagger-sw...@googlegroups.com
Hi Jon,

Currently, there's no simple way to do it. Technically, a REST API call refers to the URL as the "resource" (hence, U-R-L) and the parameters are just parameters.
You *may* be able to write your own filter, catch the response from the Swagger servlet and manipulate the "path" value of the operation.
However, I cannot guarantee how Swagger UI (or any other third party tool) will treat it. You can first try it by creating a static json file of your spec and refer to it from the ui.
Reply all
Reply to author
Forward
0 new messages