We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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:
cpp-qt5-client
openapi-generator/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache
Lines 102 to 106 in c6c477f
input.headers.insert("{{baseName}}", "{{paramName}}"); should be input.headers.insert("{{baseName}}", {{paramName}});.
input.headers.insert("{{baseName}}", "{{paramName}}");
input.headers.insert("{{baseName}}", {{paramName}});
Docker Hub, latest
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
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:latest generate -i /local/api.yaml -g cpp-qt5-client -o /local/out
Generate a C++ QT5 client using the above docker run command.
docker run
${PWD}/out/client/OAITestAPI.cpp will contain:
${PWD}/out/client/OAITestAPI.cpp
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); }
The text was updated successfully, but these errors were encountered:
👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.
The team will review the labels and make any necessary changes.
Sorry, something went wrong.
Added PR.
No branches or pull requests
Bug Report Checklist
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:openapi-generator/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache
Lines 102 to 106 in c6c477f
input.headers.insert("{{baseName}}", "{{paramName}}");
should beinput.headers.insert("{{baseName}}", {{paramName}});
.openapi-generator version
Docker Hub, latest
OpenAPI declaration file content or url
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:Expected output:
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: