[C++][cpp-restsdk] ModelBase.h should be included. Compilation failed
Created by: CyrilleBenard
Description
The generator does not include the ModelBase.h file whereas it generates code that uses a method that is defined in it (see toJson, toHttpContent, ... etc)
The compilation error looks like :
/home/xxxx/dev/amf/impl-ms1/src/client/client-ms2/gen-cpp/api/Stair1Api.cpp: In member function ‘pplx::task<std::__cxx11::basic_string<char> > com::bcom::amf::microservice::client::ms2::api::Stair1Api::checkGeneration(utility::string_t)’:
/home/xxxx/dev/amf/impl-ms1/src/client/client-ms2/gen-cpp/api/Stair1Api.cpp:98:24: error: ‘ModelBase’ has not been declared
localVarJson = ModelBase::toJson(body);
^
/home/xxxx/dev/amf/impl-ms1/src/client/client-ms2/gen-cpp/api/Stair1Api.cpp:107:32: error: ‘ModelBase’ has not been declared
localVarMultipart->add(ModelBase::toHttpContent("body", body));
^
/home/xxxx/dev/amf/impl-ms1/src/client/client-ms2/gen-cpp/api/Stair1Api.cpp: In lambda function:
/home/xxxx/dev/amf/impl-ms1/src/client/client-ms2/gen-cpp/api/Stair1Api.cpp:155:30: error: ‘ModelBase’ has not been declared
localVarResult = ModelBase::stringFromJson(localVarJson);
^
CMakeFiles/client-ms2.dir/build.make:254: recipe for target 'CMakeFiles/client-ms2.dir/api/Stair1Api.cpp.o' failed
openapi-generator version
Current master : 3.3.1-SNAPSHOT
OpenAPI declaration file content or url
openapi: 3.0.0
info:
version: 1.0.0
title: Check generation of string + pattern
description: Internal ref filename is check_include_ModelBase_cpprest.yaml
servers:
- url: http://localhost:8080
paths:
/stair1:
post:
summary: blabla
operationId: check_generation
tags:
- Stair1
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Content'
required: true
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
type: string
default:
description: Unexpected error
components:
schemas:
Content:
type: string
Command line used for generation
Generate :
openapi-generator-cli.sh generate -i ./openapi.yaml -g cpp-restsdk -c ./config.json -o gen-cpp
Compile :
mkdir -p obj ; cd obj ; cmake -D CPPREST_ROOT=/usr/ ../gen-cpp ; make ; cd ..
Steps to reproduce
Generate & Compile
Related issues/PRs
N/A