camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [6/6] camel git commit: swagger java should skip null tags in model
Date Fri, 30 Oct 2015 16:12:02 GMT
swagger java should skip null tags in model


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

Branch: refs/heads/camel-2.16.x
Commit: 85391f67e3008e9af6307bd2c56008a05e061ba6
Parents: 98a2ae2
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Oct 30 15:15:41 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Oct 30 17:14:27 2015 +0100

----------------------------------------------------------------------
 .../apache/camel/swagger/RestSwaggerReader.java  | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/85391f67/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 66b3634..bb30433 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
@@ -25,7 +25,6 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
-import io.swagger.converter.ModelConverters;
 import io.swagger.jaxrs.config.BeanConfig;
 import io.swagger.models.Model;
 import io.swagger.models.ModelImpl;
@@ -98,11 +97,13 @@ public class RestSwaggerReader {
         String pathAsTag = rest.getTag() != null ? rest.getTag() : FileUtil.stripLeadingSeparator(rest.getPath());
         String summary = rest.getDescriptionText();
 
-        // add rest as tag
-        Tag tag = new Tag();
-        tag.description(summary);
-        tag.name(pathAsTag);
-        swagger.addTag(tag);
+        if (ObjectHelper.isNotEmpty(pathAsTag)) {
+            // add rest as tag
+            Tag tag = new Tag();
+            tag.description(summary);
+            tag.name(pathAsTag);
+            swagger.addTag(tag);
+        }
 
         // gather all types in use
         Set<String> types = new LinkedHashSet<>();
@@ -142,8 +143,10 @@ public class RestSwaggerReader {
             String opPath = SwaggerHelper.buildUrl(basePath, verb.getUri());
 
             Operation op = new Operation();
-            // group in the same tag
-            op.addTag(pathAsTag);
+            if (ObjectHelper.isNotEmpty(pathAsTag)) {
+                // group in the same tag
+                op.addTag(pathAsTag);
+            }
 
             // add id as vendor extensions
             op.getVendorExtensions().put("x-camelContextId", camelContextId);


Mime
View raw message