java - 如何使用 Swagger 显示骆驼休息参数 List of Objects
问题描述
如何让camel-swagger-java扫描骆驼休息 api 路由并表示休息端点参数,该参数是那些 pojo 具有 json 属性的 pojo 对象列表?
当尝试使用 List 或 SamplePojo[] 作为骆驼休息端点主体时,camel-swagger-java 使用两者.type(SamplePojo[].class)
来.typeList(SamplePojo.class)
生成一个 api 页面,该页面显示主体只是一个字符串,而不是为 SamplePojo 中的所有属性显示 json班级。
有一个 .arrayType 方法可以用于路由参数,但没有提到应该指定什么: .arrayType("whatHere?")
在下面使用它的尝试大摇大摆地将类型显示为一个字符串,而不是 json 属性:
.arrayType(SamplePojo.class.getName())
休息操作参数定义:
/**
* Sets the Swagger Parameter array type.
* Required if data type is "array". Describes the type of items in the array.
*/
public void setArrayType(String arrayType) {
this.arrayType = arrayType;
}
有人问这个没有解决方案:
有 swagger 的骆驼示例,但没有 List 参数示例:
解决方案
推荐阅读
- python-3.x - 使用命令提示符在 windows 10 pro、python3.8.0 中安装 jupyter notebook 时遇到错误
- sql - 如果我的查询在特定条件下运行,我如何按降序对表数据进行排序
- oracle - 在提交流程 i oracle apex 后保留表单中的值
- android - 响应式通知图标颜色 - Android
- c# - 为什么有的unity源码assign null有强制转换操作?
- kubernetes - crd之间的层次结构是什么,例如openshift 4中的clusteroperators,clusterversionoperator
- excel - 从两列变量设置列值
- python - 如何仅返回使用 POST 请求发布的今天和昨天的信息
- mysql - 计算上个月记录中的值
- javascript - 使用事件侦听器时如何访问父容器上的属性?