@@ -264,7 +264,7 @@ public Operation build(HandlerMethod handlerMethod, RequestMethod requestMethod,
264264 }
265265
266266 if (!isParamToIgnore (methodParameter )) {
267- parameter = buildParams (parameterInfo , parameters . length , components , requestMethod , methodAttributes .getJsonViewAnnotation ());
267+ parameter = buildParams (parameterInfo , components , requestMethod , methodAttributes .getJsonViewAnnotation ());
268268 // Merge with the operation parameters
269269 parameter = GenericParameterService .mergeParameter (operationParameters , parameter );
270270 List <Annotation > parameterAnnotations = Arrays .asList (methodParameter .getParameterAnnotations ());
@@ -434,13 +434,12 @@ public boolean isValidParameter(Parameter parameter) {
434434 * Build params parameter.
435435 *
436436 * @param parameterInfo the parameter info
437- * @param length the length
438437 * @param components the components
439438 * @param requestMethod the request method
440439 * @param jsonView the json view
441440 * @return the parameter
442441 */
443- public Parameter buildParams (ParameterInfo parameterInfo , int length , Components components ,
442+ public Parameter buildParams (ParameterInfo parameterInfo , Components components ,
444443 RequestMethod requestMethod , JsonView jsonView ) {
445444 MethodParameter methodParameter = parameterInfo .getMethodParameter ();
446445 if (parameterInfo .getParamType () != null ) {
@@ -451,7 +450,7 @@ public Parameter buildParams(ParameterInfo parameterInfo, int length, Components
451450 return this .buildParam (parameterInfo , components , jsonView );
452451 }
453452 // By default
454- if (!isRequestBodyParam (requestMethod , parameterInfo , length )) {
453+ if (!isRequestBodyParam (requestMethod , parameterInfo )) {
455454 parameterInfo .setRequired (!((DelegatingMethodParameter ) methodParameter ).isNotRequired () && !methodParameter .isOptional ());
456455 parameterInfo .setParamType (QUERY_PARAM );
457456 parameterInfo .setDefaultValue (null );
@@ -665,10 +664,9 @@ private void applyValidationsToSchema(Map<String, Annotation> annos, Schema<?> s
665664 *
666665 * @param requestMethod the request method
667666 * @param parameterInfo the parameter info
668- * @param length the length
669667 * @return the boolean
670668 */
671- private boolean isRequestBodyParam (RequestMethod requestMethod , ParameterInfo parameterInfo , int length ) {
669+ private boolean isRequestBodyParam (RequestMethod requestMethod , ParameterInfo parameterInfo ) {
672670 MethodParameter methodParameter = parameterInfo .getMethodParameter ();
673671 DelegatingMethodParameter delegatingMethodParameter = (DelegatingMethodParameter ) methodParameter ;
674672
@@ -677,7 +675,7 @@ private boolean isRequestBodyParam(RequestMethod requestMethod, ParameterInfo pa
677675 ((methodParameter .getParameterAnnotation (io .swagger .v3 .oas .annotations .parameters .RequestBody .class ) != null
678676 || methodParameter .getParameterAnnotation (org .springframework .web .bind .annotation .RequestBody .class ) != null
679677 || methodParameter .getParameterAnnotation (org .springframework .web .bind .annotation .RequestPart .class ) != null
680- || methodParameter .getMethod (). getAnnotation ( io .swagger .v3 .oas .annotations .parameters .RequestBody .class ) !=null )
678+ || AnnotatedElementUtils . findMergedAnnotation ( Objects . requireNonNull ( methodParameter .getMethod ()), io .swagger .v3 .oas .annotations .parameters .RequestBody .class ) != null )
681679 || (!ClassUtils .isPrimitiveOrWrapper (methodParameter .getParameterType ()) && (!ArrayUtils .isEmpty (methodParameter .getParameterAnnotations ()))));
682680 }
683681
0 commit comments