Closed neptunecentury closed 1 month ago
how are you providing ur dataType based on the OpenAPI version there are two ways to provide how the nulls
are defined
OpenAPI 2.0
null
OpenAPI - 3.0
type: string
nullable: true
OpenAPI - 3.1
type: ['null', string]
or
oneOf:
- type: 'null'
- type: string
In addition to that there are languages such as JavaScript where null
is an object
too
so depending on various combinations the renderer may be talking multiple code paths and that might have resulted into how it is being rendered.
but there is no semantic difference between object or null
and string | null
Our spec is 3.0 and our Schema has a property that looks something like this:
"MyObjectPropertyName": {
"description": "Some desc...",
"nullable": true,
"allOf": [
{
"$ref": "#/components/schemas/SomeOtherObjectType"
}
]
}
The explorer will show the type as "object or null" Just curious why it is that way vs
"MyStringPropertyName": {
"type": "string",
"description": "Some desc about the property",
"nullable": true
}
This property will be displayed as "string | null"
Thanks again
I noticed something interesting in the schema table, where it mentions the data type and whether or not it can accept null. It seems that for most types, it is shown as
note the pipe character. But for objects, its listed as:
Note the use of or instead of |. Is there a meaning behind the difference? Is there a way to make it all the same, (like make them all use | (pipe))? Image for reference.
Thanks for any insights!