[cpp-pistache-server] Enumerations not generated
Created by: brianwaters3
Description
Currently the enumeration definition below generates a class with no members. The attached file archive.zip contains a complete definition (with several enumerations) that demonstrate this problem.
openapi-generator version
v 3.3.0
OpenAPI declaration file content or url
SupportedGADShapes:
anyOf:
- type: string
enum:
- POINT
- POINT_UNCERTAINTY_CIRCLE
- POINT_UNCERTAINTY_ELLIPSE
- POLYGON
- POINT_ALTITUDE
- POINT_ALTITUDE_UNCERTAINTY
- ELLIPSOID_ARC
- type: string
Command line used for generation
java -jar /home/brian/code/git/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i updated/TS29122_MonitoringEvent.yaml -g cpp-pistache-server --config config -o ./code/MonitoringEvent/server/cpp-pistache-server
Steps to reproduce
- Create a blank working directory
- Unzip Archive.zip to the newly created directory.
- Generate the source using the provided command making path adjustments for your system.
- The class SupportedGADShapes in ./code/MonitoringEvent/server/cpp-pistache-server/model/SupportedGADShapes.h has no members.
Related issues/PRs
Suggest a fix/enhancement
The attached file SupportedGADShapes.zip contains the .h and .cpp definitions for the enumeration. Note that an enumeration named "INVALID" has been added in the header and is used when no default is specified.
SupportedGADShapes.cpp-pistache-server.zip
...
/////////////////////////////////////////////
/// SupportedGADShapes members
enum eSupportedGADShapes
{
INVALID,
POINT,
POINT_UNCERTAINTY_CIRCLE,
POINT_UNCERTAINTY_ELLIPSE,
POLYGON,
POINT_ALTITUDE,
POINT_ALTITUDE_UNCERTAINTY,
ELLIPSOID_ARC
};
eSupportedGADShapes getValue() const;
void setValue(eSupportedGADShapes const value);
protected:
eSupportedGADShapes m_value;
...
...
nlohmann::json SupportedGADShapes::toJson() const
{
nlohmann::json val;
switch (m_value)
{
case eSupportedGADShapes::POINT: val = "POINT"; break;
case eSupportedGADShapes::POINT_UNCERTAINTY_CIRCLE: val = "POINT_UNCERTAINTY_CIRCLE"; break;
case eSupportedGADShapes::POINT_UNCERTAINTY_ELLIPSE: val = "POINT_UNCERTAINTY_ELLIPSE"; break;
case eSupportedGADShapes::POLYGON: val = "POLYGON"; break;
case eSupportedGADShapes::POINT_ALTITUDE: val = "POINT_ALTITUDE"; break;
case eSupportedGADShapes::POINT_ALTITUDE_UNCERTAINTY: val = "POINT_ALTITUDE_UNCERTAINTY"; break;
case eSupportedGADShapes::ELLIPSOID_ARC: val = "ELLIPSOID_ARC"; break;
default: val = "INVALID"; break;
}
return val;
}
void SupportedGADShapes::fromJson(nlohmann::json& val)
{
auto s = val.get<std::string>();
m_value =
(s == "POINT") ? eSupportedGADShapes::POINT :
(s == "POINT_UNCERTAINTY_CIRCLE") ? eSupportedGADShapes::POINT_UNCERTAINTY_CIRCLE :
(s == "POINT_UNCERTAINTY_ELLIPSE") ? eSupportedGADShapes::POINT_UNCERTAINTY_ELLIPSE :
(s == "POLYGON") ? eSupportedGADShapes::POLYGON :
(s == "POINT_ALTITUDE") ? eSupportedGADShapes::POINT_ALTITUDE :
(s == "POINT_ALTITUDE_UNCERTAINTY") ? eSupportedGADShapes::POINT_ALTITUDE_UNCERTAINTY :
(s == "ELLIPSOID_ARC") ? eSupportedGADShapes::ELLIPSOID_ARC :
eSupportedGADShapes::INVALID;
}
SupportedGADShapes::eSupportedGADShapes SupportedGADShapes::getValue() const
{
return m_value;
}
void SupportedGADShapes::setValue(SupportedGADShapes::eSupportedGADShapes const value)
{
m_value = value;
}
...