Nishantha Pradeep
Nishantha Pradeep

Reputation: 87

Hidden fields in swagger ui

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"
        }

Upvotes: 3

Views: 23131

Answers (3)

Zaid Qassim
Zaid Qassim

Reputation: 159

if you need to hide one property from model try this:

[JsonIgnore]
public string PropertyName{ get; set; }

Upvotes: 1

Sammy65
Sammy65

Reputation: 708

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.

Upvotes: 7

David Barda
David Barda

Reputation: 1010

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.

Upvotes: -1

Related Questions