Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #3886
Closed
Open
Issue created Sep 13, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[C++][cpp-restsdk][BUG] Templating variable x-codegen-response-ishttpcontent not being set correctly

Created by: dan-drl

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

When it code gens runs on this spec the result is does not compile because HttpContent has no fromJson method.

    .then([=](utility::string_t localVarResponse)
    {

        // 

        std::shared_ptr<HttpContent> localVarResult(nullptr);

        if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
        {
            web::json::value localVarJson = web::json::value::parse(localVarResponse);

            localVarResult->fromJson(localVarJson);
        }
        // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
        // {
        // TODO multipart response parsing
        // }
        else
        {
            throw ApiException(500
                , utility::conversions::to_string_t("error calling getAccountingDocumentFile: unsupported response type"));
        }

        return localVarResult;
        
    });
openapi-generator version

Fails in 4.1.3-SNAPSHOT and also validated it fails in 4.1.0.

OpenAPI declaration file content or url

https://gist.github.com/dan-drl/11e55dfc8602cb9a45b1f64a50f71ba7

Command line used for generation

java -jar openapi-generator-cli.jar generate -i openapi.json -g cpp-restsdk -o src\Test --model-package Test

Steps to reproduce

Download gist, and run command above.

Related issues/PRs

I didn't notice any, however, I wasn't quite sure what to search for. I wouldn't be suprised if there are other issues caused by x-codegen-response-ishttpcontent not being set correctly.

Suggest a fix

I'll be issuing a PR shorlty.

Assignee
Assign to
Time tracking