cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [1/3] cxf git commit: [CXF-6990] Sorting tag list before writing out
Date Thu, 04 Aug 2016 09:50:33 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 90f9a1555 -> 75ce1c4bd
  refs/heads/3.1.x-fixes fd958fdbc -> 2bc15f89b
  refs/heads/master bacef091c -> 764008097


[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/2bc15f89
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2bc15f89
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2bc15f89

Branch: refs/heads/3.1.x-fixes
Commit: 2bc15f89b93716aeaa7c37fc650a177408257a98
Parents: fd958fd
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Thu Aug 4 11:38:43 2016 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Thu Aug 4 11:38:43 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/2bc15f89/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java
----------------------------------------------------------------------
diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java
index e6f7be2..ae6dc27 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java
+++ b/rt/rs/description-swagger/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;
@@ -141,6 +142,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