From fa26855a039eb82487acf1403c11c8e4608277b5 Mon Sep 17 00:00:00 2001 From: dan-drl Date: Tue, 6 Aug 2019 13:22:49 -0700 Subject: [PATCH 1/4] Fix issue deserializing to nullptr --- .../languages/CppRestSdkClientCodegen.java | 3 +++ .../cpp-rest-sdk-client/modelbase-source.mustache | 15 +++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) 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 aabac7f7a38c..ddfdcbb0e0b4 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 @@ -359,7 +359,10 @@ public String toDefaultValue(Schema p) { return "new " + toModelName(ModelUtils.getSimpleRef(p.get$ref())) + "()"; } else if (ModelUtils.isStringSchema(p)) { return "utility::conversions::to_string_t(\"\")"; + } else if (ModelUtils.isFreeFormObject(p)) { + return "new Object()"; } + return "nullptr"; } diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-source.mustache index 97f8aea1090d..91446e73a33b 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-source.mustache @@ -265,16 +265,19 @@ std::shared_ptr ModelBase::fromBase64( const utility::string_t& en int64_t ModelBase::int64_tFromJson(const web::json::value& val) { - return val.as_number().to_int64(); + return val.is_null() ? std::numeric_limits::quiet_NaN() : val.as_number().to_int64(); } + int32_t ModelBase::int32_tFromJson(const web::json::value& val) { - return val.as_integer(); + return val.is_null() ? std::numeric_limits::quiet_NaN() : val.as_integer(); } + float ModelBase::floatFromJson(const web::json::value& val) { - return static_cast(val.as_double()); + return val.is_null() ? std::numeric_limits::quiet_NaN() : static_cast(val.as_double()); } + utility::string_t ModelBase::stringFromJson(const web::json::value& val) { return val.is_string() ? val.as_string() : utility::conversions::to_string_t(""); @@ -282,15 +285,15 @@ utility::string_t ModelBase::stringFromJson(const web::json::value& val) utility::datetime ModelBase::dateFromJson(const web::json::value& val) { - return utility::datetime::from_string(val.as_string(), utility::datetime::ISO_8601); + return val.is_null() ? utility::datetime::from_string(L"NULL", utility::datetime::ISO_8601) : utility::datetime::from_string(val.as_string(), utility::datetime::ISO_8601); } bool ModelBase::boolFromJson(const web::json::value& val) { - return val.as_bool(); + return val.is_null() ? false : val.as_bool(); } double ModelBase::doubleFromJson(const web::json::value& val) { - return val.as_double(); + return val.is_null() ? std::numeric_limits::quiet_NaN(): val.as_double(); } int64_t ModelBase::int64_tFromHttpContent(std::shared_ptr val) From 916f482bf783949ee13f6ec2b0396b7385e561a5 Mon Sep 17 00:00:00 2001 From: dan-drl Date: Tue, 6 Aug 2019 14:17:20 -0700 Subject: [PATCH 2/4] Update codegen files --- .../petstore/cpp-restsdk/client/.gitignore | 29 +++++++++++++++++++ .../client/.openapi-generator-ignore | 23 +++++++++++++++ .../client/.openapi-generator/VERSION | 1 + .../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 | 17 ++++++----- .../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 +- 38 files changed, 97 insertions(+), 41 deletions(-) create mode 100644 samples/client/petstore/cpp-restsdk/client/.gitignore create mode 100644 samples/client/petstore/cpp-restsdk/client/.openapi-generator-ignore create mode 100644 samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION diff --git a/samples/client/petstore/cpp-restsdk/client/.gitignore b/samples/client/petstore/cpp-restsdk/client/.gitignore new file mode 100644 index 000000000000..4581ef2eeefc --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/client/.gitignore @@ -0,0 +1,29 @@ +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app diff --git a/samples/client/petstore/cpp-restsdk/client/.openapi-generator-ignore b/samples/client/petstore/cpp-restsdk/client/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/client/.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/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION new file mode 100644 index 000000000000..83a328a9227e --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.1.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 384eb8a8bc54..7322c22305cc 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 5c5d78c765e2..c41ffa71558b 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 251b0d0d2992..6d189ae20915 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 f6f352059908..12701aabdd2c 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 b0a637cf6003..f45ee1f01794 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 30f5ef51df32..882f9941ca76 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 6dedcd299088..595b5368ea5f 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 b357475da38b..aadb725cedd5 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 865bd467f304..de53bbe061d3 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 e2edc1b67ef4..d0a8630ded6e 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 fba123dfc425..cc5132f968a4 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 8b9f859dd6e8..1aab52acc408 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -276,16 +276,19 @@ std::shared_ptr ModelBase::fromBase64( const utility::string_t& en int64_t ModelBase::int64_tFromJson(const web::json::value& val) { - return val.as_number().to_int64(); + return val.is_null() ? std::numeric_limits::quiet_NaN() : val.as_number().to_int64(); } + int32_t ModelBase::int32_tFromJson(const web::json::value& val) { - return val.as_integer(); + return val.is_null() ? std::numeric_limits::quiet_NaN() : val.as_integer(); } + float ModelBase::floatFromJson(const web::json::value& val) { - return static_cast(val.as_double()); + return val.is_null() ? std::numeric_limits::quiet_NaN() : static_cast(val.as_double()); } + utility::string_t ModelBase::stringFromJson(const web::json::value& val) { return val.is_string() ? val.as_string() : utility::conversions::to_string_t(""); @@ -293,15 +296,15 @@ utility::string_t ModelBase::stringFromJson(const web::json::value& val) utility::datetime ModelBase::dateFromJson(const web::json::value& val) { - return utility::datetime::from_string(val.as_string(), utility::datetime::ISO_8601); + return val.is_null() ? utility::datetime::from_string(L"NULL", utility::datetime::ISO_8601) : utility::datetime::from_string(val.as_string(), utility::datetime::ISO_8601); } bool ModelBase::boolFromJson(const web::json::value& val) { - return val.as_bool(); + return val.is_null() ? false : val.as_bool(); } double ModelBase::doubleFromJson(const web::json::value& val) { - return val.as_double(); + return val.is_null() ? std::numeric_limits::quiet_NaN(): val.as_double(); } int64_t ModelBase::int64_tFromHttpContent(std::shared_ptr val) diff --git a/samples/client/petstore/cpp-restsdk/client/ModelBase.h b/samples/client/petstore/cpp-restsdk/client/ModelBase.h index 26459aa58951..903259b35683 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 ec6af2de5e0e..c9dbb87ccbc7 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 96d8c3a662a7..d8eec95b3338 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 3624e24a0172..4ff21f093752 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 bc2c7aa7573c..c688e4f28d6f 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 0c67b5ecbf5b..93e5d8d48973 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 09b2f06da9bc..f95c29ddd4cf 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 a7bcf614ee2e..e991f48b07f2 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 2aaf9bf59699..cc2420fe3ae5 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 a4c4f1bf462b..dadd8fdbe149 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 aa840cf1f900..cce86a501868 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 3fa6061fb049..22a5325268fd 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 9b1d7abc1a72..430d8263a823 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 8d21469964cd..e3dacdc5a71e 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 1d425850a5bb..2f84432cfc52 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 e137a045fa60..e0c8efb0def5 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 9d6975874041..c1dd6cc72a5b 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 76a39be3db67..3f595e302140 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 3ebb80bf285a..875754ec678f 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 a4af089387e2..20585ada3623 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 db92cc2549c9..0ff1241b09f1 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 8ffd2ea50d08..33547426e0ff 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.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 e3a970cb4df7..9ff871a61088 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.0.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ From 1b92d34bdb8068eedc2166ebd224c3343448451d Mon Sep 17 00:00:00 2001 From: dan-drl Date: Fri, 13 Sep 2019 16:15:15 -0700 Subject: [PATCH 3/4] Fix error matching on DataType's value --- .../openapitools/codegen/languages/CppRestSdkClientCodegen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ddfdcbb0e0b4..25be57289d73 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 @@ -242,7 +242,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation if (response != null) { CodegenProperty cm = fromProperty("response", response); op.vendorExtensions.put("x-codegen-response", cm); - if ("HttpContent".equals(cm.dataType)) { + if ("std::shared_ptr".equals(cm.dataType)) { op.vendorExtensions.put("x-codegen-response-ishttpcontent", true); } } From ef0f8a4384935fba7046b1e8f6215ce56c7d4e79 Mon Sep 17 00:00:00 2001 From: dan-drl Date: Fri, 13 Sep 2019 17:28:49 -0700 Subject: [PATCH 4/4] Fix return type. Should be shared pointer --- .../main/resources/cpp-rest-sdk-client/api-source.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-source.mustache index effb911aa827..c3691a55382c 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-source.mustache @@ -294,9 +294,9 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r }) .then([=](std::vector localVarResponse) { - HttpContent localVarResult; + {{{returnType}}} localVarResult; std::shared_ptr stream = std::make_shared(std::string(localVarResponse.begin(), localVarResponse.end())); - localVarResult.setData(stream); + localVarResult->setData(stream); return localVarResult; {{/vendorExtensions.x-codegen-response-ishttpcontent}} {{^vendorExtensions.x-codegen-response-ishttpcontent}}