Swagger ui - Query param

Jacaro picture Jacaro · Jul 1, 2015 · Viewed 17.3k times · Source

I am using Swagger ui and Swagger core (1.3) for a jersey application. I have certain query parameters which I must send with every request like post, get, delete...

How can I default this ?

Answer

ipeluffo picture ipeluffo · Jul 2, 2015

You can use the annotation @ApiParam from the Swagger annotations in order to configure the Query param to be used from the Swagger-UI.

For example

@Path("/{username}")
@ApiOperation(value = "Updated user")
public Response updateUser(
  @ApiParam(value = "description for query-parameter") @QueryParam("username") String username
) {
...
}

Please, read more about this annotation in the following official documentation: https://github.com/swagger-api/swagger-core/wiki/Annotations#apiparam