Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.22.0
-
None
-
Unknown
Description
Swagger rests description is generated with invalid responseSchema element. You can see example I found on stackoverflow.
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.