Why is multiple types shown in a bad way in Swagger UI
I have the following open api schema:
WaypointEntity:
type: object
properties:
id:
type: [number, "null"]
But it's not shown correctly in Swagger UI:
Any idea why that is? AmI specifying the types incorrectly? I'm using Open Api 3.0
Solution 1:
In OpenAPI 3.0, type
cannot be a list of types, it must be a single type. A nullable number is defined like this:
id:
type: number
nullable: true # <----
More info: How to define a property that can be string or null in OpenAPI?