You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ferdi Koomen edited this page Dec 21, 2023
·
1 revision
In the OpenAPI v3 spec you can create properties that can be NULL, by providing a nullable: true in your schema.
However, the v2 spec does not allow you to do this. You can use the unofficial x-nullable in your specification
to generate nullable properties in OpenApi v2.
{
"ModelWithNullableString": {
"required": [
"requiredProp"
],
"description": "This is a model with one string property",
"type": "object",
"properties": {
"prop": {
"description": "This is a simple string property",
"type": "string",
"x-nullable": true
},
"requiredProp": {
"description": "This is a simple string property",
"type": "string",
"x-nullable": true
}
}
}
}