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

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参数,怎么解决?

天蓬老师
天蓬老师

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

reply all(2)
大家讲道理

All annotations can be implemented by importing the io.swagger.annotations package

阿神

Owner, has the problem been solved?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!