From 4c2a98123051638ab78fe8d0956f96dd6c5b60df Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 13 Apr 2022 10:22:37 +0800 Subject: [PATCH] [C++][Qt] update petstore to 3.0 spec (#12124) * test update sampels * update samples * add file --- bin/configs/cpp-qt-client.yaml | 2 +- .../test/resources/3_0/cpp-qt/petstore.yaml | 692 ++++++++++++++++++ pom.xml | 2 +- samples/client/petstore/cpp-qt/README.md | 4 +- .../petstore/cpp-qt/client/PFXPetApi.cpp | 16 +- .../client/petstore/cpp-qt/client/PFXPetApi.h | 8 +- .../petstore/cpp-qt/client/PFXStoreApi.cpp | 8 +- .../petstore/cpp-qt/client/PFXStoreApi.h | 4 +- .../petstore/cpp-qt/client/PFXUserApi.cpp | 30 +- .../petstore/cpp-qt/client/PFXUserApi.h | 16 +- 10 files changed, 737 insertions(+), 45 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/cpp-qt/petstore.yaml diff --git a/bin/configs/cpp-qt-client.yaml b/bin/configs/cpp-qt-client.yaml index 14f4a2745003..26f46eae4aeb 100644 --- a/bin/configs/cpp-qt-client.yaml +++ b/bin/configs/cpp-qt-client.yaml @@ -1,6 +1,6 @@ generatorName: cpp-qt-client outputDir: samples/client/petstore/cpp-qt -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/cpp-qt/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/cpp-qt-client additionalProperties: cppNamespace: test_namespace diff --git a/modules/openapi-generator/src/test/resources/3_0/cpp-qt/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/cpp-qt/petstore.yaml new file mode 100644 index 000000000000..7a2627ee86fc --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/cpp-qt/petstore.yaml @@ -0,0 +1,692 @@ +openapi: 3.0.0 +info: + description: This is a sample server Petstore server. For this sample, you can use the + api key `special-key` to test the authorization filters. + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user +paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + put: + tags: + - pet + summary: Update an existing pet + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + style: form + explode: false + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + responses: + "200": + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: "#/components/schemas/Pet" + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Pet" + "400": + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: Multiple tags can be provided with comma separated strings. Use tag1, + tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + style: form + explode: false + schema: + type: array + items: + type: string + responses: + "200": + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: "#/components/schemas/Pet" + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Pet" + "400": + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + deprecated: true + "/pet/{petId}": + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + "200": + description: successful operation + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: "" + operationId: updatePetWithForm + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + delete: + tags: + - pet + summary: Deletes a pet + description: "" + operationId: deletePet + parameters: + - name: api_key + in: header + required: false + schema: + type: string + - name: petId + in: path + description: Pet id to delete + required: true + schema: + type: integer + format: int64 + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + "/pet/{petId}/uploadImage": + post: + tags: + - pet + summary: uploads an image + description: "" + operationId: uploadFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + type: string + format: binary + responses: + "200": + description: successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + security: + - petstore_auth: + - write:pets + - read:pets + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + description: successful operation + content: + application/json: + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + description: successful operation + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + "400": + description: Invalid Order + "/store/order/{orderId}": + get: + tags: + - store + summary: Find purchase order by ID + description: For valid response try integer IDs with value <= 5 or > 10. Other values + will generated exceptions + operationId: getOrderById + parameters: + - name: orderId + in: path + description: ID of pet that needs to be fetched + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 5 + responses: + "200": + description: successful operation + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + "400": + description: Invalid ID supplied + "404": + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: For valid response try integer IDs with value < 1000. Anything above + 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - name: orderId + in: path + description: ID of the order that needs to be deleted + required: true + schema: + type: string + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: "" + operationId: loginUser + parameters: + - name: username + in: query + description: The user name for login + required: true + schema: + type: string + - name: password + in: query + description: The password for login in clear text + required: true + schema: + type: string + responses: + "200": + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + type: integer + format: int32 + X-Expires-After: + description: date in UTC when token expires + schema: + type: string + format: date-time + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + "400": + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + "/user/{username}": + get: + tags: + - user + summary: Get user by user name + description: "" + operationId: getUserByName + parameters: + - name: username + in: path + description: The name that needs to be fetched. Use user1 for testing. + required: true + schema: + type: string + responses: + "200": + description: successful operation + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + "400": + description: Invalid username supplied + "404": + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + schema: + type: string + responses: + "400": + description: Invalid username supplied + "404": + description: User not found +servers: + - url: http://petstore.swagger.io/v2 +components: + requestBodies: + UserArray: + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/User" + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + api_key: + type: apiKey + name: api_key + in: header + schemas: + Order: + title: Pet Order + description: An order for a pets from the pet store + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + title: Pet category + description: A category for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Category + User: + title: a User + description: A User who is purchasing from the pet store + type: object + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + title: Pet Tag + description: A tag for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + title: a Pet + description: A pet for sale in the pet store + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + category: + $ref: "#/components/schemas/Category" + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: "#/components/schemas/Tag" + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + title: An uploaded response + description: Describes the result of uploading an image resource + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string diff --git a/pom.xml b/pom.xml index 603295c6f16e..ade8cc5e2c12 100644 --- a/pom.xml +++ b/pom.xml @@ -1125,6 +1125,7 @@ + samples/client/petstore/cpp-qt samples/client/petstore/php/OpenAPIClient-php @@ -1146,7 +1147,6 @@ - samples/client/petstore/cpp-qt samples/client/petstore/rust samples/client/petstore/rust/reqwest/petstore samples/client/petstore/rust/reqwest/petstore-async diff --git a/samples/client/petstore/cpp-qt/README.md b/samples/client/petstore/cpp-qt/README.md index 9bb1fbd58b1a..7700fd41b82a 100644 --- a/samples/client/petstore/cpp-qt/README.md +++ b/samples/client/petstore/cpp-qt/README.md @@ -66,8 +66,8 @@ void Example::exampleFunction1(){ loop.quit(); }); - PFXPet body = create(); // PFXPet | Pet object that needs to be added to the store - apiInstance.addPet(body); + PFXPet pfx_pet = create(); // PFXPet | Pet object that needs to be added to the store + apiInstance.addPet(pfx_pet); QTimer::singleShot(5000, &loop, &QEventLoop::quit); loop.exec(); } diff --git a/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp b/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp index 7d577df67c52..584b77042dd4 100644 --- a/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp @@ -226,7 +226,7 @@ QString PFXPetApi::getParamStyleDelimiter(const QString &style, const QString &n } } -void PFXPetApi::addPet(const PFXPet &body) { +void PFXPetApi::addPet(const PFXPet &pfx_pet) { QString fullPath = QString(_serverConfigs["addPet"][_serverIndices.value("addPet")].URL()+"/pet"); PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); @@ -236,7 +236,7 @@ void PFXPetApi::addPet(const PFXPet &body) { { - QByteArray output = body.asJson().toUtf8(); + QByteArray output = pfx_pet.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) @@ -326,7 +326,7 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const ::test_namespace::Optional QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = ""; + QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); @@ -806,7 +806,7 @@ void PFXPetApi::getPetById(const qint64 &pet_id) { QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = ""; + QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); @@ -861,7 +861,7 @@ void PFXPetApi::getPetByIdCallback(PFXHttpRequestWorker *worker) { } } -void PFXPetApi::updatePet(const PFXPet &body) { +void PFXPetApi::updatePet(const PFXPet &pfx_pet) { QString fullPath = QString(_serverConfigs["updatePet"][_serverIndices.value("updatePet")].URL()+"/pet"); PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); @@ -871,7 +871,7 @@ void PFXPetApi::updatePet(const PFXPet &body) { { - QByteArray output = body.asJson().toUtf8(); + QByteArray output = pfx_pet.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) @@ -961,7 +961,7 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const ::test_namespace:: QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = ""; + QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); @@ -1071,7 +1071,7 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const ::test_namespace::Optiona QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = ""; + QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); diff --git a/samples/client/petstore/cpp-qt/client/PFXPetApi.h b/samples/client/petstore/cpp-qt/client/PFXPetApi.h index 9fc00dd6d3cf..0f05e6cb7469 100644 --- a/samples/client/petstore/cpp-qt/client/PFXPetApi.h +++ b/samples/client/petstore/cpp-qt/client/PFXPetApi.h @@ -59,9 +59,9 @@ class PFXPetApi : public QObject { QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** - * @param[in] body PFXPet [required] + * @param[in] pfx_pet PFXPet [required] */ - void addPet(const PFXPet &body); + void addPet(const PFXPet &pfx_pet); /** * @param[in] pet_id qint64 [required] @@ -85,9 +85,9 @@ class PFXPetApi : public QObject { void getPetById(const qint64 &pet_id); /** - * @param[in] body PFXPet [required] + * @param[in] pfx_pet PFXPet [required] */ - void updatePet(const PFXPet &body); + void updatePet(const PFXPet &pfx_pet); /** * @param[in] pet_id qint64 [required] diff --git a/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp b/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp index e9b868dc0376..efb2c5de46ef 100644 --- a/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp @@ -226,7 +226,7 @@ void PFXStoreApi::deleteOrder(const QString &order_id) { QString order_idPathParam("{"); order_idPathParam.append("orderId").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = ""; + QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); @@ -350,7 +350,7 @@ void PFXStoreApi::getOrderById(const qint64 &order_id) { QString order_idPathParam("{"); order_idPathParam.append("orderId").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = ""; + QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); @@ -405,7 +405,7 @@ void PFXStoreApi::getOrderByIdCallback(PFXHttpRequestWorker *worker) { } } -void PFXStoreApi::placeOrder(const PFXOrder &body) { +void PFXStoreApi::placeOrder(const PFXOrder &pfx_order) { QString fullPath = QString(_serverConfigs["placeOrder"][_serverIndices.value("placeOrder")].URL()+"/store/order"); PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); @@ -415,7 +415,7 @@ void PFXStoreApi::placeOrder(const PFXOrder &body) { { - QByteArray output = body.asJson().toUtf8(); + QByteArray output = pfx_order.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) diff --git a/samples/client/petstore/cpp-qt/client/PFXStoreApi.h b/samples/client/petstore/cpp-qt/client/PFXStoreApi.h index 037ef2f4d2f9..43bf25f4ea51 100644 --- a/samples/client/petstore/cpp-qt/client/PFXStoreApi.h +++ b/samples/client/petstore/cpp-qt/client/PFXStoreApi.h @@ -71,9 +71,9 @@ class PFXStoreApi : public QObject { void getOrderById(const qint64 &order_id); /** - * @param[in] body PFXOrder [required] + * @param[in] pfx_order PFXOrder [required] */ - void placeOrder(const PFXOrder &body); + void placeOrder(const PFXOrder &pfx_order); private: diff --git a/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp b/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp index e60d3acd1c10..c19978bd6126 100644 --- a/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp @@ -226,7 +226,7 @@ QString PFXUserApi::getParamStyleDelimiter(const QString &style, const QString & } } -void PFXUserApi::createUser(const PFXUser &body) { +void PFXUserApi::createUser(const PFXUser &pfx_user) { QString fullPath = QString(_serverConfigs["createUser"][_serverIndices.value("createUser")].URL()+"/user"); PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); @@ -236,7 +236,7 @@ void PFXUserApi::createUser(const PFXUser &body) { { - QByteArray output = body.asJson().toUtf8(); + QByteArray output = pfx_user.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) @@ -278,7 +278,7 @@ void PFXUserApi::createUserCallback(PFXHttpRequestWorker *worker) { } } -void PFXUserApi::createUsersWithArrayInput(const QList &body) { +void PFXUserApi::createUsersWithArrayInput(const QList &pfx_user) { QString fullPath = QString(_serverConfigs["createUsersWithArrayInput"][_serverIndices.value("createUsersWithArrayInput")].URL()+"/user/createWithArray"); PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); @@ -287,7 +287,7 @@ void PFXUserApi::createUsersWithArrayInput(const QList &body) { PFXHttpRequestInput input(fullPath, "POST"); { - QJsonDocument doc(::test_namespace::toJsonValue(body).toArray()); + QJsonDocument doc(::test_namespace::toJsonValue(pfx_user).toArray()); QByteArray bytes = doc.toJson(); input.request_body.append(bytes); } @@ -330,7 +330,7 @@ void PFXUserApi::createUsersWithArrayInputCallback(PFXHttpRequestWorker *worker) } } -void PFXUserApi::createUsersWithListInput(const QList &body) { +void PFXUserApi::createUsersWithListInput(const QList &pfx_user) { QString fullPath = QString(_serverConfigs["createUsersWithListInput"][_serverIndices.value("createUsersWithListInput")].URL()+"/user/createWithList"); PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); @@ -339,7 +339,7 @@ void PFXUserApi::createUsersWithListInput(const QList &body) { PFXHttpRequestInput input(fullPath, "POST"); { - QJsonDocument doc(::test_namespace::toJsonValue(body).toArray()); + QJsonDocument doc(::test_namespace::toJsonValue(pfx_user).toArray()); QByteArray bytes = doc.toJson(); input.request_body.append(bytes); } @@ -390,7 +390,7 @@ void PFXUserApi::deleteUser(const QString &username) { QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = ""; + QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); @@ -452,7 +452,7 @@ void PFXUserApi::getUserByName(const QString &username) { QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = ""; + QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); @@ -513,12 +513,12 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) { QString queryPrefix, querySuffix, queryDelimiter, queryStyle; { - queryStyle = ""; + queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); - queryDelimiter = getParamStyleDelimiter(queryStyle, "username", false); + queryDelimiter = getParamStyleDelimiter(queryStyle, "username", true); if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else @@ -528,12 +528,12 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) { } { - queryStyle = ""; + queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); - queryDelimiter = getParamStyleDelimiter(queryStyle, "password", false); + queryDelimiter = getParamStyleDelimiter(queryStyle, "password", true); if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else @@ -636,7 +636,7 @@ void PFXUserApi::logoutUserCallback(PFXHttpRequestWorker *worker) { } } -void PFXUserApi::updateUser(const QString &username, const PFXUser &body) { +void PFXUserApi::updateUser(const QString &username, const PFXUser &pfx_user) { QString fullPath = QString(_serverConfigs["updateUser"][_serverIndices.value("updateUser")].URL()+"/user/{username}"); @@ -644,7 +644,7 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &body) { QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = ""; + QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); @@ -660,7 +660,7 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &body) { { - QByteArray output = body.asJson().toUtf8(); + QByteArray output = pfx_user.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) diff --git a/samples/client/petstore/cpp-qt/client/PFXUserApi.h b/samples/client/petstore/cpp-qt/client/PFXUserApi.h index 0fc9a73266e8..4e4b3e1a9f45 100644 --- a/samples/client/petstore/cpp-qt/client/PFXUserApi.h +++ b/samples/client/petstore/cpp-qt/client/PFXUserApi.h @@ -58,19 +58,19 @@ class PFXUserApi : public QObject { QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** - * @param[in] body PFXUser [required] + * @param[in] pfx_user PFXUser [required] */ - void createUser(const PFXUser &body); + void createUser(const PFXUser &pfx_user); /** - * @param[in] body QList [required] + * @param[in] pfx_user QList [required] */ - void createUsersWithArrayInput(const QList &body); + void createUsersWithArrayInput(const QList &pfx_user); /** - * @param[in] body QList [required] + * @param[in] pfx_user QList [required] */ - void createUsersWithListInput(const QList &body); + void createUsersWithListInput(const QList &pfx_user); /** * @param[in] username QString [required] @@ -93,9 +93,9 @@ class PFXUserApi : public QObject { /** * @param[in] username QString [required] - * @param[in] body PFXUser [required] + * @param[in] pfx_user PFXUser [required] */ - void updateUser(const QString &username, const PFXUser &body); + void updateUser(const QString &username, const PFXUser &pfx_user); private: