Skip to content

Commit 703b7c8

Browse files
author
Marcin Zarebski
committed
use MethodParameter#isOptional() instead of checking for Optional type
Check for whether a parameter is required now uses isOptional() method. This improves integration with JSR-305 annotations and Kotlin nullability.
1 parent 7f82a76 commit 703b7c8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/core/AbstractRequestBuilder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ private Parameter buildParams(ParameterInfo parameterInfo, Components components
279279

280280
}
281281
else if (requestParam != null && !parameterBuilder.isFile(parameterInfo.getParameter())) {
282-
boolean isOptional = Optional.class.equals(methodParameter.getParameterType());
283-
requestInfo = new RequestInfo(ParameterIn.QUERY.toString(), requestParam.value(), requestParam.required() && !isOptional,
282+
requestInfo = new RequestInfo(ParameterIn.QUERY.toString(), requestParam.value(), requestParam.required() && !methodParameter.isOptional(),
284283
requestParam.defaultValue());
285284
parameter = buildParam(parameterInfo, components, requestInfo, jsonView);
286285
}

0 commit comments

Comments
 (0)