swagger-api / swagger-api/swagger-codegen
[C++][pistache] wrong code generated with the current pistache version due a namespace mismatch
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When I try to compile the generated code it give me the following error:
swagger-codegen/samples/server/petstore/pistache-server/api/PetApi.h:82:57: error: ‘Optional’ does not name a type
virtual void delete_pet(const int64_t &petId, const Optional<Net::Http::Header::Raw> &apiKey, Pistache::Http::ResponseWriter &response) = 0;
Swagger-codegen version
2.4
Swagger declaration file content or url
Command line used for generation
./bin/pistache-server-petstore.sh
Steps to reproduce
- Install pistache (https://github.com/oktal/pistache)
- copy json.hpp (from https://github.com/nlohmann/json) to model directory (samples/server/petstore/pistache-server/model)
- mkdir build && cd build
- cmake ..
- make
Related issues/PRs
Suggest a fix/enhancement
Optional namespace has changed. Now it is Pistache::Optional.
Also Http::Header::Raw has change from Net::Http::Header::Raw to Pistache::Http::Header::Raw
With this patch the code generated compiles.
https://github.com/migarma/swagger-codegen/commit/1bb0f0d2f150b012ae249b5d5378034425b061d9#diff-2c140be9bcc3e3a733ac044a8a10992b
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with samples/server/petstore/pistache-server/api/PetApi.h and run ./bin/pistache-server-petstore.sh, then follow the cmake and make reproduction steps. Compare the generated Pistache namespace references with the current Pistache version and the linked patch. Done means the generated petstore server compiles successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100