얼마나 속성을 설정할 수 있습니다 swagger 목록의 문자열 List<String>

0

질문

을 만들려고 springDoc swagger 문서,그리고 나를 나타내는 데이터는 다음과 같이 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ý
..................................................................................................................