swagger ui 中的隐藏字段 [英] Hidden fields in swagger ui

查看:116
本文介绍了swagger ui 中的隐藏字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 swagger UI 2.0.23 版本,我使用 json 文件提供 api.我需要使用 swagger ui 向我的 api 发送一个特定的标头值,但该字段在 ui 中不应该可见.因为值不应该被改变.因此,如何隐藏该字段以使其不显示在 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"
        }

推荐答案

这是在 Swagger ui 中隐藏字段所需添加的全部内容:

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.

这篇关于swagger ui 中的隐藏字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆