From 66c7b2f8cc1df19dafb27360569b9216f74c949c Mon Sep 17 00:00:00 2001 From: Kirill Zimnikov Date: Thu, 31 Oct 2024 20:10:07 +0700 Subject: [PATCH] feat cpp-qt-client: fix cast primitive to string (#20000) --- .../src/main/resources/cpp-qt-client/api-body.mustache | 2 +- .../petstore/cpp-qt-addDownloadProgress/client/PFXUserApi.cpp | 4 ++-- samples/client/petstore/cpp-qt/client/PFXUserApi.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache index c58edaf91f57..73b525dcc94c 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache @@ -391,7 +391,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} } fullPath.append(paramString); {{/isPrimitiveType}}{{#isPrimitiveType}} - fullPath.append(QUrl::toPercentEncoding("{{baseName}}")).append(querySuffix).append(QUrl::toPercentEncoding({{paramName}}{{^required}}.stringValue(){{/required}})); + fullPath.append(QUrl::toPercentEncoding("{{baseName}}")).append(querySuffix).append(QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.stringValue(){{/required}}))); {{/isPrimitiveType}} {{/collectionFormat}} {{#collectionFormat}} diff --git a/samples/client/petstore/cpp-qt-addDownloadProgress/client/PFXUserApi.cpp b/samples/client/petstore/cpp-qt-addDownloadProgress/client/PFXUserApi.cpp index 567500c481ba..b0cb7f651048 100644 --- a/samples/client/petstore/cpp-qt-addDownloadProgress/client/PFXUserApi.cpp +++ b/samples/client/petstore/cpp-qt-addDownloadProgress/client/PFXUserApi.cpp @@ -635,7 +635,7 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) { else fullPath.append("?"); - fullPath.append(QUrl::toPercentEncoding("username")).append(querySuffix).append(QUrl::toPercentEncoding(username)); + fullPath.append(QUrl::toPercentEncoding("username")).append(querySuffix).append(QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); } { @@ -650,7 +650,7 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) { else fullPath.append("?"); - fullPath.append(QUrl::toPercentEncoding("password")).append(querySuffix).append(QUrl::toPercentEncoding(password)); + fullPath.append(QUrl::toPercentEncoding("password")).append(querySuffix).append(QUrl::toPercentEncoding(::test_namespace::toStringValue(password))); } PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); diff --git a/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp b/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp index bd854b20594a..78e53081fdee 100644 --- a/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp @@ -635,7 +635,7 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) { else fullPath.append("?"); - fullPath.append(QUrl::toPercentEncoding("username")).append(querySuffix).append(QUrl::toPercentEncoding(username)); + fullPath.append(QUrl::toPercentEncoding("username")).append(querySuffix).append(QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); } { @@ -650,7 +650,7 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) { else fullPath.append("?"); - fullPath.append(QUrl::toPercentEncoding("password")).append(querySuffix).append(QUrl::toPercentEncoding(password)); + fullPath.append(QUrl::toPercentEncoding("password")).append(querySuffix).append(QUrl::toPercentEncoding(::test_namespace::toStringValue(password))); } PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut);