We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Components: title: Components enum: - Components_1 - Components_2 - Components_4 type: string description: An enumeration.
cpprestsdk code generated for the model shown above:
#include "Components.h" namespace org { namespace openapitools { namespace client { namespace model { Components::Components() { } Components::~Components() { } void Components::validate() { // TODO: implement validation } web::json::value Components::toJson() const { web::json::value val = web::json::value::object(); if (m_value == eComponents::Components__1) val = web::json::value::string(U(Components_1)); if (m_value == eComponents::Components__2) val = web::json::value::string(U(Components_2)); if (m_value == eComponents::Components__4) val = web::json::value::string(U(Components_4)); return val; } bool Components::fromJson(const web::json::value& val) { auto s = val.as_string(); if (s == utility::conversions::to_string_t(Components_1)) m_value = eComponents::Components__1; if (s == utility::conversions::to_string_t(Components_2)) m_value = eComponents::Components__2; if (s == utility::conversions::to_string_t(Components_4)) m_value = eComponents::Components__4; return true; } void Components::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) { namePrefix += utility::conversions::to_string_t("."); } utility::string_t s; if (m_value == eComponents::Components__1) s = utility::conversions::to_string_t(Components_1); if (m_value == eComponents::Components__2) s = utility::conversions::to_string_t(Components_2); if (m_value == eComponents::Components__4) s = utility::conversions::to_string_t(Components_4); multipart->add(ModelBase::toHttpContent(namePrefix, s)); } bool Components::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) { bool ok = true; utility::string_t namePrefix = prefix; if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) { namePrefix += utility::conversions::to_string_t("."); } { utility::string_t s; ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), s); eComponents v; if (s == utility::conversions::to_string_t(Components_1)) v = eComponents::Components__1; if (s == utility::conversions::to_string_t(Components_2)) v = eComponents::Components__2; if (s == utility::conversions::to_string_t(Components_4)) v = eComponents::Components__4; setValue(v); } return ok; } Components::eComponents Components::getValue() const { return m_value; } void Components::setValue(Components::eComponents const value) { m_value = value; } } } } }
Code like shown blows is not valid C++ code:
if (m_value == eComponents::Components__1) s = utility::conversions::to_string_t(Components_1);
and the valid code would be:
if (m_value == eComponents::Components__1) s = utility::conversions::to_string_t("Components_1");
I was able to reproduce it with the 5.2.1-SNAPSHOT version
I've used docker for the generating C++ code:
docker run -it -v MY_LOCAL_PATH:/local --network host --rm openapitools/openapi-generator-cli generate -i /local/openapi.json -g cpp-restsdk -o /local/generated
The text was updated successfully, but these errors were encountered:
Should be fixed by #10531
Sorry, something went wrong.
No branches or pull requests
Bug Report Checklist
Description
cpprestsdk code generated for the model shown above:
Code like shown blows is not valid C++ code:
and the valid code would be:
openapi-generator version
I was able to reproduce it with the 5.2.1-SNAPSHOT version
OpenAPI declaration file content or url
Generation Details
I've used docker for the generating C++ code:
Steps to reproduce
Related issues/PRs
Suggest a fix
Code like shown blows is not valid C++ code:
and the valid code would be:
The text was updated successfully, but these errors were encountered: