Springfox Bean Validations@Size注释在List上无法正常工作



我使用springfoxbean验证器将字段限制信息提取到生成的swaggerjson文件中,以下是我使用的方法:

@ApiModelProperty("str1")
@Size(min = 1, max = 200, message = "length 1-200")
private String str1;
@ApiModelProperty("list1")
@Size(min = 1, max = 100, message = "size 1-100")
private List<String> list1;

在生成的json文件中:

str1:- {
type: "string",
description: "str1",
allowEmptyValue: false,
minLength: 1,
maxLength: 200
},
list1:- {
type: "array",
description: "list1",
allowEmptyValue: false,
items:- {
type: "string"
}
}

@Size注释在List上无法正常工作

这是springfox尚未支持的问题。我已经修改了代码,提交的代码被合并。预计将在3.0版本中发布。提取请求链路

最新更新