Due to the removal of nullable: true from schema in 3.1.0, it appears that the nullable = true property on the @Schema annotation no longer works. That isn't obvious in the documentation for the annotation, and it's inconvenient to boot ;-)
I think it will be quite easy to continue to support the nullable attribute under 3.1.0, I suggest a little change to Schema.getTypes:
@OpenAPI31
public Set<String> getTypes() {
if (types != null) {
if (nullable != null && nullable.booleanValue()) {
Set<String> ss = new LinkedHashSet<>(types);
ss.add("null");
return ss;
} else {
return types;
}
} else {
return null;
}
}
We simply add "null" to the list of types if the schema is nullable... which ends up nicely in the schema output.
I'm happy to make a PR of this, or a better suggestion, or I'd love to know if this is more like the wrong approach!
Due to the removal of
nullable: truefrom schema in 3.1.0, it appears that thenullable = trueproperty on the@Schemaannotation no longer works. That isn't obvious in the documentation for the annotation, and it's inconvenient to boot ;-)I think it will be quite easy to continue to support the
nullableattribute under 3.1.0, I suggest a little change toSchema.getTypes:We simply add
"null"to the list of types if the schema is nullable... which ends up nicely in the schema output.I'm happy to make a PR of this, or a better suggestion, or I'd love to know if this is more like the wrong approach!