Sergey Savenko created CAMEL-13340:
--------------------------------------
Summary: Invalid swagger json/yaml generated for Rest DSL
Key: CAMEL-13340
URL: https://issues.apache.org/jira/browse/CAMEL-13340
Project: Camel
Issue Type: Bug
Components: camel-swagger
Affects Versions: 2.22.0
Reporter: Sergey Savenko
Swagger rests description is generated with invalid responseSchema element. You
can see example I found on
[stackoverflow|https://stackoverflow.com/questions/52745160/camel-rest-dsl-swagger-output-contains-invalid-responseschema-element].
From camel 2.2 swagger-core was upgraded from 1.5.17 to 1.5.20.
In Swagger 1.5.19 new ResponseSchemaMixin was added to default object mapper
[https://github.com/swagger-api/swagger-core/commit/8b97df3667559fca1783da845607afc30e550b83#diff-58c27954db290a19d4fadbfe34b0bbf3]
Camel creates ObjectMapper manually, and does not add this mixin, which results
in incorrect json/yaml generated. See
[https://github.com/apache/camel/blob/camel-2.22.0/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java#L216]
and line 235
Fix can be either add ResponseSchemaMixin to manually created objectmappers OR
call Json.mapper() and Yaml.mapper() to use swagger logic and don't create
mapper manually.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)