This is an automated email from the ASF dual-hosted git repository. dmvolod pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new e3cdcd4 CAMEL-13340: Invalid swagger json/yaml generated for Rest DSL e3cdcd4 is described below commit e3cdcd4357c21958872e89ed3f823cec9ea28746 Author: Dmitry Volodin <dmvo...@gmail.com> AuthorDate: Thu Mar 21 18:29:48 2019 +0300 CAMEL-13340: Invalid swagger json/yaml generated for Rest DSL --- .../java/org/apache/camel/swagger/RestSwaggerSupport.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 4f0968a..e8a7abe 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 @@ -37,14 +37,13 @@ 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.Json; import io.swagger.util.Yaml; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; @@ -256,6 +255,8 @@ public class RestSwaggerSupport { public void renderResourceListing(CamelContext camelContext, RestApiResponseAdapter response, BeanConfig swaggerConfig, String contextId, String route, boolean json, boolean yaml, Map<String, Object> headers, ClassResolver classResolver, RestConfiguration configuration) throws Exception { + ObjectMapper mapper; + LOG.trace("renderResourceListing"); if (cors) { @@ -284,10 +285,9 @@ public class RestSwaggerSupport { clearVendorExtensions(swagger); } - ObjectMapper mapper = new ObjectMapper(); + mapper = Json.mapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.addMixIn(Response.class, ResponseSchemaMixin.class); byte[] bytes = mapper.writeValueAsBytes(swagger); @@ -308,10 +308,9 @@ public class RestSwaggerSupport { clearVendorExtensions(swagger); } - ObjectMapper mapper = new ObjectMapper(); + mapper = Yaml.mapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.addMixIn(Response.class, ResponseSchemaMixin.class); byte[] jsonData = mapper.writeValueAsBytes(swagger);