camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/7] camel git commit: CAMEL-9732: camel-swagger-java - Issue in appendModels in the reader
Date Mon, 21 Mar 2016 16:01:24 GMT
CAMEL-9732: camel-swagger-java - Issue in appendModels in the reader


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9735a523
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9735a523
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9735a523

Branch: refs/heads/camel-2.17.x
Commit: 9735a523dfb8e72bdf5ddd1be15143c7c0ca2c24
Parents: 9dcb021
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Mar 21 16:52:43 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Mar 21 16:56:35 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/swagger/RestSwaggerReader.java | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9735a523/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
----------------------------------------------------------------------
diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
index 08c0a2d..dc7bfeb 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
@@ -506,7 +506,16 @@ public class RestSwaggerReader {
         RestModelConverters converters = new RestModelConverters();
         final Map<String, Model> models = converters.readClass(clazz);
         for (Map.Entry<String, Model> entry : models.entrySet()) {
-            swagger.model(entry.getKey(), entry.getValue());
+
+            // favor keeping any existing model that has the vendor extension in the model
+            boolean oldExt = false;
+            if (swagger.getDefinitions() != null && swagger.getDefinitions().get(entry.getKey())
!= null) {
+                oldExt = swagger.getDefinitions().get(entry.getKey()).getVendorExtensions().get("x-className")
== null;
+            }
+
+            if (!oldExt) {
+                swagger.model(entry.getKey(), entry.getValue());
+            }
         }
     }
 


Mime
View raw message