You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dm...@apache.org on 2019/03/20 12:04:52 UTC

[camel] branch master updated: CAMEL-13340: Invalid swagger json/yaml generated for Rest DSL

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

commit f6fde21efb81b5cd1c451562c8e1e7a730527844
Author: Dmitry Volodin <dm...@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 42a738e..4f0968a 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,10 +37,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;
@@ -285,6 +287,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;
@@ -307,6 +311,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