Bug Report Checklist
Description
The generated Api.h file include "Obejct.h" which was not exist
/*
* 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 {
The Obejct.h was not generated and used :
.
├── api
│ ├── DefaultApi.cpp
│ └── DefaultApi.h
├── CMakeLists.txt
├── impl
│ ├── DefaultApiImpl.cpp
│ └── DefaultApiImpl.h
├── main-api-server.cpp
├── model
│ ├── Helpers.cpp
│ ├── Helpers.h
│ ├── InlineResponse200.cpp
│ ├── InlineResponse200.h
│ ├── Interface.cpp
│ ├── Interface.h
│ ├── Link.cpp
│ └── Link.h
└── README.md
openapi-generator version
4.0.0-SNAPSHOT
OpenAPI declaration file content or url
swagger 2.0 but not openapi 3.0.0
swagger: '2.0'
info:
title: REST API
version: v1
basePath: /api/hardware/v1
schemes:
- http
paths:
/vnf/{vnfId}/vm/{vmId}/interface:
parameters:
- in: path
name: vnfId
description: VNF instance Id
required: true
type: string
- in: path
name: vmId
description: VM instance Id
required: true
type: string
post:
summary: Create interface instance under specified VM
description: Create interface
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: interface
description: json containing interface configuration
schema:
$ref: "#/definitions/Interface"
responses:
'200':
description: OK
schema:
properties:
link:
$ref: "#/definitions/Link"
examples:
application/json:
{
"link": {
"rel": "self",
"href": "/vnf/1/vm/1/interface/1"
}
}
'400':
description: Bad request
'404':
description: Not found
default:
description: Unexpected error
definitions:
Link:
title: HATEOAS link
properties:
rel:
description: relation with the link
type: string
example: "self"
href:
description: URIs relative to base URI
type: string
example: "/vnf/1/vm/100/interface/1"
required:
- href
Interface:
title: Interface.
required:
- ipAddress
- name
- type
properties:
ipAddress:
type: string
example: 169.254.0.4
name:
type: string
enum:
- eth0
- eth1
example: eth0
type:
type: string
enum:
- physical
- logical
example: physical
Command line used for generation
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i swagger.yaml \
-g cpp-pistache-server \
-o cpp
Steps to reproduce
Generate the code then check the DefaultApi.h file.
Related issues/PRs
#2338 for C but not for C++
Suggest a fix
Remove the "Object.h" from DefaultApi.h file, maybe i don't know the reason why adding this, could someone point out?
Bug Report Checklist
Description
The generated Api.h file include "Obejct.h" which was not exist
The Obejct.h was not generated and used :
openapi-generator version
4.0.0-SNAPSHOT
OpenAPI declaration file content or url
swagger 2.0 but not openapi 3.0.0
Command line used for generation
Steps to reproduce
Generate the code then check the DefaultApi.h file.
Related issues/PRs
#2338 for C but not for C++
Suggest a fix
Remove the "Object.h" from DefaultApi.h file, maybe i don't know the reason why adding this, could someone point out?