问题
I am using swagger UI 2.0.23 version and I provision api using json files. I need to send a particular header value to my api using swagger ui but the field should not be visible in the ui. Because the value is not supposed to be changed. Therefore how do I hide the field from showing in the ui. I have tried following sample but didn't work
{
"name": "access_type",
"dataType": "string",
"enum": [
"high"
],
"required": "true",
"paramType": "httpHeader",
"access": "hidden"
}
回答1:
This is all you need to add to hide the field in the Swagger ui:
@ApiModelProperty(hidden = true)
private List<Reservation> reservations;
That would hide the reservation list from showing.
回答2:
You can add a QueryParam and set @ApiParam(access="hide") to it, You won't see it as a query param in the swagger UI.
来源:https://stackoverflow.com/questions/39973840/hidden-fields-in-swagger-ui