OpenAPITools / OpenAPITools/openapi-generator

[C++] Error making the cpprestsdk generated files

Open
#6,726 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: C++ Hacktoberfest help wanted Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

After using the generator as described for cpp-restsdk and trying to make the project, I receive a bunch of errors. (I've been trying all day and only now realised that either I'm doing something really wrong, or the generated code is broken.)

I see the following errors:

[  1%] Building CXX object CMakeFiles/CppRestOpenAPIClient.dir/api/AccountsApi.cpp.o
In file included from /home/mull/code/peertuber/psdk/api/AccountsApi.cpp:13:
/home/mull/code/peertuber/psdk/api/AccountsApi.h:25:10: fatal error: OneOfnumberarray.h: No such file or directory
   25 | #include "OneOfnumberarray.h"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/CppRestOpenAPIClient.dir/build.make:167: CMakeFiles/CppRestOpenAPIClient.dir/api/AccountsApi.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/CppRestOpenAPIClient.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
openapi-generator version

4.3.1

(libcpprest-dev version 2.10.15-1, installed from ubuntu)

OpenAPI declaration file content or url

https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/support/doc/api/openapi.yaml

Command line used for generation
npx @openapitools/openapi-generator-cli generate \
  -i https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/support/doc/api/openapi.yaml \
  -g cpp-restsdk \
  --additional-properties=apiPackage=psdk.api,modelPackage=psdk.model
Steps to reproduce
npx @openapitools/openapi-generator-cli generate \
  -i https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/support/doc/api/openapi.yaml \
  -g cpp-restsdk \
  --additional-properties=apiPackage=psdk.api,modelPackage=psdk.model
cd psdk
cmake -DCPPREST_ROOT=/usr -DCMAKE_CXX_FLAGS="-I/usr/local/opt/openssl/include" -DCMAKE_MODULE_LINKER_FLAGS="-L/usr/local/opt/openssl/lib"
make
Related issues/PRs
Suggest a fix/enhancement

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

Reproduce the failure with the cpp-restsdk generator command and the linked PeerTube openapi.yaml, then inspect the generated api/AccountsApi.h and api/AccountsApi.cpp files and the generated CMake project. Trace why AccountsApi.h includes the missing OneOfnumberarray.h; done means the generated project configures and builds successfully with the stated cmake and make commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
api, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.