This is an automated email from the ASF dual-hosted git repository. dmvolod pushed a commit to branch camel-2.23.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.23.x by this push: new 9f10c0b CAMEL-13340: Invalid swagger json/yaml generated for Rest DSL 9f10c0b is described below commit 9f10c0bb3b4b4aa106d9cc908e87672e9936ad01 Author: Dmitry Volodin <dmvo...@gmail.com> AuthorDate: Wed Mar 20 15:02:20 2019 +0300 CAMEL-13340: Invalid swagger json/yaml generated for Rest DSL --- .../src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java index b549634..249faa3 100644 --- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java +++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java @@ -31,10 +31,12 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import io.swagger.jackson.mixin.ResponseSchemaMixin; import io.swagger.jaxrs.config.BeanConfig; import io.swagger.models.Contact; import io.swagger.models.Info; import io.swagger.models.License; +import io.swagger.models.Response; import io.swagger.models.Scheme; import io.swagger.models.Swagger; import io.swagger.util.Yaml; @@ -226,6 +228,8 @@ public class RestSwaggerSupport { ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.addMixIn(Response.class, ResponseSchemaMixin.class); + byte[] bytes = mapper.writeValueAsBytes(swagger); int len = bytes.length; @@ -246,6 +250,8 @@ public class RestSwaggerSupport { ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.addMixIn(Response.class, ResponseSchemaMixin.class); + byte[] jsonData = mapper.writeValueAsBytes(swagger); // json to yaml