-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove "nullable" in OAS 3.1? #2244
Comments
Now that we allow the Schema Object to allow any unknown property (to enable vocabularies) an instance of a nullable property would not fail validation rules for a 3.1 description. Be warned thought, tooling might not work as expected because the nullable keyword might not be respected. |
Thanks for this and #2246! To confirm, how should an openapi doc describe an object with a property 'foo' that can be string or type: object
properties:
foo:
type: string I couldn't find this described anywhere, and OpenAPI 3.1.0 barely mentions Out of interest, is there any summary of why And fyi you may want to update this proposal about (I maintain an OpenAPI tool and a user has asked about using nullable) Thanks again 😄 |
@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: type: object
properties:
foo:
type: [string, "null"] That's the string |
@rwalle61 also, that |
@handrews perfect, thanks for clarifying! |
Now 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 bothnullable
andtype: "null"
be supported.Should we do this? I'd be happy to write a PR.
The text was updated successfully, but these errors were encountered: