我有以下Camel Rest配置。我的请求和响应正文都是纯文本。
<post uri="/swagger" produces="application/text" consumes="application/text"
type="String" outType="String">
<param name="body" type="body" description="Transaction to send" required="true" dataType="String"/>
<responseMessage message="OK" code="200" />
<route id="swaggerdemoRoute">
<transform><constant>success</constant></transform>
</route>
</post>
由camel生成的Yaml与Swagger编辑器和UI不兼容。
/swagger/swagger:
post:
tags:
- "swagger"
operationId: "swagger_rest"
consumes:
- "application/text"
produces:
- "application/text"
parameters:
- in: "body"
name: "body"
description: "Transaction to send"
required: true
responses:
200:
description: "OK"
schema:
type: "string"
format: "String"
但是,我可以通过在&#34; body&#34;之后添加2行来手动使其工作。参数:
- in: "body"
name: "body"
description: "Transaction to send"
required: true
schema:
type: string
根据一些输入,我将Camel版本提升到2.20.2并添加dataType =&#34; String&#34;在&#34; param&#34;部分。仍然有同样的问题。另外,&#34; operationId&#34;生成并且Swagger抱怨它的重复。 如何使用camel REST配置工作?
答案 0 :(得分:0)
好的再看看这个,是的它是一个小虫子。我已经记录了一张票并处理了修复:https://issues.apache.org/jira/browse/CAMEL-12255