java - Camel REST DSL 招摇输出包含无效的 responseSchema 元素
问题描述
我正在使用 spring-boot (2.0.5) 和 camel (2.22.1) 开发一个 REST API。API 是使用 Camel 出色的 REST DSL 定义和自动记录的。一切都很好,除了当我检查生成的招摇(JSON 或 YAML)时,我的响应包含一个无效属性responseSchema
,它似乎是schema
我期望的有效属性的副本。这会在通过 swagger-ui 渲染时导致验证错误。
这是我的 API 定义示例:
rest("/things")
.get("/").outType(Thing[].class)
.param().name("param1").type(RestParamType.query).required(FALSE)
.description("param 1").endParam()
.responseMessage().code(200).message("Some things..")
.header("number-of-things").dataType("integer").endHeader()
.endResponseMessage()
.responseMessage().code(400)
.message("Bad request.")
.responseModel(Error.class).endResponseMessage()
responses
这在我的招摇部分产生以下输出:
400:
description: "Bad request."
schema:
$ref: "#/definitions/Error"
responseSchema:
$ref: "#/definitions/Error"
看起来我遇到了这个问题,并且有一些解决这个问题的建议,但我不确定在 SpringBoot 应用程序中哪个更可取,而且我还没有任何解决方案可以工作。
解决方案
我遇到了同样的问题,经过调查我发现它是骆驼虫,所以创建了问题,你可以看到描述https://issues.apache.org/jira/browse/CAMEL-13340。它将从骆驼 2.23.2 修复
推荐阅读
- python-3.x - 如何从 Firebase 存储下载文件
- python - 匹配两个列表的键名和值
- typescript - 使用 Typescript 从 switch case 返回的类型推断
- javascript - 使用 vue.js 按下提交后将用户重定向到不同的页面
- swift - 如何在 Catalyst 中添加 `toggleSidebar` NSToolbarItem?
- javascript - webpack的Javascript图像路径问题
- flutter - 如何在 Flutter 中获得 AppBar 标题的 shuch 效果?
- kubernetes - 入口路由api前缀问题
- c++ - 当机器人汽车使用超声波传感器检测到物体时停止机器人汽车(C++)
- python - python中的滚动累积函数