From 118b5e77473c80eb0e3cbea1413ecf27075c19e3 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 14 Feb 2020 17:58:15 +0800 Subject: [PATCH] [C++] minor improvements (#5319) * minor code format, make sure cpp samples updated * add new files --- bin/utils/ensure-up-to-date | 2 + .../codegen/languages/AbstractCppCodegen.java | 9 ++-- .../languages/CppQt5AbstractCodegen.java | 41 +++++++++---------- .../CppQt5QHttpEngineServerCodegen.java | 7 +--- .../languages/CppRestSdkClientCodegen.java | 4 +- .../client/.openapi-generator/VERSION | 2 +- .../petstore/cpp-restsdk/client/ApiClient.cpp | 2 +- .../petstore/cpp-restsdk/client/ApiClient.h | 2 +- .../cpp-restsdk/client/ApiConfiguration.cpp | 2 +- .../cpp-restsdk/client/ApiConfiguration.h | 2 +- .../cpp-restsdk/client/ApiException.cpp | 2 +- .../cpp-restsdk/client/ApiException.h | 2 +- .../cpp-restsdk/client/HttpContent.cpp | 2 +- .../petstore/cpp-restsdk/client/HttpContent.h | 2 +- .../petstore/cpp-restsdk/client/IHttpBody.h | 2 +- .../petstore/cpp-restsdk/client/JsonBody.cpp | 2 +- .../petstore/cpp-restsdk/client/JsonBody.h | 2 +- .../petstore/cpp-restsdk/client/ModelBase.cpp | 2 +- .../petstore/cpp-restsdk/client/ModelBase.h | 2 +- .../cpp-restsdk/client/MultipartFormData.cpp | 2 +- .../cpp-restsdk/client/MultipartFormData.h | 2 +- .../petstore/cpp-restsdk/client/Object.cpp | 2 +- .../petstore/cpp-restsdk/client/Object.h | 2 +- .../cpp-restsdk/client/api/PetApi.cpp | 2 +- .../petstore/cpp-restsdk/client/api/PetApi.h | 2 +- .../cpp-restsdk/client/api/StoreApi.cpp | 2 +- .../cpp-restsdk/client/api/StoreApi.h | 2 +- .../cpp-restsdk/client/api/UserApi.cpp | 2 +- .../petstore/cpp-restsdk/client/api/UserApi.h | 2 +- .../cpp-restsdk/client/model/ApiResponse.cpp | 2 +- .../cpp-restsdk/client/model/ApiResponse.h | 2 +- .../cpp-restsdk/client/model/Category.cpp | 2 +- .../cpp-restsdk/client/model/Category.h | 2 +- .../cpp-restsdk/client/model/Order.cpp | 2 +- .../petstore/cpp-restsdk/client/model/Order.h | 2 +- .../petstore/cpp-restsdk/client/model/Pet.cpp | 2 +- .../petstore/cpp-restsdk/client/model/Pet.h | 2 +- .../petstore/cpp-restsdk/client/model/Tag.cpp | 2 +- .../petstore/cpp-restsdk/client/model/Tag.h | 2 +- .../cpp-restsdk/client/model/User.cpp | 2 +- .../petstore/cpp-restsdk/client/model/User.h | 2 +- .../.openapi-generator-ignore | 23 +++++++++++ .../.openapi-generator/VERSION | 1 + .../server/src/models/OAIHelpers.cpp | 13 ++++++ 44 files changed, 101 insertions(+), 71 deletions(-) create mode 100644 samples/server/petstore/cpp-qt5-qhttpengine-server/.openapi-generator-ignore create mode 100644 samples/server/petstore/cpp-qt5-qhttpengine-server/.openapi-generator/VERSION diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index 9d03f59123b..775641dbccc 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -82,6 +82,8 @@ declare -a samples=( "${root}/bin/java-play-framework-petstore-server-all.sh" #"${root}/bin/elm-petstore-all.sh" "${root}/bin/typescript-redux-query-petstore-with-npm-version.sh" +"${root}/bin/cpp-restsdk-petstore.sh" +"${root}/bin/cpp-qt5-qhttpengine-server-petstore.sh" ) # Some special case generators may expect to be run as a stanalone process (e.g. modifying classpath) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java index c49f5681e5d..454b9de0512 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java @@ -19,7 +19,6 @@ package org.openapitools.codegen.languages; import com.google.common.collect.ImmutableMap.Builder; import com.samskivert.mustache.Mustache.Lambda; - import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.media.Schema; import org.apache.commons.io.FilenameUtils; @@ -302,17 +301,17 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg String host = url.getHost(); String scheme = url.getProtocol(); - if(!port.isEmpty()) { + if (!port.isEmpty()) { this.additionalProperties.put("serverPort", port); } - if(!host.isEmpty()) { + if (!host.isEmpty()) { this.additionalProperties.put("serverHost", host); } - if(!scheme.isEmpty()) { + if (!scheme.isEmpty()) { this.additionalProperties.put("scheme", scheme); } } - + @Override public Map postProcessModels(Map objs) { return postProcessModelsEnum(objs); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5AbstractCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5AbstractCodegen.java index a3747679c4c..82e4364eb91 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5AbstractCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5AbstractCodegen.java @@ -4,11 +4,7 @@ import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.util.SchemaTypeUtil; import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.CodegenConfig; -import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.CodegenModel; -import org.openapitools.codegen.CodegenOperation; -import org.openapitools.codegen.CodegenParameter; +import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -130,6 +126,7 @@ public class CppQt5AbstractCodegen extends AbstractCppCodegen implements Codegen systemIncludes.add("QDateTime"); systemIncludes.add("QByteArray"); } + @Override public void processOpts() { super.processOpts(); @@ -154,7 +151,7 @@ public class CppQt5AbstractCodegen extends AbstractCppCodegen implements Codegen @Override public String toModelImport(String name) { - if( name.isEmpty() ) { + if (name.isEmpty()) { return null; } @@ -162,7 +159,7 @@ public class CppQt5AbstractCodegen extends AbstractCppCodegen implements Codegen return "using " + namespaces.get(name) + ";"; } else if (systemIncludes.contains(name)) { return "#include <" + name + ">"; - } else if(importMapping.containsKey(name)){ + } else if (importMapping.containsKey(name)) { return importMapping.get(name); } @@ -317,20 +314,20 @@ public class CppQt5AbstractCodegen extends AbstractCppCodegen implements Codegen List operations = (List) objectMap.get("operation"); List> imports = (List>) objs.get("imports"); - Map codegenModels = new HashMap (); + Map codegenModels = new HashMap(); // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for(Object moObj : allModels) { + for (Object moObj : allModels) { CodegenModel mo = ((Map) moObj).get("model"); - if(mo.isEnum) { + if (mo.isEnum) { codegenModels.put(mo.classname, mo); } } for (CodegenOperation operation : operations) { - if(operation.returnType != null) { - if(codegenModels.containsKey(operation.returnType)){ + if (operation.returnType != null) { + if (codegenModels.containsKey(operation.returnType)) { operation.vendorExtensions.put("returnsEnum", true); // TODO: 5.0 Remove operation.vendorExtensions.put("x-returns-enum", true); } @@ -338,32 +335,32 @@ public class CppQt5AbstractCodegen extends AbstractCppCodegen implements Codegen // Check all return parameter baseType if there is a necessity to include, include it if not // already done if (operation.returnBaseType != null && needToImport(operation.returnBaseType)) { - if(!isIncluded(operation.returnBaseType, imports)) { + if (!isIncluded(operation.returnBaseType, imports)) { imports.add(createMapping("import", operation.returnBaseType)); } } List params = new ArrayList(); - if (operation.allParams != null)params.addAll(operation.allParams); + if (operation.allParams != null) params.addAll(operation.allParams); // Check all parameter baseType if there is a necessity to include, include it if not // already done - for(CodegenParameter param : params) { - if(param.isPrimitiveType && needToImport(param.baseType)) { - if(!isIncluded(param.baseType, imports)) { + for (CodegenParameter param : params) { + if (param.isPrimitiveType && needToImport(param.baseType)) { + if (!isIncluded(param.baseType, imports)) { imports.add(createMapping("import", param.baseType)); } } } if (operation.pathParams != null) { // We use QString to pass path params, add it to include - if(!isIncluded("QString", imports)) { + if (!isIncluded("QString", imports)) { imports.add(createMapping("import", "QString")); } } } - if(isIncluded("QMap", imports)) { + if (isIncluded("QMap", imports)) { // Maps uses QString as key - if(!isIncluded("QString", imports)) { + if (!isIncluded("QString", imports)) { imports.add(createMapping("import", "QString")); } } @@ -390,14 +387,14 @@ public class CppQt5AbstractCodegen extends AbstractCppCodegen implements Codegen boolean included = false; String inclStr = toModelImport(type); for (Map importItem : imports) { - if(importItem.containsValue(inclStr)) { + if (importItem.containsValue(inclStr)) { included = true; break; } } return included; } - + public void setContentCompressionEnabled(boolean flag) { this.isContentCompressionEnabled = flag; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5QHttpEngineServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5QHttpEngineServerCodegen.java index 74f668f369c..3f33b21f8d3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5QHttpEngineServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5QHttpEngineServerCodegen.java @@ -17,19 +17,14 @@ package org.openapitools.codegen.languages; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.servers.Server; - import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.meta.features.DocumentationFeature; -import org.openapitools.codegen.utils.URLPathUtils; import java.io.File; -import java.net.URL; -import static org.openapitools.codegen.utils.StringUtils.*; +import static org.openapitools.codegen.utils.StringUtils.camelize; public class CppQt5QHttpEngineServerCodegen extends CppQt5AbstractCodegen implements CodegenConfig { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java index cd9aa946d20..3f16079147e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java @@ -265,7 +265,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { if (response != null) { CodegenProperty cm = fromProperty("response", response); op.vendorExtensions.put("x-codegen-response", cm); - if ("std::shared_ptr".equals(cm.dataType)) { + if ("std::shared_ptr".equals(cm.dataType)) { op.vendorExtensions.put("x-codegen-response-ishttpcontent", true); } } @@ -385,7 +385,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { } else if (ModelUtils.isFreeFormObject(p)) { return "new Object()"; } - + return "nullptr"; } diff --git a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION index 58592f031f6..bfbf77eb7fa 100644 --- a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION +++ b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.3-SNAPSHOT \ No newline at end of file +4.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp b/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp index 75283d69803..773067218c0 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ApiClient.h b/samples/client/petstore/cpp-restsdk/client/ApiClient.h index 79539f4e5a4..a89fd1ee5bd 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiClient.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiClient.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp index 5dc67553286..5153a172ba6 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h index 232ffbf77d7..82190fa9a79 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ApiException.cpp b/samples/client/petstore/cpp-restsdk/client/ApiException.cpp index cb9857d1a66..e15af69bb03 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiException.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiException.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ApiException.h b/samples/client/petstore/cpp-restsdk/client/ApiException.h index 6415d664499..146c84e88ef 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiException.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiException.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp b/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp index f7b6ac6e55b..92289ec7ad1 100644 --- a/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp +++ b/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/HttpContent.h b/samples/client/petstore/cpp-restsdk/client/HttpContent.h index 0a3fcd1cf2a..fefd179c25a 100644 --- a/samples/client/petstore/cpp-restsdk/client/HttpContent.h +++ b/samples/client/petstore/cpp-restsdk/client/HttpContent.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/IHttpBody.h b/samples/client/petstore/cpp-restsdk/client/IHttpBody.h index 771253a0afb..f941649a65e 100644 --- a/samples/client/petstore/cpp-restsdk/client/IHttpBody.h +++ b/samples/client/petstore/cpp-restsdk/client/IHttpBody.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp b/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp index e25ec322e01..59c7c2d6d87 100644 --- a/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp +++ b/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/JsonBody.h b/samples/client/petstore/cpp-restsdk/client/JsonBody.h index 19010c9792c..39a3b22617a 100644 --- a/samples/client/petstore/cpp-restsdk/client/JsonBody.h +++ b/samples/client/petstore/cpp-restsdk/client/JsonBody.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp b/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp index 390dcece5dd..d3fd80b5544 100644 --- a/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ModelBase.h b/samples/client/petstore/cpp-restsdk/client/ModelBase.h index f322d9dd853..2d33fbe33cb 100644 --- a/samples/client/petstore/cpp-restsdk/client/ModelBase.h +++ b/samples/client/petstore/cpp-restsdk/client/ModelBase.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp index e590dff2949..5e840c1acbb 100644 --- a/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp +++ b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h index 7c1b20557c7..fac570cc749 100644 --- a/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h +++ b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/Object.cpp b/samples/client/petstore/cpp-restsdk/client/Object.cpp index 3504a373de6..6c0e441a9fc 100644 --- a/samples/client/petstore/cpp-restsdk/client/Object.cpp +++ b/samples/client/petstore/cpp-restsdk/client/Object.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/Object.h b/samples/client/petstore/cpp-restsdk/client/Object.h index 06f5838eec1..6f3a186ba51 100644 --- a/samples/client/petstore/cpp-restsdk/client/Object.h +++ b/samples/client/petstore/cpp-restsdk/client/Object.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp index 05aae4abf11..bf7611ae8c8 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/PetApi.h b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h index 24223f369c3..3be4f0aa73d 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/PetApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp index 47a281f656d..994335d4fe2 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h index 5d39027c629..b58b1ca47c5 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp index 690ef145d1a..7f2ffec929a 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/UserApi.h b/samples/client/petstore/cpp-restsdk/client/api/UserApi.h index 2d52a8a806e..3b57e37bfad 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/UserApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/UserApi.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp index 0926ff9f79d..2e1ba85a6c2 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h index 957c1ff2a6a..530171c4aa7 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h +++ b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Category.cpp b/samples/client/petstore/cpp-restsdk/client/model/Category.cpp index 13f9673375c..e710f6448c9 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Category.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Category.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Category.h b/samples/client/petstore/cpp-restsdk/client/model/Category.h index 7b93a138b9b..f35054c6d45 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Category.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Category.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Order.cpp b/samples/client/petstore/cpp-restsdk/client/model/Order.cpp index 6ea42229fba..f3f6659de71 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Order.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Order.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Order.h b/samples/client/petstore/cpp-restsdk/client/model/Order.h index 6d40801ddca..d1d2239d7f8 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Order.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Order.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp index 4985d78db5f..728c051d5cd 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Pet.h b/samples/client/petstore/cpp-restsdk/client/model/Pet.h index e33108f1769..bbc0a09cac6 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Pet.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Pet.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp index 7b13e6ca4f5..b1a7598237e 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Tag.h b/samples/client/petstore/cpp-restsdk/client/model/Tag.h index 5b9d769a8d1..a9153548fbd 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Tag.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Tag.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/User.cpp b/samples/client/petstore/cpp-restsdk/client/model/User.cpp index 18d4b39c3b3..f0fa581f868 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/User.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/User.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/User.h b/samples/client/petstore/cpp-restsdk/client/model/User.h index 4b2513ce248..b66202fccfa 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/User.h +++ b/samples/client/petstore/cpp-restsdk/client/model/User.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/.openapi-generator-ignore b/samples/server/petstore/cpp-qt5-qhttpengine-server/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/.openapi-generator/VERSION b/samples/server/petstore/cpp-qt5-qhttpengine-server/.openapi-generator/VERSION new file mode 100644 index 00000000000..bfbf77eb7fa --- /dev/null +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIHelpers.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIHelpers.cpp index e4138649b5a..f925722d154 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIHelpers.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIHelpers.cpp @@ -11,6 +11,7 @@ */ #include +#include #include "OAIHelpers.h" @@ -230,6 +231,18 @@ fromStringValue(const QString &inStr, double &value){ return ok; } +bool +fromStringValue(const QString &inStr, OAIObject &value) +{ + QJsonParseError err; + QJsonDocument::fromJson(inStr.toUtf8(),&err); + if ( err.error == QJsonParseError::NoError ){ + value.fromJson(inStr); + return true; + } + return false; +} + bool fromStringValue(const QString &inStr, OAIEnum &value){ value.fromJson(inStr);