Closed
Description
Current situation
Nullable types are very common in JSON world.
In order to make a type nullable either you have to add "null"
to the types array or use oneOf
{ "type": ["string", "null"] }
{ "oneOf": [ { "type": "string" }, { "type": "null" } ] }
Rationale
I believe this approach of making a type nullable is not very intuitive 1.
At least one other specification (OpenAPI) supports an extension of the JSON schema spec that includes the nullable
property2.
I suggest adding this nullable: boolean
property to the JSON schema spec as a more intuitive and less verbose way of making types nullable.
1 https://stackoverflow.com/search?q=json+schema+nullable
2 https://swagger.io/specification/#fixed-fields-20
Metadata
Metadata
Assignees
Labels
No labels