@@ -264,7 +264,7 @@ public Operation build(HandlerMethod handlerMethod, RequestMethod requestMethod,
264
264
}
265
265
266
266
if (!isParamToIgnore (methodParameter )) {
267
- parameter = buildParams (parameterInfo , parameters . length , components , requestMethod , methodAttributes .getJsonViewAnnotation ());
267
+ parameter = buildParams (parameterInfo , components , requestMethod , methodAttributes .getJsonViewAnnotation ());
268
268
// Merge with the operation parameters
269
269
parameter = GenericParameterService .mergeParameter (operationParameters , parameter );
270
270
List <Annotation > parameterAnnotations = Arrays .asList (methodParameter .getParameterAnnotations ());
@@ -434,13 +434,12 @@ public boolean isValidParameter(Parameter parameter) {
434
434
* Build params parameter.
435
435
*
436
436
* @param parameterInfo the parameter info
437
- * @param length the length
438
437
* @param components the components
439
438
* @param requestMethod the request method
440
439
* @param jsonView the json view
441
440
* @return the parameter
442
441
*/
443
- public Parameter buildParams (ParameterInfo parameterInfo , int length , Components components ,
442
+ public Parameter buildParams (ParameterInfo parameterInfo , Components components ,
444
443
RequestMethod requestMethod , JsonView jsonView ) {
445
444
MethodParameter methodParameter = parameterInfo .getMethodParameter ();
446
445
if (parameterInfo .getParamType () != null ) {
@@ -451,7 +450,7 @@ public Parameter buildParams(ParameterInfo parameterInfo, int length, Components
451
450
return this .buildParam (parameterInfo , components , jsonView );
452
451
}
453
452
// By default
454
- if (!isRequestBodyParam (requestMethod , parameterInfo , length )) {
453
+ if (!isRequestBodyParam (requestMethod , parameterInfo )) {
455
454
parameterInfo .setRequired (!((DelegatingMethodParameter ) methodParameter ).isNotRequired () && !methodParameter .isOptional ());
456
455
parameterInfo .setParamType (QUERY_PARAM );
457
456
parameterInfo .setDefaultValue (null );
@@ -665,10 +664,9 @@ private void applyValidationsToSchema(Map<String, Annotation> annos, Schema<?> s
665
664
*
666
665
* @param requestMethod the request method
667
666
* @param parameterInfo the parameter info
668
- * @param length the length
669
667
* @return the boolean
670
668
*/
671
- private boolean isRequestBodyParam (RequestMethod requestMethod , ParameterInfo parameterInfo , int length ) {
669
+ private boolean isRequestBodyParam (RequestMethod requestMethod , ParameterInfo parameterInfo ) {
672
670
MethodParameter methodParameter = parameterInfo .getMethodParameter ();
673
671
DelegatingMethodParameter delegatingMethodParameter = (DelegatingMethodParameter ) methodParameter ;
674
672
@@ -677,7 +675,7 @@ private boolean isRequestBodyParam(RequestMethod requestMethod, ParameterInfo pa
677
675
((methodParameter .getParameterAnnotation (io .swagger .v3 .oas .annotations .parameters .RequestBody .class ) != null
678
676
|| methodParameter .getParameterAnnotation (org .springframework .web .bind .annotation .RequestBody .class ) != null
679
677
|| 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 )
681
679
|| (!ClassUtils .isPrimitiveOrWrapper (methodParameter .getParameterType ()) && (!ArrayUtils .isEmpty (methodParameter .getParameterAnnotations ()))));
682
680
}
683
681
0 commit comments