Closed cem closed 4 years ago
Hello @cem ,
Thanks for the question.
As I understand you are interested in adding enum
with possible values for a parameter in swagger-UI.
This must be pretty easy to implement via the additional endpoint info
something like:
ENDPOINT_INFO(getColor) {
...
info->pathParams["color"].description = "Color name";
info->pathParams["color"].enum = {"red", "green", "blue"};
}
ENDPOINT("GET", "/colors/{color}", getColor,
PATH(String, color))
{
mySelfWrittenColorParameterValidation(color); // manually implement color parameter validation.
...
}
As for the automatic validation of this parameter on the endpoint - it's something we need to investigate.
I'll add this to the scope - implement enum field for parameter in EndpointInfo
Regards, Leonid
Hello @cem ,
The support for Enum
is already added in the latest oatpp
and oatpp-swagger
.
Please see the oatpp changelog for details.
ENDPOINT("GET", "/colors/{color}", getColor,
PATH(Enum<Color>, color))
{
// No need to validate color values. All validations are already done.
...
}
Regards, Leonid
Hi. Do you have any plans to support enum types?