You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ya...@apache.org on 2019/10/25 13:16:11 UTC

[servicecomb-java-chassis] branch master updated: [SCB-1511]when use method override, the generated swagger body is wrong (missed sorting)

This is an automated email from the ASF dual-hosted git repository.

yaohaishi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new 06b7cb8  [SCB-1511]when use method override, the generated swagger body is wrong (missed sorting)
06b7cb8 is described below

commit 06b7cb8f95c7b88bc27f32954ceda082d2334f8a
Author: liubao <bi...@qq.com>
AuthorDate: Wed Oct 16 16:38:35 2019 +0800

    [SCB-1511]when use method override, the generated swagger body is wrong (missed sorting)
---
 .../apache/servicecomb/swagger/generator/core/utils/MethodUtils.java    | 2 +-
 .../org/apache/servicecomb/swagger/generator/core/utils/ParamUtils.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/MethodUtils.java b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/MethodUtils.java
index 196f508..453012f 100644
--- a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/MethodUtils.java
+++ b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/MethodUtils.java
@@ -36,7 +36,7 @@ public class MethodUtils {
       }
     }
 
-    producerMethods.sort(Comparator.comparing(Method::getName));
+    producerMethods.sort(Comparator.comparing(ParamUtils::findSwaggerMethodName));
     return producerMethods;
   }
 
diff --git a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/ParamUtils.java b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/ParamUtils.java
index 768ef69..f10d6e0 100644
--- a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/ParamUtils.java
+++ b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/ParamUtils.java
@@ -163,7 +163,7 @@ public final class ParamUtils {
     return findSwaggerMethodName(method)  + "Body";
   }
 
-  protected static String findSwaggerMethodName(Method consumerMethod) {
+  public static String findSwaggerMethodName(Method consumerMethod) {
     ApiOperation apiOperationAnnotation = consumerMethod.getAnnotation(ApiOperation.class);
     if (apiOperationAnnotation == null || StringUtils.isEmpty(apiOperationAnnotation.nickname())) {
       return consumerMethod.getName();