Skip to content

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

@dan-drl

Description

@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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions