Skip to content

Commit 06b7cb8

Browse files
liubao68yhs0092
authored andcommitted
[SCB-1511]when use method override, the generated swagger body is wrong (missed sorting)
1 parent 433e8a5 commit 06b7cb8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/MethodUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static List<Method> findProducerMethods(Class<?> cls) {
3636
}
3737
}
3838

39-
producerMethods.sort(Comparator.comparing(Method::getName));
39+
producerMethods.sort(Comparator.comparing(ParamUtils::findSwaggerMethodName));
4040
return producerMethods;
4141
}
4242

swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/ParamUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public static String generateBodyParameterName(Method method) {
163163
return findSwaggerMethodName(method) + "Body";
164164
}
165165

166-
protected static String findSwaggerMethodName(Method consumerMethod) {
166+
public static String findSwaggerMethodName(Method consumerMethod) {
167167
ApiOperation apiOperationAnnotation = consumerMethod.getAnnotation(ApiOperation.class);
168168
if (apiOperationAnnotation == null || StringUtils.isEmpty(apiOperationAnnotation.nickname())) {
169169
return consumerMethod.getName();

0 commit comments

Comments
 (0)