RapiDoc
RapiDoc copied to clipboard
New possibility to add enums with labels through oneof
As discussed in this Stackoverflow thread there is no way to create enums with labels out of the box (like enums of integers for some configurations). The simplest workaround is to use a oneOf with constant values.
As show below, displayed with rapidoc this leads in a very confusing documentation :
Openapi schema sample
{
"format": "int32",
"oneOf": [
{
"const": 0,
"format": "int32",
"title": "LAST_UPDATED_SOURCE_NOT_SET",
"type": "const"
},
{
"const": 1,
"format": "int32",
"title": "BIKE_GPS",
"type": "const",
"description": "some description"
},
{
"const": 2,
"format": "int32",
"title": "APP_DATA",
"type": "const",
"description": "some other description"
}]
}
Therefore I implemented a more suited way to display a one iff it contains only constant values :
Hope you find this convincing 😉