From 6c8bd6b83ecf7e3aa8375046e6bcef22dfa8b0e4 Mon Sep 17 00:00:00 2001 From: stmeyer Date: Fri, 25 Aug 2017 12:35:56 +0200 Subject: [PATCH] [QT5CPP] General Improvements (#6315) * - check C++ keywords - setter for SSL configuration * recreate example QT5CPP * only emit error signal if error happens * provide more error information * regenerate example QT5CPP * * use reserved words in abstract cpp generator * update CppRest examples * remove tabs --- .../codegen/languages/AbstractCppCodegen.java | 86 +++++++++++++++++++ .../codegen/languages/Qt5CPPGenerator.java | 16 ++-- .../resources/qt5cpp/HttpRequest.cpp.mustache | 13 +-- .../resources/qt5cpp/HttpRequest.h.mustache | 1 + .../main/resources/qt5cpp/api-body.mustache | 8 +- .../main/resources/qt5cpp/api-header.mustache | 2 + .../petstore/cpprest/.swagger-codegen/VERSION | 2 +- samples/client/petstore/cpprest/ApiClient.cpp | 2 +- samples/client/petstore/cpprest/ApiClient.h | 2 +- .../petstore/cpprest/ApiConfiguration.cpp | 2 +- .../petstore/cpprest/ApiConfiguration.h | 2 +- .../client/petstore/cpprest/ApiException.cpp | 2 +- .../client/petstore/cpprest/ApiException.h | 2 +- .../client/petstore/cpprest/HttpContent.cpp | 2 +- samples/client/petstore/cpprest/HttpContent.h | 2 +- samples/client/petstore/cpprest/IHttpBody.h | 2 +- samples/client/petstore/cpprest/JsonBody.cpp | 2 +- samples/client/petstore/cpprest/JsonBody.h | 2 +- samples/client/petstore/cpprest/ModelBase.cpp | 2 +- samples/client/petstore/cpprest/ModelBase.h | 2 +- .../petstore/cpprest/MultipartFormData.cpp | 2 +- .../petstore/cpprest/MultipartFormData.h | 2 +- .../client/petstore/cpprest/api/PetApi.cpp | 2 +- samples/client/petstore/cpprest/api/PetApi.h | 2 +- .../client/petstore/cpprest/api/StoreApi.cpp | 2 +- .../client/petstore/cpprest/api/StoreApi.h | 2 +- .../client/petstore/cpprest/api/UserApi.cpp | 2 +- samples/client/petstore/cpprest/api/UserApi.h | 2 +- .../petstore/cpprest/model/ApiResponse.cpp | 2 +- .../petstore/cpprest/model/ApiResponse.h | 2 +- .../petstore/cpprest/model/Category.cpp | 2 +- .../client/petstore/cpprest/model/Category.h | 2 +- .../client/petstore/cpprest/model/Order.cpp | 2 +- samples/client/petstore/cpprest/model/Order.h | 2 +- samples/client/petstore/cpprest/model/Pet.cpp | 2 +- samples/client/petstore/cpprest/model/Pet.h | 2 +- samples/client/petstore/cpprest/model/Tag.cpp | 2 +- samples/client/petstore/cpprest/model/Tag.h | 2 +- .../client/petstore/cpprest/model/User.cpp | 2 +- samples/client/petstore/cpprest/model/User.h | 2 +- .../petstore/qt5cpp/.swagger-codegen/VERSION | 2 +- .../{ApiResponse.cpp => SWGApiResponse.cpp} | 34 ++++---- .../{ApiResponse.h => SWGApiResponse.h} | 18 ++-- .../client/{Category.cpp => SWGCategory.cpp} | 30 +++---- .../client/{Category.h => SWGCategory.h} | 18 ++-- .../petstore/qt5cpp/client/SWGHttpRequest.cpp | 13 +-- .../petstore/qt5cpp/client/SWGHttpRequest.h | 1 + .../petstore/qt5cpp/client/SWGModelFactory.h | 36 ++++---- .../qt5cpp/client/{Order.cpp => SWGOrder.cpp} | 46 +++++----- .../qt5cpp/client/{Order.h => SWGOrder.h} | 18 ++-- .../qt5cpp/client/{Pet.cpp => SWGPet.cpp} | 66 +++++++------- .../qt5cpp/client/{Pet.h => SWGPet.h} | 34 ++++---- .../petstore/qt5cpp/client/SWGPetApi.cpp | 80 +++++++++++------ .../client/petstore/qt5cpp/client/SWGPetApi.h | 33 ++++--- .../petstore/qt5cpp/client/SWGStoreApi.cpp | 41 ++++++--- .../petstore/qt5cpp/client/SWGStoreApi.h | 17 ++-- .../qt5cpp/client/{Tag.cpp => SWGTag.cpp} | 30 +++---- .../qt5cpp/client/{Tag.h => SWGTag.h} | 18 ++-- .../qt5cpp/client/{User.cpp => SWGUser.cpp} | 54 ++++++------ .../qt5cpp/client/{User.h => SWGUser.h} | 18 ++-- .../petstore/qt5cpp/client/SWGUserApi.cpp | 74 +++++++++++----- .../petstore/qt5cpp/client/SWGUserApi.h | 23 +++-- 62 files changed, 547 insertions(+), 351 deletions(-) rename samples/client/petstore/qt5cpp/client/{ApiResponse.cpp => SWGApiResponse.cpp} (77%) rename samples/client/petstore/qt5cpp/client/{ApiResponse.h => SWGApiResponse.h} (79%) rename samples/client/petstore/qt5cpp/client/{Category.cpp => SWGCategory.cpp} (78%) rename samples/client/petstore/qt5cpp/client/{Category.h => SWGCategory.h} (79%) rename samples/client/petstore/qt5cpp/client/{Order.cpp => SWGOrder.cpp} (79%) rename samples/client/petstore/qt5cpp/client/{Order.h => SWGOrder.h} (85%) rename samples/client/petstore/qt5cpp/client/{Pet.cpp => SWGPet.cpp} (72%) rename samples/client/petstore/qt5cpp/client/{Pet.h => SWGPet.h} (72%) rename samples/client/petstore/qt5cpp/client/{Tag.cpp => SWGTag.cpp} (82%) rename samples/client/petstore/qt5cpp/client/{Tag.h => SWGTag.h} (82%) rename samples/client/petstore/qt5cpp/client/{User.cpp => SWGUser.cpp} (81%) rename samples/client/petstore/qt5cpp/client/{User.h => SWGUser.h} (87%) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCppCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCppCodegen.java index 672b80eff38..874d42f05af 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCppCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCppCodegen.java @@ -5,8 +5,94 @@ import io.swagger.codegen.CodegenProperty; import io.swagger.codegen.DefaultCodegen; import io.swagger.models.properties.Property; +import java.util.Arrays; + abstract public class AbstractCppCodegen extends DefaultCodegen implements CodegenConfig { + public AbstractCppCodegen() { + super(); + + /* + * Reserved words. Override this with reserved words specific to your language + */ + setReservedWordsLowerCase( + Arrays.asList( + "auto", + "break", + "case", + "char", + "const", + "continue", + "default", + "do", + "double", + "else", + "enum", + "extern", + "float", + "for", + "goto", + "if", + "int", + "long", + "register", + "return", + "short", + "signed", + "sizeof", + "static", + "struct", + "switch", + "typedef", + "union", + "unsigned", + "void", + "volatile", + "while", + "asm", + "bool", + "catch", + "class", + "const_cast", + "delete", + "dynamic_cast", + "explicit", + "false", + "friend", + "inline", + "mutable", + "namespace", + "new", + "operator", + "private", + "public", + "protected", + "reinterpret_cast", + "static_cast", + "template", + "this", + "throw", + "true", + "try", + "typeid", + "typename", + "using", + "virtual", + "wchar_t", + "and", + "and_eq", + "bitand", + "bitor", + "compl", + "not", + "not_eq", + "or", + "or_eq", + "xor", + "xor_eq") + ); + } + @Override public String toVarName(String name) { if (typeMapping.keySet().contains(name) || typeMapping.values().contains(name) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java index 89c77195ed1..a2a7c9d559d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java @@ -23,7 +23,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { +public class Qt5CPPGenerator extends AbstractCppCodegen implements CodegenConfig { public static final String CPP_NAMESPACE = "cppNamespace"; public static final String CPP_NAMESPACE_DESC = "C++ namespace (convention: name::space::for::api)."; @@ -42,6 +42,11 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { // set the output folder here outputFolder = "generated-code/qt5cpp"; + // set modelNamePrefix as default for QT5CPP + if (modelNamePrefix == "") { + modelNamePrefix = PREFIX; + } + /* * Models. You can write model files using the modelTemplateFiles map. * if you want to create one template for file, you can do so here. @@ -78,15 +83,6 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { // CLI options addOption(CPP_NAMESPACE, CPP_NAMESPACE_DESC, this.cppNamespace); - /* - * Reserved words. Override this with reserved words specific to your language - */ - setReservedWordsLowerCase( - Arrays.asList( - "sample1", // replace with static values - "sample2") - ); - /* * Additional Properties. These values can be passed to the templates and * are available in models, apis, and supporting files diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache index 998defc4828..8f042bcf0c8 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache @@ -253,6 +253,9 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { // prepare connection QNetworkRequest request = QNetworkRequest(QUrl(input->url_str)); + if (HttpRequestWorker::sslDefaultConfiguration != nullptr) { + request.setSslConfiguration(*HttpRequestWorker::sslDefaultConfiguration); + } request.setRawHeader("User-Agent", "Swagger-Client"); foreach(QString key, input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); @@ -300,17 +303,15 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { void HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { error_type = reply->error(); - if (error_type == QNetworkReply::NoError) { - response = reply->readAll(); - } - else { - error_str = reply->errorString(); - } + response = reply->readAll(); + error_str = reply->errorString(); reply->deleteLater(); emit on_execution_finished(this); } +QSslConfiguration* HttpRequestWorker::sslDefaultConfiguration; + {{#cppNamespaceDeclarations}} } diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.h.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.h.mustache index 71beb69d41f..4351b48a43c 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.h.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.h.mustache @@ -64,6 +64,7 @@ public: QString http_attribute_encode(QString attribute_name, QString input); void execute(HttpRequestInput *input); + static QSslConfiguration* sslDefaultConfiguration; signals: void on_execution_finished(HttpRequestWorker *worker); diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache index f454a58fb29..a451eaa8275 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache @@ -186,8 +186,12 @@ void {{/returnType}} worker->deleteLater(); - emit {{nickname}}Signal({{#returnType}}output{{/returnType}}); - emit {{nickname}}SignalE({{#returnType}}output, {{/returnType}}error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit {{nickname}}Signal({{#returnType}}output{{/returnType}}); + } else { + emit {{nickname}}SignalE({{#returnType}}output, {{/returnType}}error_type, error_str); + emit {{nickname}}SignalEFull(worker, error_type, error_str); + } } {{/operation}} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache index 66b7a0be0c2..6c1aec1ed2a 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache @@ -35,6 +35,8 @@ signals: {{/operation}}{{/operations}} {{#operations}}{{#operation}}void {{nickname}}SignalE({{#returnType}}{{{returnType}}} summary, {{/returnType}}QNetworkReply::NetworkError error_type, QString& error_str); {{/operation}}{{/operations}} + {{#operations}}{{#operation}}void {{nickname}}SignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + {{/operation}}{{/operations}} }; {{#cppNamespaceDeclarations}} diff --git a/samples/client/petstore/cpprest/.swagger-codegen/VERSION b/samples/client/petstore/cpprest/.swagger-codegen/VERSION index 7fea99011a6..f9f7450d135 100644 --- a/samples/client/petstore/cpprest/.swagger-codegen/VERSION +++ b/samples/client/petstore/cpprest/.swagger-codegen/VERSION @@ -1 +1 @@ -2.2.3-SNAPSHOT \ No newline at end of file +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/cpprest/ApiClient.cpp b/samples/client/petstore/cpprest/ApiClient.cpp index 365e56c7860..dc53f212966 100644 --- a/samples/client/petstore/cpprest/ApiClient.cpp +++ b/samples/client/petstore/cpprest/ApiClient.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/ApiClient.h b/samples/client/petstore/cpprest/ApiClient.h index f6ad8e2d76e..8adde7a78c6 100644 --- a/samples/client/petstore/cpprest/ApiClient.h +++ b/samples/client/petstore/cpprest/ApiClient.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/ApiConfiguration.cpp b/samples/client/petstore/cpprest/ApiConfiguration.cpp index 5e49ae49aac..68338c95f3f 100644 --- a/samples/client/petstore/cpprest/ApiConfiguration.cpp +++ b/samples/client/petstore/cpprest/ApiConfiguration.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/ApiConfiguration.h b/samples/client/petstore/cpprest/ApiConfiguration.h index 76d485a7224..f7834f841c9 100644 --- a/samples/client/petstore/cpprest/ApiConfiguration.h +++ b/samples/client/petstore/cpprest/ApiConfiguration.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/ApiException.cpp b/samples/client/petstore/cpprest/ApiException.cpp index f679ef8f3f7..92b13730ce9 100644 --- a/samples/client/petstore/cpprest/ApiException.cpp +++ b/samples/client/petstore/cpprest/ApiException.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/ApiException.h b/samples/client/petstore/cpprest/ApiException.h index ba75120a06b..fe16971e5d5 100644 --- a/samples/client/petstore/cpprest/ApiException.h +++ b/samples/client/petstore/cpprest/ApiException.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/HttpContent.cpp b/samples/client/petstore/cpprest/HttpContent.cpp index df37e526df8..5904c0371a6 100644 --- a/samples/client/petstore/cpprest/HttpContent.cpp +++ b/samples/client/petstore/cpprest/HttpContent.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/HttpContent.h b/samples/client/petstore/cpprest/HttpContent.h index b2ccea73103..908f83bedce 100644 --- a/samples/client/petstore/cpprest/HttpContent.h +++ b/samples/client/petstore/cpprest/HttpContent.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/IHttpBody.h b/samples/client/petstore/cpprest/IHttpBody.h index fede57e11a6..1f3ba2ae430 100644 --- a/samples/client/petstore/cpprest/IHttpBody.h +++ b/samples/client/petstore/cpprest/IHttpBody.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/JsonBody.cpp b/samples/client/petstore/cpprest/JsonBody.cpp index 67ea71af047..5cde61314cd 100644 --- a/samples/client/petstore/cpprest/JsonBody.cpp +++ b/samples/client/petstore/cpprest/JsonBody.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/JsonBody.h b/samples/client/petstore/cpprest/JsonBody.h index b75a69699ad..07e356c2174 100644 --- a/samples/client/petstore/cpprest/JsonBody.h +++ b/samples/client/petstore/cpprest/JsonBody.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/ModelBase.cpp b/samples/client/petstore/cpprest/ModelBase.cpp index bb53546f26e..351a2727b64 100644 --- a/samples/client/petstore/cpprest/ModelBase.cpp +++ b/samples/client/petstore/cpprest/ModelBase.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/ModelBase.h b/samples/client/petstore/cpprest/ModelBase.h index b2f190c87c3..7d2e5c1ecda 100644 --- a/samples/client/petstore/cpprest/ModelBase.h +++ b/samples/client/petstore/cpprest/ModelBase.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/MultipartFormData.cpp b/samples/client/petstore/cpprest/MultipartFormData.cpp index 76078484f6a..df86ee8d454 100644 --- a/samples/client/petstore/cpprest/MultipartFormData.cpp +++ b/samples/client/petstore/cpprest/MultipartFormData.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/MultipartFormData.h b/samples/client/petstore/cpprest/MultipartFormData.h index e7af513fa4b..1fabb33cb69 100644 --- a/samples/client/petstore/cpprest/MultipartFormData.h +++ b/samples/client/petstore/cpprest/MultipartFormData.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/api/PetApi.cpp b/samples/client/petstore/cpprest/api/PetApi.cpp index 1b655e62250..4cb45a80111 100644 --- a/samples/client/petstore/cpprest/api/PetApi.cpp +++ b/samples/client/petstore/cpprest/api/PetApi.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/api/PetApi.h b/samples/client/petstore/cpprest/api/PetApi.h index 617a05f40ee..62dab57218b 100644 --- a/samples/client/petstore/cpprest/api/PetApi.h +++ b/samples/client/petstore/cpprest/api/PetApi.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/api/StoreApi.cpp b/samples/client/petstore/cpprest/api/StoreApi.cpp index 286755e9da4..0000bd34920 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.cpp +++ b/samples/client/petstore/cpprest/api/StoreApi.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/api/StoreApi.h b/samples/client/petstore/cpprest/api/StoreApi.h index e43ab4c4e77..7962595aaa0 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.h +++ b/samples/client/petstore/cpprest/api/StoreApi.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/api/UserApi.cpp b/samples/client/petstore/cpprest/api/UserApi.cpp index 504df50ff3f..f3ff28cb2ff 100644 --- a/samples/client/petstore/cpprest/api/UserApi.cpp +++ b/samples/client/petstore/cpprest/api/UserApi.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/api/UserApi.h b/samples/client/petstore/cpprest/api/UserApi.h index 09415c0f2e5..92d720c6a00 100644 --- a/samples/client/petstore/cpprest/api/UserApi.h +++ b/samples/client/petstore/cpprest/api/UserApi.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/ApiResponse.cpp b/samples/client/petstore/cpprest/model/ApiResponse.cpp index cb66ff06996..ec763752cb7 100644 --- a/samples/client/petstore/cpprest/model/ApiResponse.cpp +++ b/samples/client/petstore/cpprest/model/ApiResponse.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/ApiResponse.h b/samples/client/petstore/cpprest/model/ApiResponse.h index b9e339aaf68..ff7ebe5f8f2 100644 --- a/samples/client/petstore/cpprest/model/ApiResponse.h +++ b/samples/client/petstore/cpprest/model/ApiResponse.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/Category.cpp b/samples/client/petstore/cpprest/model/Category.cpp index 8701f5122d3..5c5c3368f65 100644 --- a/samples/client/petstore/cpprest/model/Category.cpp +++ b/samples/client/petstore/cpprest/model/Category.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/Category.h b/samples/client/petstore/cpprest/model/Category.h index 8fe6e5452b3..c07a4f55b4d 100644 --- a/samples/client/petstore/cpprest/model/Category.h +++ b/samples/client/petstore/cpprest/model/Category.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/Order.cpp b/samples/client/petstore/cpprest/model/Order.cpp index 73a89f510dd..b95222f10d2 100644 --- a/samples/client/petstore/cpprest/model/Order.cpp +++ b/samples/client/petstore/cpprest/model/Order.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/Order.h b/samples/client/petstore/cpprest/model/Order.h index 15d6cd200f1..fe47916f1e1 100644 --- a/samples/client/petstore/cpprest/model/Order.h +++ b/samples/client/petstore/cpprest/model/Order.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/Pet.cpp b/samples/client/petstore/cpprest/model/Pet.cpp index 2558475b349..e6e973809b7 100644 --- a/samples/client/petstore/cpprest/model/Pet.cpp +++ b/samples/client/petstore/cpprest/model/Pet.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/Pet.h b/samples/client/petstore/cpprest/model/Pet.h index cfd594e78f0..df26cd36d1c 100644 --- a/samples/client/petstore/cpprest/model/Pet.h +++ b/samples/client/petstore/cpprest/model/Pet.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/Tag.cpp b/samples/client/petstore/cpprest/model/Tag.cpp index e7b3400e8b5..7bf3333a5c6 100644 --- a/samples/client/petstore/cpprest/model/Tag.cpp +++ b/samples/client/petstore/cpprest/model/Tag.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/Tag.h b/samples/client/petstore/cpprest/model/Tag.h index eda00393e95..24b9e654188 100644 --- a/samples/client/petstore/cpprest/model/Tag.h +++ b/samples/client/petstore/cpprest/model/Tag.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/User.cpp b/samples/client/petstore/cpprest/model/User.cpp index 2faaf5b7ce5..87c7929a202 100644 --- a/samples/client/petstore/cpprest/model/User.cpp +++ b/samples/client/petstore/cpprest/model/User.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpprest/model/User.h b/samples/client/petstore/cpprest/model/User.h index 30fa8e74f14..69eedb0fcfa 100644 --- a/samples/client/petstore/cpprest/model/User.h +++ b/samples/client/petstore/cpprest/model/User.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * - * NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT. + * NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ diff --git a/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION b/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION index 6b4d1577382..f9f7450d135 100644 --- a/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION +++ b/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION @@ -1 +1 @@ -2.2.3 \ No newline at end of file +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/qt5cpp/client/ApiResponse.cpp b/samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp similarity index 77% rename from samples/client/petstore/qt5cpp/client/ApiResponse.cpp rename to samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp index 2b152e06cfa..8beb7e8187b 100644 --- a/samples/client/petstore/qt5cpp/client/ApiResponse.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp @@ -11,7 +11,7 @@ */ -#include "ApiResponse.h" +#include "SWGApiResponse.h" #include "SWGHelpers.h" @@ -22,28 +22,28 @@ namespace Swagger { -ApiResponse::ApiResponse(QString* json) { +SWGApiResponse::SWGApiResponse(QString* json) { init(); this->fromJson(*json); } -ApiResponse::ApiResponse() { +SWGApiResponse::SWGApiResponse() { init(); } -ApiResponse::~ApiResponse() { +SWGApiResponse::~SWGApiResponse() { this->cleanup(); } void -ApiResponse::init() { +SWGApiResponse::init() { code = 0; type = new QString(""); message = new QString(""); } void -ApiResponse::cleanup() { +SWGApiResponse::cleanup() { if(type != nullptr) { @@ -55,8 +55,8 @@ ApiResponse::cleanup() { } } -ApiResponse* -ApiResponse::fromJson(QString &json) { +SWGApiResponse* +SWGApiResponse::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -65,14 +65,14 @@ ApiResponse::fromJson(QString &json) { } void -ApiResponse::fromJsonObject(QJsonObject &pJson) { +SWGApiResponse::fromJsonObject(QJsonObject &pJson) { ::Swagger::setValue(&code, pJson["code"], "qint32", ""); ::Swagger::setValue(&type, pJson["type"], "QString", "QString"); ::Swagger::setValue(&message, pJson["message"], "QString", "QString"); } QString -ApiResponse::asJson () +SWGApiResponse::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -82,7 +82,7 @@ ApiResponse::asJson () } QJsonObject* -ApiResponse::asJsonObject() { +SWGApiResponse::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("code", QJsonValue(code)); @@ -95,29 +95,29 @@ ApiResponse::asJsonObject() { } qint32 -ApiResponse::getCode() { +SWGApiResponse::getCode() { return code; } void -ApiResponse::setCode(qint32 code) { +SWGApiResponse::setCode(qint32 code) { this->code = code; } QString* -ApiResponse::getType() { +SWGApiResponse::getType() { return type; } void -ApiResponse::setType(QString* type) { +SWGApiResponse::setType(QString* type) { this->type = type; } QString* -ApiResponse::getMessage() { +SWGApiResponse::getMessage() { return message; } void -ApiResponse::setMessage(QString* message) { +SWGApiResponse::setMessage(QString* message) { this->message = message; } diff --git a/samples/client/petstore/qt5cpp/client/ApiResponse.h b/samples/client/petstore/qt5cpp/client/SWGApiResponse.h similarity index 79% rename from samples/client/petstore/qt5cpp/client/ApiResponse.h rename to samples/client/petstore/qt5cpp/client/SWGApiResponse.h index 31e67105b0e..745c1fd6565 100644 --- a/samples/client/petstore/qt5cpp/client/ApiResponse.h +++ b/samples/client/petstore/qt5cpp/client/SWGApiResponse.h @@ -11,13 +11,13 @@ */ /* - * ApiResponse.h + * SWGApiResponse.h * * Describes the result of uploading an image resource */ -#ifndef ApiResponse_H_ -#define ApiResponse_H_ +#ifndef SWGApiResponse_H_ +#define SWGApiResponse_H_ #include @@ -29,18 +29,18 @@ namespace Swagger { -class ApiResponse: public SWGObject { +class SWGApiResponse: public SWGObject { public: - ApiResponse(); - ApiResponse(QString* json); - virtual ~ApiResponse(); + SWGApiResponse(); + SWGApiResponse(QString* json); + virtual ~SWGApiResponse(); void init(); void cleanup(); QString asJson (); QJsonObject* asJsonObject(); void fromJsonObject(QJsonObject &json); - ApiResponse* fromJson(QString &jsonString); + SWGApiResponse* fromJson(QString &jsonString); qint32 getCode(); void setCode(qint32 code); @@ -60,4 +60,4 @@ private: } -#endif /* ApiResponse_H_ */ +#endif /* SWGApiResponse_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/Category.cpp b/samples/client/petstore/qt5cpp/client/SWGCategory.cpp similarity index 78% rename from samples/client/petstore/qt5cpp/client/Category.cpp rename to samples/client/petstore/qt5cpp/client/SWGCategory.cpp index 93f45934fca..9e5c3ed75c3 100644 --- a/samples/client/petstore/qt5cpp/client/Category.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGCategory.cpp @@ -11,7 +11,7 @@ */ -#include "Category.h" +#include "SWGCategory.h" #include "SWGHelpers.h" @@ -22,27 +22,27 @@ namespace Swagger { -Category::Category(QString* json) { +SWGCategory::SWGCategory(QString* json) { init(); this->fromJson(*json); } -Category::Category() { +SWGCategory::SWGCategory() { init(); } -Category::~Category() { +SWGCategory::~SWGCategory() { this->cleanup(); } void -Category::init() { +SWGCategory::init() { id = 0L; name = new QString(""); } void -Category::cleanup() { +SWGCategory::cleanup() { if(name != nullptr) { @@ -50,8 +50,8 @@ Category::cleanup() { } } -Category* -Category::fromJson(QString &json) { +SWGCategory* +SWGCategory::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -60,13 +60,13 @@ Category::fromJson(QString &json) { } void -Category::fromJsonObject(QJsonObject &pJson) { +SWGCategory::fromJsonObject(QJsonObject &pJson) { ::Swagger::setValue(&id, pJson["id"], "qint64", ""); ::Swagger::setValue(&name, pJson["name"], "QString", "QString"); } QString -Category::asJson () +SWGCategory::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -76,7 +76,7 @@ Category::asJson () } QJsonObject* -Category::asJsonObject() { +SWGCategory::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("id", QJsonValue(id)); @@ -87,20 +87,20 @@ Category::asJsonObject() { } qint64 -Category::getId() { +SWGCategory::getId() { return id; } void -Category::setId(qint64 id) { +SWGCategory::setId(qint64 id) { this->id = id; } QString* -Category::getName() { +SWGCategory::getName() { return name; } void -Category::setName(QString* name) { +SWGCategory::setName(QString* name) { this->name = name; } diff --git a/samples/client/petstore/qt5cpp/client/Category.h b/samples/client/petstore/qt5cpp/client/SWGCategory.h similarity index 79% rename from samples/client/petstore/qt5cpp/client/Category.h rename to samples/client/petstore/qt5cpp/client/SWGCategory.h index 1c1ef71b7da..229669eff8c 100644 --- a/samples/client/petstore/qt5cpp/client/Category.h +++ b/samples/client/petstore/qt5cpp/client/SWGCategory.h @@ -11,13 +11,13 @@ */ /* - * Category.h + * SWGCategory.h * * A category for a pet */ -#ifndef Category_H_ -#define Category_H_ +#ifndef SWGCategory_H_ +#define SWGCategory_H_ #include @@ -29,18 +29,18 @@ namespace Swagger { -class Category: public SWGObject { +class SWGCategory: public SWGObject { public: - Category(); - Category(QString* json); - virtual ~Category(); + SWGCategory(); + SWGCategory(QString* json); + virtual ~SWGCategory(); void init(); void cleanup(); QString asJson (); QJsonObject* asJsonObject(); void fromJsonObject(QJsonObject &json); - Category* fromJson(QString &jsonString); + SWGCategory* fromJson(QString &jsonString); qint64 getId(); void setId(qint64 id); @@ -56,4 +56,4 @@ private: } -#endif /* Category_H_ */ +#endif /* SWGCategory_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp index 01e05241bda..958b9a49ca3 100644 --- a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp @@ -262,6 +262,9 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { // prepare connection QNetworkRequest request = QNetworkRequest(QUrl(input->url_str)); + if (HttpRequestWorker::sslDefaultConfiguration != nullptr) { + request.setSslConfiguration(*HttpRequestWorker::sslDefaultConfiguration); + } request.setRawHeader("User-Agent", "Swagger-Client"); foreach(QString key, input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); @@ -309,16 +312,14 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { void HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { error_type = reply->error(); - if (error_type == QNetworkReply::NoError) { - response = reply->readAll(); - } - else { - error_str = reply->errorString(); - } + response = reply->readAll(); + error_str = reply->errorString(); reply->deleteLater(); emit on_execution_finished(this); } +QSslConfiguration* HttpRequestWorker::sslDefaultConfiguration; + } diff --git a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.h b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.h index a257f8463e1..97bfd542593 100644 --- a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.h +++ b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.h @@ -73,6 +73,7 @@ public: QString http_attribute_encode(QString attribute_name, QString input); void execute(HttpRequestInput *input); + static QSslConfiguration* sslDefaultConfiguration; signals: void on_execution_finished(HttpRequestWorker *worker); diff --git a/samples/client/petstore/qt5cpp/client/SWGModelFactory.h b/samples/client/petstore/qt5cpp/client/SWGModelFactory.h index 71821a59919..625d2e75aae 100644 --- a/samples/client/petstore/qt5cpp/client/SWGModelFactory.h +++ b/samples/client/petstore/qt5cpp/client/SWGModelFactory.h @@ -14,33 +14,33 @@ #define ModelFactory_H_ -#include "ApiResponse.h" -#include "Category.h" -#include "Order.h" -#include "Pet.h" -#include "Tag.h" -#include "User.h" +#include "SWGApiResponse.h" +#include "SWGCategory.h" +#include "SWGOrder.h" +#include "SWGPet.h" +#include "SWGTag.h" +#include "SWGUser.h" namespace Swagger { inline void* create(QString type) { - if(QString("ApiResponse").compare(type) == 0) { - return new ApiResponse(); + if(QString("SWGApiResponse").compare(type) == 0) { + return new SWGApiResponse(); } - if(QString("Category").compare(type) == 0) { - return new Category(); + if(QString("SWGCategory").compare(type) == 0) { + return new SWGCategory(); } - if(QString("Order").compare(type) == 0) { - return new Order(); + if(QString("SWGOrder").compare(type) == 0) { + return new SWGOrder(); } - if(QString("Pet").compare(type) == 0) { - return new Pet(); + if(QString("SWGPet").compare(type) == 0) { + return new SWGPet(); } - if(QString("Tag").compare(type) == 0) { - return new Tag(); + if(QString("SWGTag").compare(type) == 0) { + return new SWGTag(); } - if(QString("User").compare(type) == 0) { - return new User(); + if(QString("SWGUser").compare(type) == 0) { + return new SWGUser(); } return nullptr; diff --git a/samples/client/petstore/qt5cpp/client/Order.cpp b/samples/client/petstore/qt5cpp/client/SWGOrder.cpp similarity index 79% rename from samples/client/petstore/qt5cpp/client/Order.cpp rename to samples/client/petstore/qt5cpp/client/SWGOrder.cpp index c975c8529a6..1d947be1914 100644 --- a/samples/client/petstore/qt5cpp/client/Order.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGOrder.cpp @@ -11,7 +11,7 @@ */ -#include "Order.h" +#include "SWGOrder.h" #include "SWGHelpers.h" @@ -22,21 +22,21 @@ namespace Swagger { -Order::Order(QString* json) { +SWGOrder::SWGOrder(QString* json) { init(); this->fromJson(*json); } -Order::Order() { +SWGOrder::SWGOrder() { init(); } -Order::~Order() { +SWGOrder::~SWGOrder() { this->cleanup(); } void -Order::init() { +SWGOrder::init() { id = 0L; pet_id = 0L; quantity = 0; @@ -46,7 +46,7 @@ Order::init() { } void -Order::cleanup() { +SWGOrder::cleanup() { @@ -61,8 +61,8 @@ Order::cleanup() { } -Order* -Order::fromJson(QString &json) { +SWGOrder* +SWGOrder::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -71,7 +71,7 @@ Order::fromJson(QString &json) { } void -Order::fromJsonObject(QJsonObject &pJson) { +SWGOrder::fromJsonObject(QJsonObject &pJson) { ::Swagger::setValue(&id, pJson["id"], "qint64", ""); ::Swagger::setValue(&pet_id, pJson["petId"], "qint64", ""); ::Swagger::setValue(&quantity, pJson["quantity"], "qint32", ""); @@ -81,7 +81,7 @@ Order::fromJsonObject(QJsonObject &pJson) { } QString -Order::asJson () +SWGOrder::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -91,7 +91,7 @@ Order::asJson () } QJsonObject* -Order::asJsonObject() { +SWGOrder::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("id", QJsonValue(id)); @@ -110,56 +110,56 @@ Order::asJsonObject() { } qint64 -Order::getId() { +SWGOrder::getId() { return id; } void -Order::setId(qint64 id) { +SWGOrder::setId(qint64 id) { this->id = id; } qint64 -Order::getPetId() { +SWGOrder::getPetId() { return pet_id; } void -Order::setPetId(qint64 pet_id) { +SWGOrder::setPetId(qint64 pet_id) { this->pet_id = pet_id; } qint32 -Order::getQuantity() { +SWGOrder::getQuantity() { return quantity; } void -Order::setQuantity(qint32 quantity) { +SWGOrder::setQuantity(qint32 quantity) { this->quantity = quantity; } QDateTime* -Order::getShipDate() { +SWGOrder::getShipDate() { return ship_date; } void -Order::setShipDate(QDateTime* ship_date) { +SWGOrder::setShipDate(QDateTime* ship_date) { this->ship_date = ship_date; } QString* -Order::getStatus() { +SWGOrder::getStatus() { return status; } void -Order::setStatus(QString* status) { +SWGOrder::setStatus(QString* status) { this->status = status; } bool -Order::getComplete() { +SWGOrder::getComplete() { return complete; } void -Order::setComplete(bool complete) { +SWGOrder::setComplete(bool complete) { this->complete = complete; } diff --git a/samples/client/petstore/qt5cpp/client/Order.h b/samples/client/petstore/qt5cpp/client/SWGOrder.h similarity index 85% rename from samples/client/petstore/qt5cpp/client/Order.h rename to samples/client/petstore/qt5cpp/client/SWGOrder.h index e4a1a0564bc..72b2bf84538 100644 --- a/samples/client/petstore/qt5cpp/client/Order.h +++ b/samples/client/petstore/qt5cpp/client/SWGOrder.h @@ -11,13 +11,13 @@ */ /* - * Order.h + * SWGOrder.h * * An order for a pets from the pet store */ -#ifndef Order_H_ -#define Order_H_ +#ifndef SWGOrder_H_ +#define SWGOrder_H_ #include @@ -30,18 +30,18 @@ namespace Swagger { -class Order: public SWGObject { +class SWGOrder: public SWGObject { public: - Order(); - Order(QString* json); - virtual ~Order(); + SWGOrder(); + SWGOrder(QString* json); + virtual ~SWGOrder(); void init(); void cleanup(); QString asJson (); QJsonObject* asJsonObject(); void fromJsonObject(QJsonObject &json); - Order* fromJson(QString &jsonString); + SWGOrder* fromJson(QString &jsonString); qint64 getId(); void setId(qint64 id); @@ -73,4 +73,4 @@ private: } -#endif /* Order_H_ */ +#endif /* SWGOrder_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/Pet.cpp b/samples/client/petstore/qt5cpp/client/SWGPet.cpp similarity index 72% rename from samples/client/petstore/qt5cpp/client/Pet.cpp rename to samples/client/petstore/qt5cpp/client/SWGPet.cpp index 1fd9677ed97..be6f08fbd4f 100644 --- a/samples/client/petstore/qt5cpp/client/Pet.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPet.cpp @@ -11,7 +11,7 @@ */ -#include "Pet.h" +#include "SWGPet.h" #include "SWGHelpers.h" @@ -22,31 +22,31 @@ namespace Swagger { -Pet::Pet(QString* json) { +SWGPet::SWGPet(QString* json) { init(); this->fromJson(*json); } -Pet::Pet() { +SWGPet::SWGPet() { init(); } -Pet::~Pet() { +SWGPet::~SWGPet() { this->cleanup(); } void -Pet::init() { +SWGPet::init() { id = 0L; - category = new Category(); + category = new SWGCategory(); name = new QString(""); photo_urls = new QList(); - tags = new QList(); + tags = new QList(); status = new QString(""); } void -Pet::cleanup() { +SWGPet::cleanup() { if(category != nullptr) { @@ -66,8 +66,8 @@ Pet::cleanup() { } if(tags != nullptr) { - QList* arr = tags; - foreach(Tag* o, *arr) { + QList* arr = tags; + foreach(SWGTag* o, *arr) { delete o; } delete tags; @@ -78,8 +78,8 @@ Pet::cleanup() { } } -Pet* -Pet::fromJson(QString &json) { +SWGPet* +SWGPet::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -88,21 +88,21 @@ Pet::fromJson(QString &json) { } void -Pet::fromJsonObject(QJsonObject &pJson) { +SWGPet::fromJsonObject(QJsonObject &pJson) { ::Swagger::setValue(&id, pJson["id"], "qint64", ""); - ::Swagger::setValue(&category, pJson["category"], "Category", "Category"); + ::Swagger::setValue(&category, pJson["category"], "SWGCategory", "SWGCategory"); ::Swagger::setValue(&name, pJson["name"], "QString", "QString"); ::Swagger::setValue(&photo_urls, pJson["photoUrls"], "QList", "QString"); - ::Swagger::setValue(&tags, pJson["tags"], "QList", "Tag"); + ::Swagger::setValue(&tags, pJson["tags"], "QList", "SWGTag"); ::Swagger::setValue(&status, pJson["status"], "QString", "QString"); } QString -Pet::asJson () +SWGPet::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -112,12 +112,12 @@ Pet::asJson () } QJsonObject* -Pet::asJsonObject() { +SWGPet::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("id", QJsonValue(id)); - toJsonValue(QString("category"), category, obj, QString("Category")); + toJsonValue(QString("category"), category, obj, QString("SWGCategory")); toJsonValue(QString("name"), name, obj, QString("QString")); @@ -126,7 +126,7 @@ Pet::asJsonObject() { obj->insert("photoUrls", photo_urlsJsonArray); QJsonArray tagsJsonArray; - toJsonArray((QList*)tags, &tagsJsonArray, "tags", "Tag"); + toJsonArray((QList*)tags, &tagsJsonArray, "tags", "SWGTag"); obj->insert("tags", tagsJsonArray); toJsonValue(QString("status"), status, obj, QString("QString")); @@ -135,56 +135,56 @@ Pet::asJsonObject() { } qint64 -Pet::getId() { +SWGPet::getId() { return id; } void -Pet::setId(qint64 id) { +SWGPet::setId(qint64 id) { this->id = id; } -Category* -Pet::getCategory() { +SWGCategory* +SWGPet::getCategory() { return category; } void -Pet::setCategory(Category* category) { +SWGPet::setCategory(SWGCategory* category) { this->category = category; } QString* -Pet::getName() { +SWGPet::getName() { return name; } void -Pet::setName(QString* name) { +SWGPet::setName(QString* name) { this->name = name; } QList* -Pet::getPhotoUrls() { +SWGPet::getPhotoUrls() { return photo_urls; } void -Pet::setPhotoUrls(QList* photo_urls) { +SWGPet::setPhotoUrls(QList* photo_urls) { this->photo_urls = photo_urls; } -QList* -Pet::getTags() { +QList* +SWGPet::getTags() { return tags; } void -Pet::setTags(QList* tags) { +SWGPet::setTags(QList* tags) { this->tags = tags; } QString* -Pet::getStatus() { +SWGPet::getStatus() { return status; } void -Pet::setStatus(QString* status) { +SWGPet::setStatus(QString* status) { this->status = status; } diff --git a/samples/client/petstore/qt5cpp/client/Pet.h b/samples/client/petstore/qt5cpp/client/SWGPet.h similarity index 72% rename from samples/client/petstore/qt5cpp/client/Pet.h rename to samples/client/petstore/qt5cpp/client/SWGPet.h index 514d6751cbe..55142740d96 100644 --- a/samples/client/petstore/qt5cpp/client/Pet.h +++ b/samples/client/petstore/qt5cpp/client/SWGPet.h @@ -11,19 +11,19 @@ */ /* - * Pet.h + * SWGPet.h * * A pet for sale in the pet store */ -#ifndef Pet_H_ -#define Pet_H_ +#ifndef SWGPet_H_ +#define SWGPet_H_ #include -#include "Category.h" -#include "Tag.h" +#include "SWGCategory.h" +#include "SWGTag.h" #include #include @@ -32,24 +32,24 @@ namespace Swagger { -class Pet: public SWGObject { +class SWGPet: public SWGObject { public: - Pet(); - Pet(QString* json); - virtual ~Pet(); + SWGPet(); + SWGPet(QString* json); + virtual ~SWGPet(); void init(); void cleanup(); QString asJson (); QJsonObject* asJsonObject(); void fromJsonObject(QJsonObject &json); - Pet* fromJson(QString &jsonString); + SWGPet* fromJson(QString &jsonString); qint64 getId(); void setId(qint64 id); - Category* getCategory(); - void setCategory(Category* category); + SWGCategory* getCategory(); + void setCategory(SWGCategory* category); QString* getName(); void setName(QString* name); @@ -57,8 +57,8 @@ public: QList* getPhotoUrls(); void setPhotoUrls(QList* photo_urls); - QList* getTags(); - void setTags(QList* tags); + QList* getTags(); + void setTags(QList* tags); QString* getStatus(); void setStatus(QString* status); @@ -66,13 +66,13 @@ public: private: qint64 id; - Category* category; + SWGCategory* category; QString* name; QList* photo_urls; - QList* tags; + QList* tags; QString* status; }; } -#endif /* Pet_H_ */ +#endif /* SWGPet_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp index 16b53e0bd1b..e96d210e3eb 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp @@ -29,7 +29,7 @@ SWGPetApi::SWGPetApi(QString host, QString basePath) { } void -SWGPetApi::addPet(Pet body) { +SWGPetApi::addPet(SWGPet body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); @@ -71,8 +71,12 @@ SWGPetApi::addPetCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit addPetSignal(); - emit addPetSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit addPetSignal(); + } else { + emit addPetSignalE(error_type, error_str); + emit addPetSignalEFull(worker, error_type, error_str); + } } void @@ -121,8 +125,12 @@ SWGPetApi::deletePetCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit deletePetSignal(); - emit deletePetSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit deletePetSignal(); + } else { + emit deletePetSignalE(error_type, error_str); + emit deletePetSignalEFull(worker, error_type, error_str); + } } void @@ -206,14 +214,14 @@ SWGPetApi::findPetsByStatusCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - QList* output = new QList(); + QList* output = new QList(); QString json(worker->response); QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonArray jsonArray = doc.array(); foreach(QJsonValue obj, jsonArray) { - Pet* o = new Pet(); + SWGPet* o = new SWGPet(); QJsonObject jv = obj.toObject(); QJsonObject * ptr = (QJsonObject*)&jv; o->fromJsonObject(*ptr); @@ -222,8 +230,12 @@ SWGPetApi::findPetsByStatusCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit findPetsByStatusSignal(output); - emit findPetsByStatusSignalE(output, error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit findPetsByStatusSignal(output); + } else { + emit findPetsByStatusSignalE(output, error_type, error_str); + emit findPetsByStatusSignalEFull(worker, error_type, error_str); + } } void @@ -307,14 +319,14 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - QList* output = new QList(); + QList* output = new QList(); QString json(worker->response); QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonArray jsonArray = doc.array(); foreach(QJsonValue obj, jsonArray) { - Pet* o = new Pet(); + SWGPet* o = new SWGPet(); QJsonObject jv = obj.toObject(); QJsonObject * ptr = (QJsonObject*)&jv; o->fromJsonObject(*ptr); @@ -323,8 +335,12 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit findPetsByTagsSignal(output); - emit findPetsByTagsSignalE(output, error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit findPetsByTagsSignal(output); + } else { + emit findPetsByTagsSignalE(output, error_type, error_str); + emit findPetsByTagsSignalEFull(worker, error_type, error_str); + } } void @@ -370,15 +386,19 @@ SWGPetApi::getPetByIdCallback(HttpRequestWorker * worker) { QString json(worker->response); - Pet* output = static_cast(create(json, QString("Pet"))); + SWGPet* output = static_cast(create(json, QString("SWGPet"))); worker->deleteLater(); - emit getPetByIdSignal(output); - emit getPetByIdSignalE(output, error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit getPetByIdSignal(output); + } else { + emit getPetByIdSignalE(output, error_type, error_str); + emit getPetByIdSignalEFull(worker, error_type, error_str); + } } void -SWGPetApi::updatePet(Pet body) { +SWGPetApi::updatePet(SWGPet body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); @@ -420,8 +440,12 @@ SWGPetApi::updatePetCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit updatePetSignal(); - emit updatePetSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit updatePetSignal(); + } else { + emit updatePetSignalE(error_type, error_str); + emit updatePetSignalEFull(worker, error_type, error_str); + } } void @@ -473,8 +497,12 @@ SWGPetApi::updatePetWithFormCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit updatePetWithFormSignal(); - emit updatePetWithFormSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit updatePetWithFormSignal(); + } else { + emit updatePetWithFormSignalE(error_type, error_str); + emit updatePetWithFormSignalEFull(worker, error_type, error_str); + } } void @@ -526,11 +554,15 @@ SWGPetApi::uploadFileCallback(HttpRequestWorker * worker) { QString json(worker->response); - ApiResponse* output = static_cast(create(json, QString("ApiResponse"))); + SWGApiResponse* output = static_cast(create(json, QString("SWGApiResponse"))); worker->deleteLater(); - emit uploadFileSignal(output); - emit uploadFileSignalE(output, error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit uploadFileSignal(output); + } else { + emit uploadFileSignalE(output, error_type, error_str); + emit uploadFileSignalEFull(worker, error_type, error_str); + } } diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.h b/samples/client/petstore/qt5cpp/client/SWGPetApi.h index e1d4a455341..6313bbf1647 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.h @@ -15,10 +15,10 @@ #include "SWGHttpRequest.h" -#include "ApiResponse.h" -#include "Pet.h" #include +#include "SWGApiResponse.h" #include "SWGHttpRequest.h" +#include "SWGPet.h" #include @@ -36,12 +36,12 @@ public: QString basePath; QMap defaultHeaders; - void addPet(Pet body); + void addPet(SWGPet body); void deletePet(qint64 pet_id, QString* api_key); void findPetsByStatus(QList* status); void findPetsByTags(QList* tags); void getPetById(qint64 pet_id); - void updatePet(Pet body); + void updatePet(SWGPet body); void updatePetWithForm(qint64 pet_id, QString* name, QString* status); void uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file); @@ -58,21 +58,30 @@ private: signals: void addPetSignal(); void deletePetSignal(); - void findPetsByStatusSignal(QList* summary); - void findPetsByTagsSignal(QList* summary); - void getPetByIdSignal(Pet* summary); + void findPetsByStatusSignal(QList* summary); + void findPetsByTagsSignal(QList* summary); + void getPetByIdSignal(SWGPet* summary); void updatePetSignal(); void updatePetWithFormSignal(); - void uploadFileSignal(ApiResponse* summary); + void uploadFileSignal(SWGApiResponse* summary); void addPetSignalE(QNetworkReply::NetworkError error_type, QString& error_str); void deletePetSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void findPetsByStatusSignalE(QList* summary, QNetworkReply::NetworkError error_type, QString& error_str); - void findPetsByTagsSignalE(QList* summary, QNetworkReply::NetworkError error_type, QString& error_str); - void getPetByIdSignalE(Pet* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void findPetsByStatusSignalE(QList* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void findPetsByTagsSignalE(QList* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void getPetByIdSignalE(SWGPet* summary, QNetworkReply::NetworkError error_type, QString& error_str); void updatePetSignalE(QNetworkReply::NetworkError error_type, QString& error_str); void updatePetWithFormSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void uploadFileSignalE(ApiResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void uploadFileSignalE(SWGApiResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); + + void addPetSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void deletePetSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void findPetsByStatusSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void findPetsByTagsSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void getPetByIdSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void updatePetSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void updatePetWithFormSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void uploadFileSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); }; diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp index fa1ce8a1cc7..58fcf48d648 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp @@ -71,8 +71,12 @@ SWGStoreApi::deleteOrderCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit deleteOrderSignal(); - emit deleteOrderSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit deleteOrderSignal(); + } else { + emit deleteOrderSignalE(error_type, error_str); + emit deleteOrderSignalEFull(worker, error_type, error_str); + } } void @@ -115,6 +119,7 @@ SWGStoreApi::getInventoryCallback(HttpRequestWorker * worker) { } + QMap* output; // TODO add primitive output support QMap* output = new QMap(); QString json(worker->response); QByteArray array (json.toStdString().c_str()); @@ -123,13 +128,17 @@ SWGStoreApi::getInventoryCallback(HttpRequestWorker * worker) { foreach(QString key, obj.keys()) { qint32* val; - setValue(&val, obj[key], "QMap", ""); + setValue(&val, obj[key], "qint32", ""); output->insert(key, *val); } worker->deleteLater(); - emit getInventorySignal(output); - emit getInventorySignalE(output, error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit getInventorySignal(output); + } else { + emit getInventorySignalE(output, error_type, error_str); + emit getInventorySignalEFull(worker, error_type, error_str); + } } void @@ -175,15 +184,19 @@ SWGStoreApi::getOrderByIdCallback(HttpRequestWorker * worker) { QString json(worker->response); - Order* output = static_cast(create(json, QString("Order"))); + SWGOrder* output = static_cast(create(json, QString("SWGOrder"))); worker->deleteLater(); - emit getOrderByIdSignal(output); - emit getOrderByIdSignalE(output, error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit getOrderByIdSignal(output); + } else { + emit getOrderByIdSignalE(output, error_type, error_str); + emit getOrderByIdSignalEFull(worker, error_type, error_str); + } } void -SWGStoreApi::placeOrder(Order body) { +SWGStoreApi::placeOrder(SWGOrder body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order"); @@ -225,11 +238,15 @@ SWGStoreApi::placeOrderCallback(HttpRequestWorker * worker) { QString json(worker->response); - Order* output = static_cast(create(json, QString("Order"))); + SWGOrder* output = static_cast(create(json, QString("SWGOrder"))); worker->deleteLater(); - emit placeOrderSignal(output); - emit placeOrderSignalE(output, error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit placeOrderSignal(output); + } else { + emit placeOrderSignalE(output, error_type, error_str); + emit placeOrderSignalEFull(worker, error_type, error_str); + } } diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h index 95be0fbc43c..8bef2d38b4c 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h @@ -15,9 +15,9 @@ #include "SWGHttpRequest.h" -#include "Order.h" #include #include +#include "SWGOrder.h" #include @@ -38,7 +38,7 @@ public: void deleteOrder(QString* order_id); void getInventory(); void getOrderById(qint64 order_id); - void placeOrder(Order body); + void placeOrder(SWGOrder body); private: void deleteOrderCallback (HttpRequestWorker * worker); @@ -49,13 +49,18 @@ private: signals: void deleteOrderSignal(); void getInventorySignal(QMap* summary); - void getOrderByIdSignal(Order* summary); - void placeOrderSignal(Order* summary); + void getOrderByIdSignal(SWGOrder* summary); + void placeOrderSignal(SWGOrder* summary); void deleteOrderSignalE(QNetworkReply::NetworkError error_type, QString& error_str); void getInventorySignalE(QMap* summary, QNetworkReply::NetworkError error_type, QString& error_str); - void getOrderByIdSignalE(Order* summary, QNetworkReply::NetworkError error_type, QString& error_str); - void placeOrderSignalE(Order* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void getOrderByIdSignalE(SWGOrder* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void placeOrderSignalE(SWGOrder* summary, QNetworkReply::NetworkError error_type, QString& error_str); + + void deleteOrderSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void getInventorySignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void getOrderByIdSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void placeOrderSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); }; diff --git a/samples/client/petstore/qt5cpp/client/Tag.cpp b/samples/client/petstore/qt5cpp/client/SWGTag.cpp similarity index 82% rename from samples/client/petstore/qt5cpp/client/Tag.cpp rename to samples/client/petstore/qt5cpp/client/SWGTag.cpp index 4cdf68d70a4..7a622a68be1 100644 --- a/samples/client/petstore/qt5cpp/client/Tag.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGTag.cpp @@ -11,7 +11,7 @@ */ -#include "Tag.h" +#include "SWGTag.h" #include "SWGHelpers.h" @@ -22,27 +22,27 @@ namespace Swagger { -Tag::Tag(QString* json) { +SWGTag::SWGTag(QString* json) { init(); this->fromJson(*json); } -Tag::Tag() { +SWGTag::SWGTag() { init(); } -Tag::~Tag() { +SWGTag::~SWGTag() { this->cleanup(); } void -Tag::init() { +SWGTag::init() { id = 0L; name = new QString(""); } void -Tag::cleanup() { +SWGTag::cleanup() { if(name != nullptr) { @@ -50,8 +50,8 @@ Tag::cleanup() { } } -Tag* -Tag::fromJson(QString &json) { +SWGTag* +SWGTag::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -60,13 +60,13 @@ Tag::fromJson(QString &json) { } void -Tag::fromJsonObject(QJsonObject &pJson) { +SWGTag::fromJsonObject(QJsonObject &pJson) { ::Swagger::setValue(&id, pJson["id"], "qint64", ""); ::Swagger::setValue(&name, pJson["name"], "QString", "QString"); } QString -Tag::asJson () +SWGTag::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -76,7 +76,7 @@ Tag::asJson () } QJsonObject* -Tag::asJsonObject() { +SWGTag::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("id", QJsonValue(id)); @@ -87,20 +87,20 @@ Tag::asJsonObject() { } qint64 -Tag::getId() { +SWGTag::getId() { return id; } void -Tag::setId(qint64 id) { +SWGTag::setId(qint64 id) { this->id = id; } QString* -Tag::getName() { +SWGTag::getName() { return name; } void -Tag::setName(QString* name) { +SWGTag::setName(QString* name) { this->name = name; } diff --git a/samples/client/petstore/qt5cpp/client/Tag.h b/samples/client/petstore/qt5cpp/client/SWGTag.h similarity index 82% rename from samples/client/petstore/qt5cpp/client/Tag.h rename to samples/client/petstore/qt5cpp/client/SWGTag.h index 0b34e420699..d192718670d 100644 --- a/samples/client/petstore/qt5cpp/client/Tag.h +++ b/samples/client/petstore/qt5cpp/client/SWGTag.h @@ -11,13 +11,13 @@ */ /* - * Tag.h + * SWGTag.h * * A tag for a pet */ -#ifndef Tag_H_ -#define Tag_H_ +#ifndef SWGTag_H_ +#define SWGTag_H_ #include @@ -29,18 +29,18 @@ namespace Swagger { -class Tag: public SWGObject { +class SWGTag: public SWGObject { public: - Tag(); - Tag(QString* json); - virtual ~Tag(); + SWGTag(); + SWGTag(QString* json); + virtual ~SWGTag(); void init(); void cleanup(); QString asJson (); QJsonObject* asJsonObject(); void fromJsonObject(QJsonObject &json); - Tag* fromJson(QString &jsonString); + SWGTag* fromJson(QString &jsonString); qint64 getId(); void setId(qint64 id); @@ -56,4 +56,4 @@ private: } -#endif /* Tag_H_ */ +#endif /* SWGTag_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/User.cpp b/samples/client/petstore/qt5cpp/client/SWGUser.cpp similarity index 81% rename from samples/client/petstore/qt5cpp/client/User.cpp rename to samples/client/petstore/qt5cpp/client/SWGUser.cpp index e0a2dd7abb3..372ca77bf75 100644 --- a/samples/client/petstore/qt5cpp/client/User.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUser.cpp @@ -11,7 +11,7 @@ */ -#include "User.h" +#include "SWGUser.h" #include "SWGHelpers.h" @@ -22,21 +22,21 @@ namespace Swagger { -User::User(QString* json) { +SWGUser::SWGUser(QString* json) { init(); this->fromJson(*json); } -User::User() { +SWGUser::SWGUser() { init(); } -User::~User() { +SWGUser::~SWGUser() { this->cleanup(); } void -User::init() { +SWGUser::init() { id = 0L; username = new QString(""); first_name = new QString(""); @@ -48,7 +48,7 @@ User::init() { } void -User::cleanup() { +SWGUser::cleanup() { if(username != nullptr) { @@ -77,8 +77,8 @@ User::cleanup() { } -User* -User::fromJson(QString &json) { +SWGUser* +SWGUser::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -87,7 +87,7 @@ User::fromJson(QString &json) { } void -User::fromJsonObject(QJsonObject &pJson) { +SWGUser::fromJsonObject(QJsonObject &pJson) { ::Swagger::setValue(&id, pJson["id"], "qint64", ""); ::Swagger::setValue(&username, pJson["username"], "QString", "QString"); ::Swagger::setValue(&first_name, pJson["firstName"], "QString", "QString"); @@ -99,7 +99,7 @@ User::fromJsonObject(QJsonObject &pJson) { } QString -User::asJson () +SWGUser::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -109,7 +109,7 @@ User::asJson () } QJsonObject* -User::asJsonObject() { +SWGUser::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("id", QJsonValue(id)); @@ -132,74 +132,74 @@ User::asJsonObject() { } qint64 -User::getId() { +SWGUser::getId() { return id; } void -User::setId(qint64 id) { +SWGUser::setId(qint64 id) { this->id = id; } QString* -User::getUsername() { +SWGUser::getUsername() { return username; } void -User::setUsername(QString* username) { +SWGUser::setUsername(QString* username) { this->username = username; } QString* -User::getFirstName() { +SWGUser::getFirstName() { return first_name; } void -User::setFirstName(QString* first_name) { +SWGUser::setFirstName(QString* first_name) { this->first_name = first_name; } QString* -User::getLastName() { +SWGUser::getLastName() { return last_name; } void -User::setLastName(QString* last_name) { +SWGUser::setLastName(QString* last_name) { this->last_name = last_name; } QString* -User::getEmail() { +SWGUser::getEmail() { return email; } void -User::setEmail(QString* email) { +SWGUser::setEmail(QString* email) { this->email = email; } QString* -User::getPassword() { +SWGUser::getPassword() { return password; } void -User::setPassword(QString* password) { +SWGUser::setPassword(QString* password) { this->password = password; } QString* -User::getPhone() { +SWGUser::getPhone() { return phone; } void -User::setPhone(QString* phone) { +SWGUser::setPhone(QString* phone) { this->phone = phone; } qint32 -User::getUserStatus() { +SWGUser::getUserStatus() { return user_status; } void -User::setUserStatus(qint32 user_status) { +SWGUser::setUserStatus(qint32 user_status) { this->user_status = user_status; } diff --git a/samples/client/petstore/qt5cpp/client/User.h b/samples/client/petstore/qt5cpp/client/SWGUser.h similarity index 87% rename from samples/client/petstore/qt5cpp/client/User.h rename to samples/client/petstore/qt5cpp/client/SWGUser.h index 844869d14ae..30a9ca5271b 100644 --- a/samples/client/petstore/qt5cpp/client/User.h +++ b/samples/client/petstore/qt5cpp/client/SWGUser.h @@ -11,13 +11,13 @@ */ /* - * User.h + * SWGUser.h * * A User who is purchasing from the pet store */ -#ifndef User_H_ -#define User_H_ +#ifndef SWGUser_H_ +#define SWGUser_H_ #include @@ -29,18 +29,18 @@ namespace Swagger { -class User: public SWGObject { +class SWGUser: public SWGObject { public: - User(); - User(QString* json); - virtual ~User(); + SWGUser(); + SWGUser(QString* json); + virtual ~SWGUser(); void init(); void cleanup(); QString asJson (); QJsonObject* asJsonObject(); void fromJsonObject(QJsonObject &json); - User* fromJson(QString &jsonString); + SWGUser* fromJson(QString &jsonString); qint64 getId(); void setId(qint64 id); @@ -80,4 +80,4 @@ private: } -#endif /* User_H_ */ +#endif /* SWGUser_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp index 1da5a550490..44fbfe9259a 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp @@ -29,7 +29,7 @@ SWGUserApi::SWGUserApi(QString host, QString basePath) { } void -SWGUserApi::createUser(User body) { +SWGUserApi::createUser(SWGUser body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user"); @@ -71,12 +71,16 @@ SWGUserApi::createUserCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit createUserSignal(); - emit createUserSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit createUserSignal(); + } else { + emit createUserSignalE(error_type, error_str); + emit createUserSignalEFull(worker, error_type, error_str); + } } void -SWGUserApi::createUsersWithArrayInput(QList* body) { +SWGUserApi::createUsersWithArrayInput(QList* body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/createWithArray"); @@ -123,12 +127,16 @@ SWGUserApi::createUsersWithArrayInputCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit createUsersWithArrayInputSignal(); - emit createUsersWithArrayInputSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit createUsersWithArrayInputSignal(); + } else { + emit createUsersWithArrayInputSignalE(error_type, error_str); + emit createUsersWithArrayInputSignalEFull(worker, error_type, error_str); + } } void -SWGUserApi::createUsersWithListInput(QList* body) { +SWGUserApi::createUsersWithListInput(QList* body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/createWithList"); @@ -175,8 +183,12 @@ SWGUserApi::createUsersWithListInputCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit createUsersWithListInputSignal(); - emit createUsersWithListInputSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit createUsersWithListInputSignal(); + } else { + emit createUsersWithListInputSignalE(error_type, error_str); + emit createUsersWithListInputSignalEFull(worker, error_type, error_str); + } } void @@ -222,8 +234,12 @@ SWGUserApi::deleteUserCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit deleteUserSignal(); - emit deleteUserSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit deleteUserSignal(); + } else { + emit deleteUserSignalE(error_type, error_str); + emit deleteUserSignalEFull(worker, error_type, error_str); + } } void @@ -269,11 +285,15 @@ SWGUserApi::getUserByNameCallback(HttpRequestWorker * worker) { QString json(worker->response); - User* output = static_cast(create(json, QString("User"))); + SWGUser* output = static_cast(create(json, QString("SWGUser"))); worker->deleteLater(); - emit getUserByNameSignal(output); - emit getUserByNameSignalE(output, error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit getUserByNameSignal(output); + } else { + emit getUserByNameSignalE(output, error_type, error_str); + emit getUserByNameSignalEFull(worker, error_type, error_str); + } } void @@ -336,8 +356,12 @@ SWGUserApi::loginUserCallback(HttpRequestWorker * worker) { QString* output = static_cast(create(json, QString("QString"))); worker->deleteLater(); - emit loginUserSignal(output); - emit loginUserSignalE(output, error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit loginUserSignal(output); + } else { + emit loginUserSignalE(output, error_type, error_str); + emit loginUserSignalEFull(worker, error_type, error_str); + } } void @@ -381,12 +405,16 @@ SWGUserApi::logoutUserCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit logoutUserSignal(); - emit logoutUserSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit logoutUserSignal(); + } else { + emit logoutUserSignalE(error_type, error_str); + emit logoutUserSignalEFull(worker, error_type, error_str); + } } void -SWGUserApi::updateUser(QString* username, User body) { +SWGUserApi::updateUser(QString* username, SWGUser body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/{username}"); @@ -430,8 +458,12 @@ SWGUserApi::updateUserCallback(HttpRequestWorker * worker) { worker->deleteLater(); - emit updateUserSignal(); - emit updateUserSignalE(error_type, error_str); + if (worker->error_type == QNetworkReply::NoError) { + emit updateUserSignal(); + } else { + emit updateUserSignalE(error_type, error_str); + emit updateUserSignalEFull(worker, error_type, error_str); + } } diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.h b/samples/client/petstore/qt5cpp/client/SWGUserApi.h index 95a03959e9b..3d5fff70ec5 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.h @@ -17,7 +17,7 @@ #include #include -#include "User.h" +#include "SWGUser.h" #include @@ -35,14 +35,14 @@ public: QString basePath; QMap defaultHeaders; - void createUser(User body); - void createUsersWithArrayInput(QList* body); - void createUsersWithListInput(QList* body); + void createUser(SWGUser body); + void createUsersWithArrayInput(QList* body); + void createUsersWithListInput(QList* body); void deleteUser(QString* username); void getUserByName(QString* username); void loginUser(QString* username, QString* password); void logoutUser(); - void updateUser(QString* username, User body); + void updateUser(QString* username, SWGUser body); private: void createUserCallback (HttpRequestWorker * worker); @@ -59,7 +59,7 @@ signals: void createUsersWithArrayInputSignal(); void createUsersWithListInputSignal(); void deleteUserSignal(); - void getUserByNameSignal(User* summary); + void getUserByNameSignal(SWGUser* summary); void loginUserSignal(QString* summary); void logoutUserSignal(); void updateUserSignal(); @@ -68,11 +68,20 @@ signals: void createUsersWithArrayInputSignalE(QNetworkReply::NetworkError error_type, QString& error_str); void createUsersWithListInputSignalE(QNetworkReply::NetworkError error_type, QString& error_str); void deleteUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void getUserByNameSignalE(User* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void getUserByNameSignalE(SWGUser* summary, QNetworkReply::NetworkError error_type, QString& error_str); void loginUserSignalE(QString* summary, QNetworkReply::NetworkError error_type, QString& error_str); void logoutUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); void updateUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void createUserSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void createUsersWithArrayInputSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void createUsersWithListInputSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void deleteUserSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void getUserByNameSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void loginUserSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void logoutUserSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void updateUserSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + }; }