@@ -294,11 +294,10 @@ private void buildApiResponses(Components components, MethodParameter methodPara
294294 // API Responses at operation and @ApiResponse annotation
295295 for (Map .Entry <String , ApiResponse > entry : apiResponsesOp .entrySet ()) {
296296 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 );
302301 }
303302 }
304303 }
@@ -546,20 +545,21 @@ private Map<String, ApiResponse> getGenericMapResponse(Class<?> beanType) {
546545 * @return the boolean
547546 */
548547 private boolean isValidHttpCode (String httpCode , MethodParameter methodParameter ) {
548+ boolean result = false ;
549549 Set <io .swagger .v3 .oas .annotations .responses .ApiResponse > responseSet = getApiResponses (methodParameter .getMethod ());
550550 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 );
555556 responseSet = new HashSet <>(Arrays .asList (apiOperation .responses ()));
556557 if (isHttpCodePresent (httpCode , responseSet ))
557- return true ;
558+ result = true ;
558559 }
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 ;
563563 }
564564
565565 /**
0 commit comments