cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/3] cxf git commit: [CXF-6990] Sorting tag list before writing out
Date Thu, 04 Aug 2016 09:50:34 GMT
[CXF-6990] Sorting tag list before writing out


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/75ce1c4b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/75ce1c4b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/75ce1c4b

Branch: refs/heads/3.0.x-fixes
Commit: 75ce1c4bd7b08cad5ee0bc8684cd289bba06c975
Parents: 90f9a15
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Thu Aug 4 11:46:38 2016 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Thu Aug 4 11:46:38 2016 +0200

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/75ce1c4b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java
b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java
index c6dcdae..230489c 100644
--- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java
+++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java
@@ -23,6 +23,7 @@ import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -142,6 +143,15 @@ public class Swagger2Serializers extends SwaggerSerializers {
                 }
             }
         }
+        if (replaceTags && data.getTags() != null) {
+            Collections.sort(data.getTags(), new Comparator<Tag>() {
+
+                @Override
+                public int compare(final Tag tag1, final Tag tag2) {
+                    return tag1.getName().compareTo(tag2.getName());
+                }
+            });
+        }
 
         super.writeTo(data, type, genericType, annotations, mediaType, headers, out);
     }


Mime
View raw message