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
  • #11951
Closed
Open
Issue created Mar 23, 2022 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] [Qt5][Cpp] Unique items in schema lead to error

Created by: Thaulino

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?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

If an array with unique items exists in the schema the generated code does not compile. Because the data is stored in a QSet and output.append is caleld which is not present instead output.insert should be called

openapi-generator version

5.4.0.

OpenAPI declaration file content or url

Attached as file.

Generation Details

(Ubuntu 20.0) java -jar openapi-generator-cli-5.4.0.jar generate -i unique_petstore.json -g cpp-qt-client -o unique_petstore

Steps to reproduce

Generate client via generator for cpp qt cmake -S . -B \build cmake --build \build

Following error should appear:

/home/thi/Projects/Github/oai-cpp-qt-client/unique_petstore/client/OAIPetsApi.cpp:388:16: error: ‘class QSet<OpenAPI::OAIPet>’ has no member named ‘append’  
  388 |         output.append(val);  
      |                ^~~~~~  
make[2]: *** [client/CMakeFiles/client.dir/build.make:105: client/CMakeFiles/client.dir/OAIPetsApi.cpp.o] Error 1  
make[2]: Leaving directory '/home/thi/Projects/Github/oai-cpp-qt-client/unique_petstore/build'  
make[1]: *** [CMakeFiles/Makefile2:98: client/CMakeFiles/client.dir/all] Error 2  
Suggest a fix

Coming soon

unique_petstore.txt

Assignee
Assign to
Time tracking