mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
[cpp-restbed-server] Allow to implement validation of input data for enumerations (#7717)
* Allow to implement validation of input data for enumerations * Regen petstore sample
This commit is contained in:
committed by
GitHub
parent
0b6d70d351
commit
bb6785ad70
@@ -123,6 +123,8 @@ void Order::setStatus(std::string value)
|
||||
{
|
||||
if (std::find(m_StatusEnum.begin(), m_StatusEnum.end(), value) != m_StatusEnum.end()) {
|
||||
m_Status = value;
|
||||
} else {
|
||||
throw std::runtime_error("Value " + value + " not allowed");
|
||||
}
|
||||
}
|
||||
bool Order::isComplete() const
|
||||
|
||||
@@ -161,6 +161,8 @@ void Pet::setStatus(std::string value)
|
||||
{
|
||||
if (std::find(m_StatusEnum.begin(), m_StatusEnum.end(), value) != m_StatusEnum.end()) {
|
||||
m_Status = value;
|
||||
} else {
|
||||
throw std::runtime_error("Value " + value + " not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user