Swagger ui - request parameter
2 answers
You can use the annotation @ApiParam
from Swagger annotations to customize the request parameter 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
+5
source to share
You can't, but since swagger 2.0 (I don't know if this is supported by swagger-code / swagger-ui), you can define parameters to be reused across different operations .
For example:
{
"parameters": {
"pageParam": {
"name": "page",
"in": "query",
"description": "page number to get",
"required": false,
"type": "integer",
"format": "int32"
}
},
"paths": {
"/customers": {
"get": {
"description": "Retrive list of customers",
"parameters": {
"$ref": "#/parameters/pageParam"
},
...
}
}
},
...
}
0
source to share