Skip to content

Commit e792cea

Browse files
committed
Fix Schema get condition of ArraySchema. Fixes springdoc#2199
1 parent 992065f commit e792cea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service/GenericParameterService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ private void setSchema(io.swagger.v3.oas.annotations.Parameter parameterDoc, Com
334334
catch (Exception e) {
335335
LOGGER.warn(Constants.GRACEFUL_EXCEPTION_OCCURRED, e);
336336
}
337-
if (schema == null) {
337+
if (schema == null && parameterDoc.array() != null) {
338338
schema = AnnotationsUtils.getSchema(parameterDoc.schema(), parameterDoc.array(), true, parameterDoc.array().schema().implementation(), components, jsonView).orElse(null);
339339
// default value not set by swagger-core for array !
340340
if (schema != null) {
@@ -366,7 +366,7 @@ Schema calculateSchema(Components components, ParameterInfo parameterInfo, Reque
366366
WebConversionServiceProvider webConversionServiceProvider = optionalWebConversionServiceProvider.get();
367367
if (!MethodParameterPojoExtractor.isSwaggerPrimitiveType((Class) type) && methodParameter.getParameterType().getAnnotation(io.swagger.v3.oas.annotations.media.Schema.class) == null) {
368368
Class<?> springConvertedType = webConversionServiceProvider.getSpringConvertedType(methodParameter.getParameterType());
369-
if (!(String.class.equals(springConvertedType) && ((Class<?>) type).isEnum()) && requestBodyInfo==null)
369+
if (!(String.class.equals(springConvertedType) && ((Class<?>) type).isEnum()) && requestBodyInfo == null)
370370
type = springConvertedType;
371371
}
372372
}

0 commit comments

Comments
 (0)