亲宝软件园·资讯

展开

Swagger修改请求更新文档

编程小龙 人气:1

解决方法

有两个对象用了同一个@ApiModel的value值

描述

今天发现不管怎么修改如下对象,接口显示总是不变

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "账单查询对象",description = "请求参数类")
public class QueryBillVO {
    @ApiModelProperty(value = "页码",example = "1",required = false)
    private Long page = 1l;
    @ApiModelProperty(value = "每页显示条数",example = "10",required = false)
    private Long size = 10l;
    @ApiModelProperty(value = "账单范围 private/group/all",example = "private/group/all",required = true)
    private String area;
    @ApiModelProperty(value = "支付类型 0支付/1收入",example = "0",required = false)
    private Integer type;
}

后来发现原来是两个查询对象的 @ApiModel中的value都使用了同一个值,在swagger页面上显示是就只显示先放入bean的那一个

/**
 * @author lzp
 * @date 2021/4/23 2:29
 * 通用查询bean
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "查询通用对象",description = "请求参数类")
public class QueryVO {
    @ApiModelProperty(value = "页码",example = "1",required = false)
    private Long page = 1l;
    @ApiModelProperty(value = "每页显示条数",example = "10",required = false)
    private Long size = 10l;
    @ApiModelProperty(value = "登录用户的id",example = "1",required = false)
    private Integer userId;
}

保持value不一样即可

加载全部内容

相关教程
猜你喜欢
用户评论