swagger-ui - 有没有办法将 int 转换为 List在 Swagger 中为 @ApiModelProperty
问题描述
我想要隐蔽的 int 来列出 @ApiModelProperty
我使用 spring-fox swagger2 生成 API 规范,我们希望 ApiModel 中的属性日期支持 int 和 List。
@Data
@Immutable
@ApiModel(value = "Model", description = "Model")
public class CriteriaFields {
@ApiModelProperty(required=false,value="date",example="XXX")
private List<Integer> date;
}
现在只支持 List,如果我把 int 放在 swagger 页面中,它显示不能将 int 转换为 List。
Cannot deserialize instance of `java.util.ArrayList` out of VALUE_NUMBER_INT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList` out of VALUE_NUMBER_INT token\n at [Source: (PushbackInputStream); line: 3, column: 15] (through reference chain:
解决方案
推荐阅读
- smooth-scrolling - 如何使用 idiotWu 的平滑滚动库获得滚动偏移量?
- python - ModuleNotFoundError:没有名为“wanda”的模块
- django - Celery Beat 和 Django orm 无法正常工作
- javascript - API 补丁和 put 不更新版本字段
- c# - 在 C# 中获取 Process Explorer 显示的“图像文件”信息
- mysql - Laravel 7 - 需要构建查询字符串
- javascript - 如何从 page.on 函数中获取价值?
- firebase - 删除 Firestore 上的集合和子集合的最佳方法是什么?
- visual-studio-code - 以编程方式从 VSCode 扩展切换到 ActivityBar
- android - 可以在GDB+GdbServer的调试环境中使用调用函数命令吗?