Skip to content
New issue

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

cpp-restsdk incorrectly handles object properties containing dash/minus ("-") character #12289

Closed
5 of 6 tasks
kesheshyan opened this issue May 3, 2022 · 0 comments
Closed
5 of 6 tasks

Comments

@kesheshyan
Copy link
Contributor

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
    Compilable C++ code
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
OpenAPI declaration file content or url
{
  "openapi": "3.0.0",
  "components": {
    "schemas": {
      "StringMap": {
        "type": "object",
        "properties": {
          "zh-Hans": {
            "type": "string",
            "description": "Text in Chinese (Simplified)."
          },
      }
    }
  }
}
Description

Generator: cpp-restsdk-client
Produces uncompilable code if there is a "-" (or other characters like a space etc.) in a property name of an object.

if(multipart->hasContent(utility::conversions::to_string_t(U("zh-Hant"))))
{
    utility::string_t refVal_zh-Hant;
    ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("zh-Hant"))), refVal_zh-Hant );
    setZhHant(refVal_zh-Hant);
}
Suggest a fix

#12288

Resulting cpp code looks like this:

 if(multipart->hasContent(utility::conversions::to_string_t(U("zh-Hant"))))
{
    utility::string_t refVal_setZhHant;
    ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("zh-Hant"))), refVal_setZhHant );
    setZhHant(refVal_setZhHant);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants