diff --git a/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/operation/parameter/customizer/DefaultOperationParameterDeprecatedCustomizer.java b/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/operation/parameter/customizer/DefaultOperationParameterDeprecatedCustomizer.java index 89931ff3..81a4e05c 100644 --- a/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/operation/parameter/customizer/DefaultOperationParameterDeprecatedCustomizer.java +++ b/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/operation/parameter/customizer/DefaultOperationParameterDeprecatedCustomizer.java @@ -25,7 +25,6 @@ public class DefaultOperationParameterDeprecatedCustomizer implements OperationParameterCustomizer { @Override public void customize(de.qaware.openapigeneratorforspring.model.parameter.Parameter parameter, OperationParameterCustomizerContext context) { - // TODO combine with other places where @Deprecated is checked? context.getHandlerMethodParameter() .map(HasAnnotationsSupplier::getAnnotationsSupplier) .flatMap(annotationsSupplier -> annotationsSupplier.findAnnotations(Deprecated.class).findFirst()) diff --git a/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/operation/parameter/customizer/DefaultOperationParameterNullableCustomizer.java b/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/operation/parameter/customizer/DefaultOperationParameterNullableCustomizer.java index 82e3ca52..b88da45e 100644 --- a/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/operation/parameter/customizer/DefaultOperationParameterNullableCustomizer.java +++ b/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/operation/parameter/customizer/DefaultOperationParameterNullableCustomizer.java @@ -28,19 +28,15 @@ public class DefaultOperationParameterNullableCustomizer implements OperationParameterCustomizer { @Override public void customize(de.qaware.openapigeneratorforspring.model.parameter.Parameter parameter, OperationParameterCustomizerContext context) { - context.getHandlerMethodParameter().ifPresent(handlerMethodParameter -> { - // TODO support more @Nullable / @NotNull annotations? combine with other places where @Nullable is checked? - handlerMethodParameter.getAnnotationsSupplier() - .findAnnotations(Nullable.class).findFirst().ifPresent(ignored -> { - Boolean required = parameter.getRequired(); - if (required != null && required) { - LOGGER.warn("{} in {} marked as required but annotated as @Nullable. Ignoring annotation.", - parameter, context.getOperationInfo()); - } else { - // TODO is this always right to explicitly set it to false? - parameter.setRequired(false); - } - }); + context.getHandlerMethodParameter().flatMap(handlerMethodParameter -> handlerMethodParameter.getAnnotationsSupplier() + .findAnnotations(Nullable.class).findFirst()).ifPresent(ignored -> { + if (Boolean.TRUE.equals(parameter.getRequired())) { + LOGGER.warn("{} in {} marked as required but annotated as @Nullable. Ignoring annotation.", + parameter, context.getOperationInfo()); + } else { + // TODO is this always right to explicitly set it to false? + parameter.setRequired(false); + } }); } } diff --git a/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/schema/customizer/SchemaCustomizerForNullable.java b/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/schema/customizer/SchemaCustomizerForNullable.java index 19215289..5474a8f2 100644 --- a/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/schema/customizer/SchemaCustomizerForNullable.java +++ b/openapi-generator-for-spring-common/src/main/java/de/qaware/openapigeneratorforspring/common/schema/customizer/SchemaCustomizerForNullable.java @@ -29,7 +29,6 @@ public class SchemaCustomizerForNullable implements SchemaCustomizer { @Override public void customize(Schema schema, JavaType javaType, AnnotationsSupplier annotationsSupplier) { - // TODO support more @Nullable annotations? annotationsSupplier.findAnnotations(Nullable.class) .findFirst().ifPresent(ignored -> schema.setNullable(true)); }