如何可以设置性能大摇大摆列的串名单<String>

0

的问题

我试图创造springDoc昂首阔步的文件,我想表示一个这样的数据 List<String> elements; 具有某些特性如minSize和MaxSize/minLength最长为值在名单。 我试着用这个

@Schema(required = true, minLength = 12,maxLength = 20)
List<String> elements;

@Size(min=10,max=20)
List<String> elements;

结果是:

"Products": {
  "title": "Products",
  "type": "object",
  "properties": {
    "elements": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  }
}

任何想法有这样的结果:

"Products": {
    "title": "Products",
    "type": "object",
    "properties": {
        "elements": {
            "type": "array",
            "items": {
                "type": "string",
                "maxLength": 20,
                "minLength": 5
            }
        }
    }
}
annotations spring-boot swagger
2021-11-23 15:30:04
1
0

我认为 @ArraySchema 是你在找什么如下:

@Schema(minItems = 12, maxItems = 20)
List<String> elements;

@Schema 是被用于非阵元 @ArraySchema 是可用于列的要素。 两者不能并存。

2021-11-23 17:53:56

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................