Remove "nullable" in OAS 3.1?
See original GitHub issueNow that we have decided to discard SemVer (see PR #2243), IIRC it briefly came up on the last call that we could outright drop nullable
instead of requiring that both nullable
and type: "null"
be supported.
Should we do this? I’d be happy to write a PR.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to define a property that can be string or null in OpenAPI ...
The nullable keyword used in OAS 3.0.x (see below) does not exist in OAS 3.1, it was removed in favor of the 'null'...
Read more >Migrating from OpenAPI 3.0 to 3.1.0
Swap nullable for type arrays. In line with JSON Schema, the `type` keyword can now define multiple types for a schema with an...
Read more >OpenAPI Specification - Version 3.0.3 - Swagger
The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and ...
Read more >Using Optional and Nullable Properties in API Requests
OpenAPI supports values of data types to be null. To specify, one can use the “nullable: true” property while defining a data type...
Read more >What's New in OpenAPI 3.1 | LornaJane - Lorna Jane Mitchell
This does impact on existing OpenAPI documents as from 3.1, the nullable keyword is removed – use the array of types and one...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rwalle61 it’s not much mentioned because it’s covered by JSON Schema and OAS 3.1 tries to avoid duplicating the JSON Schema spec unless it is needed to explain how JSON Schema and OAS-specific concepts interact.
What you are looking for is:
That’s the string
"null"
, not the valuenull
. The string"null"
is the name of the type of the valuenull
. The values in thetype
array can be in any order.Thanks for this and https://github.com/OAI/OpenAPI-Specification/pull/2246!
To confirm, how should an openapi doc describe an object with a property ‘foo’ that can be string or
null
- just like this?I couldn’t find this described anywhere, and OpenAPI 3.1.0 barely mentions
null
.Out of interest, is there any summary of why
null
has been removed since OpenAPI 3.0.3?And fyi you may want to update this proposal about
nullable
to clarify that it was rejected 😃(I maintain an OpenAPI tool and a user has asked about using nullable)
Thanks again 😄