java - spring boot和swagger中怎么隐藏请求参数?
天蓬老师
天蓬老师 2017-04-18 09:52:10
0
2
656

swagger2和springboot整合时,controller里面方法的请求参数是一个实体对象,但是生成api文档时不需要实体对象的所有属性作为请求参数。

controller方法如下
@ApiOperation(value = "测试隐藏属性",httpMethod = "GET")
@RequestMapping("/testHidden")
public  String testHidden(@ModelAttribute User user){

    return "success";
}


实体对象属性加了hidden注解但是在接口文档中并没有隐藏,有谁知道怎么解决吗?
@ApiModel
public class User {

    private Long id;
    
    @ApiModelProperty(hidden = true)
    private String name;
    
    private Integer age;
    
    我想隐藏name参数,怎么解决?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

répondre à tous(2)
大家讲道理

Toutes les annotations peuvent être implémentées en important le package io.swagger.annotations

阿神

Propriétaire, le problème a-t-il été résolu ?

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!