Skip to content

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

@Thaulino

Description

@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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions