OpenAPITools / OpenAPITools/openapi-generator

[BUG] Generator for cpp-restbed-server fails for vector of vector of floats

Open
#17,006 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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?
Description
openapi-generator version

openapi-generator version 7.0.1
I do not know if this ever worked or if it is a regression. First time we've tried it.

OpenAPI declaration file content or url

Configuration cpp-restbed-server.yaml is plain:

additionalProperties:
  packageName: 'dsk360_restbed'
  packageVersion: '0.0.0'
  apiPackage: 'ds.web.rest.server'
  modelPackage: 'ds.web.rest.models'
Generation Details
Steps to reproduce

curl -s https://gist.github.com/sbarber-dsi/d7658f12c879704b9c8834e0bdd1338d >cpp-restbed-server.yaml
curl -s https://gist.github.com/sbarber-dsi/33d218666a76591cedeaac0a711f417b >openapi.json
openapi-generator-cli generate -g cpp-restbed-server -i openapi.json -c cpp-restbed-server.yaml -o test_api_cpp-restbed-server

Related issues/PRs

I didn't find any

Suggest a fix

The final type of the float is missing; just needs a <double> added.

e.g. generated code

    std::function<std::pair<int, std::vector<std::vector>>(
        )> handler_GET_func =
            []() -> std::pair<int, std::vector<std::vector>>
                { throw TestAtlasApiException(501, "Not implemented"); };

should be

    std::function<std::pair<int, std::vector<std::vector<double>>>(
        )> handler_GET_func =
            []() -> std::pair<int, std::vector<std::vector<double>>>
                { throw TestAtlasApiException(501, "Not implemented"); };

And then it all builds and works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the listed generation command with openapi.json and cpp-restbed-server.yaml, then inspect the generated handler_GET_func declarations in test_api_cpp-restbed-server. Compare the nested vector type with the expected output in the issue and confirm the generated C++ builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, openapi
Domain
backend-api-design, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.