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 072d3ce  CAMEL-13340: Invalid swagger json/yaml generated for Rest DSL
072d3ce is described below

commit 072d3ce3d18d973d4ddd8078f016818f472326a6
Author: Dmitry Volodin <dmvo...@gmail.com>
AuthorDate: Thu Mar 21 19:11:42 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 249faa3..7104fe8 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,14 +31,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.Exchange;
 import org.apache.camel.model.ModelHelper;
@@ -205,6 +204,8 @@ public class RestSwaggerSupport {
 
     public void renderResourceListing(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) {
@@ -225,10 +226,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);
 
@@ -247,10 +247,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);
 

Reply via email to