@@ -294,11 +294,10 @@ private void buildApiResponses(Components components, MethodParameter methodPara
294
294
// API Responses at operation and @ApiResponse annotation
295
295
for (Map .Entry <String , ApiResponse > entry : apiResponsesOp .entrySet ()) {
296
296
String httpCode = entry .getKey ();
297
- if (!genericMapResponse .containsKey (httpCode )) {
298
- if (!methodAttributes .isMethodOverloaded () || (methodAttributes .isMethodOverloaded () && isValidHttpCode (httpCode , methodParameter ))) {
299
- ApiResponse apiResponse = entry .getValue ();
300
- buildApiResponses (components , methodParameter , apiResponsesOp , methodAttributes , httpCode , apiResponse , false );
301
- }
297
+ boolean methodAttributesCondition = !methodAttributes .isMethodOverloaded () || (methodAttributes .isMethodOverloaded () && isValidHttpCode (httpCode , methodParameter ));
298
+ if (!genericMapResponse .containsKey (httpCode ) && methodAttributesCondition ) {
299
+ ApiResponse apiResponse = entry .getValue ();
300
+ buildApiResponses (components , methodParameter , apiResponsesOp , methodAttributes , httpCode , apiResponse , false );
302
301
}
303
302
}
304
303
}
@@ -546,20 +545,21 @@ private Map<String, ApiResponse> getGenericMapResponse(Class<?> beanType) {
546
545
* @return the boolean
547
546
*/
548
547
private boolean isValidHttpCode (String httpCode , MethodParameter methodParameter ) {
548
+ boolean result = false ;
549
549
Set <io .swagger .v3 .oas .annotations .responses .ApiResponse > responseSet = getApiResponses (methodParameter .getMethod ());
550
550
if (isHttpCodePresent (httpCode , responseSet ))
551
- return true ;
552
- io .swagger .v3 .oas .annotations .Operation apiOperation = AnnotatedElementUtils .findMergedAnnotation (methodParameter .getMethod (),
553
- io .swagger .v3 .oas .annotations .Operation .class );
554
- if (apiOperation != null ) {
551
+ result = true ;
552
+ else if (AnnotatedElementUtils .findMergedAnnotation (methodParameter .getMethod (),
553
+ io .swagger .v3 .oas .annotations .Operation .class ) != null ) {
554
+ io .swagger .v3 .oas .annotations .Operation apiOperation = AnnotatedElementUtils .findMergedAnnotation (methodParameter .getMethod (),
555
+ io .swagger .v3 .oas .annotations .Operation .class );
555
556
responseSet = new HashSet <>(Arrays .asList (apiOperation .responses ()));
556
557
if (isHttpCodePresent (httpCode , responseSet ))
557
- return true ;
558
+ result = true ;
558
559
}
559
- String httpCode1 = evaluateResponseStatus (methodParameter .getMethod (), methodParameter .getMethod ().getClass (), false );
560
- if (httpCode .equals (httpCode1 ))
561
- return true ;
562
- return false ;
560
+ else if (httpCode .equals (evaluateResponseStatus (methodParameter .getMethod (), methodParameter .getMethod ().getClass (), false )))
561
+ result = true ;
562
+ return result ;
563
563
}
564
564
565
565
/**
0 commit comments