Closed
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
Header parameters don't get included in requests made by cpp-qt5-client
because of a mistake in the Mustache template file for the API client:
input.headers.insert("{{baseName}}", "{{paramName}}");
should be input.headers.insert("{{baseName}}", {{paramName}});
.
openapi-generator version
Docker Hub, latest
OpenAPI declaration file content or url
openapi: 3.0.0
info:
description: Test
version: 0.0.1
title: Test
tags:
- name: test
description: test
paths:
/test:
get:
tags:
- test
summary: test
operationId: test
parameters:
- in: header
name: TestHeader
schema:
type: string
responses:
"200":
description: successful operation
Command line used for generation
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:latest generate -i /local/api.yaml -g cpp-qt5-client -o /local/out
Steps to reproduce
Generate a C++ QT5 client using the above docker run
command.
${PWD}/out/client/OAITestAPI.cpp
will contain:
void
OAITestApi::test(const QString& test_header) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/test");
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker();
OAIHttpRequestInput input(fullPath, "GET");
if (test_header != nullptr) {
input.headers.insert("TestHeader", "test_header");
}
foreach(QString key, this->defaultHeaders.keys()) {
input.headers.insert(key, this->defaultHeaders.value(key));
}
connect(worker,
&OAIHttpRequestWorker::on_execution_finished,
this,
&OAITestApi::testCallback);
worker->execute(&input);
}
Expected output:
if (test_header != nullptr) {
input.headers.insert("TestHeader", test_header);
}