Skip to content

Commit

Permalink
Do not set all reference type schemas as nullable=true, see also #3
Browse files Browse the repository at this point in the history
  • Loading branch information
neiser committed Nov 30, 2020
1 parent 3c29e49 commit 9c4216c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ public class InitialSchemaBuilderForReferenceType implements InitialSchemaBuilde
public InitialSchema buildFromType(JavaType javaType, AnnotationsSupplier annotationsSupplier, Resolver resolver) {
if (javaType.isReferenceType()) {
// TODO append annotationSupplier with contained generic type!
InitialSchema initialSchema = resolver.resolveFromType(javaType.getContentType(), annotationsSupplier);
if (initialSchema != null && initialSchema.getSchema().getNullable() == null) {
// TODO check if all jackson reference types should be considered @Nullable by default
initialSchema.getSchema().setNullable(true);
}
return initialSchema;
return resolver.resolveFromType(javaType.getContentType(), annotationsSupplier);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,7 @@
"operationId": "getMappingWithOptionalString",
"responses": {
"200": {
"description": "Default response",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/nullable_string"
}
}
}
"$ref": "#/components/responses/200"
}
}
}
Expand Down

0 comments on commit 9c4216c

Please sign in to comment.