Hidden fields in swagger ui

喜你入骨 提交于 2019-12-02 15:16:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!