We are using SpringDoc OpenAPI with SpingBoot 2.3 and WebFlux and have Swagger UI on top of it (more precisely springdoc-openapi-webflux-ui 1.4.8).
Lately, we noticed that there is no way to differentiate a nullable / optional number (Double) from a primitive (double).
For example, the following class
@With
@Value
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CurrencyBalanceDto {
double balance;
Double hardCapping;
}
Results in the following OpenAPI Schema
"CurrencyBalanceDto": {
"type": "object",
"properties": {
"balance": {
"type": "number",
"format": "double"
},
"hardCapping": {
"type": "number",
"format": "double"
}
}
}
Based on https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaNullable, I would expect the hardCapping property to have "nullable": true