Skip to content

Commit

Permalink
Replace TODO with GH Issue #3
Browse files Browse the repository at this point in the history
  • Loading branch information
neiser committed Nov 30, 2020
1 parent 8428d1d commit 2faed51
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 2faed51

Please sign in to comment.