swagger-api / swagger-api/swagger-codegen
[C++][pistache-server] include not existing file "Object.h"
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
In the generated file "DefaultApi.h" which includes "Object.h" but the "Object.h" not exist under the root output directory. Here already found the same issue reported in [cpprest] but I really can't find why this file was generated since the spec file is valid. #6512 #6905
Swagger-codegen version
2.4.5
Swagger declaration file content or url
Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
-i swagger.yaml \
-l pistache-server \
-o /auto_code/cpp
Steps to reproduce
The auto generated files:
[root@kongfu cpp]# tree
.
├── api
│ ├── DefaultApi.cpp
│ └── DefaultApi.h
├── CMakeLists.txt
├── DefaultApiMainServer.cpp
├── impl
│ ├── DefaultApiImpl.cpp
│ └── DefaultApiImpl.h
├── model
│ ├── Interface.cpp
│ ├── Interface.h
│ ├── Link.cpp
│ ├── Link.h
│ ├── ModelBase.cpp
│ └── ModelBase.h
└── README.md
The DefaultApiImpl.h which includes "Object.h"
/*
* DefaultApi.h
*
*
*/
#ifndef DefaultApi_H_
#define DefaultApi_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include "Interface.h"
#include "Object.h"
#include <string>
namespace io {
namespace swagger {
namespace server {
namespace api {
using namespace io::swagger::server::model;
class DefaultApi {
Related issues/PRs
Suggest a fix/enhancement
The Object.h should not be generated here?
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 the generated api/DefaultApi.h and the pistache-server generator, then compare the supplied swagger.yaml with the related #6512 issue and #6905 pull request. Reproduce the generation command and trace why DefaultApi.h includes Object.h even though no Object.h is emitted; done means the generated output no longer has the invalid include and builds successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100