【发布时间】:2022-01-02 02:29:34
【问题描述】:
我正在尝试创建 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
}
}
}
}
【问题讨论】:
标签: spring-boot annotations swagger