简体   繁体   English

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

[英]Springfox Bean Validations @Size annotation does not work properly on List

I am using springfox bean validators to extract field limit information into the generated swagger json file,Here is the way I use:我使用springfox bean验证器将字段限制信息提取到生成的swagger json文件中,这里是我使用的方式:

    @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;

In the generated json file:在生成的json文件中:

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

@Size annotation does not work properly on List @Size注释在List上无法正常工作

This is a problem that is not yet supported by springfox.这是springfox尚不支持的问题。 I have modified the code and the submitted code is merged.我修改了代码,合并提交的代码。 It is expected to be released in version 3.0.预计将在 3.0 版本中发布。 pull request link拉取请求链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM