From 8d398719c99fbcbfa6471e0bb938f9d384454f8f Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 1 Jun 2024 19:04:03 +0800 Subject: [PATCH] Revert "[cpp-restsdk] add support for oneOf via std::variant (#18474)" (#18820) This reverts commit 6a3d406690a732486af8f32a63c9dbdcdb47e8c5. --- docs/generators/cpp-restsdk.md | 2 +- .../languages/CppRestSdkClientCodegen.java | 3 +- .../cpp-rest-sdk-client/api-source.mustache | 6 +- .../cpp-rest-sdk-client/cmake-lists.mustache | 25 +-- .../cpp-rest-sdk-client/model-header.mustache | 56 ------ .../cpp-rest-sdk-client/model-source.mustache | 50 ----- .../resources/3_0/cpp-restsdk/petstore.yaml | 21 --- .../client/.openapi-generator/FILES | 4 - .../cpp-restsdk/client/CMakeLists.txt | 25 +-- .../CppRestPetstoreClient/api/UserOrPetApi.h | 66 ------- .../CppRestPetstoreClient/model/ApiResponse.h | 1 - .../CppRestPetstoreClient/model/Category.h | 1 - .../model/CreateUserOrPet_request.h | 98 ---------- .../CppRestPetstoreClient/model/Order.h | 1 - .../include/CppRestPetstoreClient/model/Pet.h | 1 - .../include/CppRestPetstoreClient/model/Tag.h | 1 - .../CppRestPetstoreClient/model/User.h | 1 - .../petstore/cpp-restsdk/client/pom.xml | 11 +- .../cpp-restsdk/client/src/api/PetApi.cpp | 32 ++-- .../cpp-restsdk/client/src/api/StoreApi.cpp | 16 +- .../cpp-restsdk/client/src/api/UserApi.cpp | 32 ++-- .../client/src/api/UserOrPetApi.cpp | 177 ------------------ .../src/model/CreateUserOrPet_request.cpp | 74 -------- 23 files changed, 60 insertions(+), 644 deletions(-) delete mode 100644 samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserOrPetApi.h delete mode 100644 samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/CreateUserOrPet_request.h delete mode 100644 samples/client/petstore/cpp-restsdk/client/src/api/UserOrPetApi.cpp delete mode 100644 samples/client/petstore/cpp-restsdk/client/src/model/CreateUserOrPet_request.cpp diff --git a/docs/generators/cpp-restsdk.md b/docs/generators/cpp-restsdk.md index f8095ede9104..aef6bfe1c397 100644 --- a/docs/generators/cpp-restsdk.md +++ b/docs/generators/cpp-restsdk.md @@ -249,7 +249,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |Union|✗|OAS3 |allOf|✗|OAS2,OAS3 |anyOf|✗|OAS3 -|oneOf|✓|OAS3 +|oneOf|✗|OAS3 |not|✗|OAS3 ### Security Feature 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 a802ea26f878..19e8dfdf504d 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 @@ -105,8 +105,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { GlobalFeature.MultiServer ) .includeSchemaSupportFeatures( - SchemaSupportFeature.Polymorphism, - SchemaSupportFeature.oneOf + SchemaSupportFeature.Polymorphism ) .excludeParameterFeatures( ParameterFeature.Cookie 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 f4275fd66e94..5338b5a9dc2a 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 @@ -265,7 +265,7 @@ pplx::task<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{classname}}::{{ {{/authMethods}} return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("{{httpMethod}}"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -299,7 +299,7 @@ pplx::task<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{classname}}::{{ {{#vendorExtensions.x-codegen-response-ishttpcontent}} return localVarResponse.extract_vector(); }) - .then([=, this](std::vector localVarResponse) + .then([=](std::vector localVarResponse) { {{{returnType}}} localVarResult = std::make_shared(); std::shared_ptr stream = std::make_shared(std::string(localVarResponse.begin(), localVarResponse.end())); @@ -309,7 +309,7 @@ pplx::task<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{classname}}::{{ {{^vendorExtensions.x-codegen-response-ishttpcontent}} return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { {{^returnType}} return void(); diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache index f3b23e27b311..0b21eeb050c8 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache @@ -8,27 +8,16 @@ # # NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech). -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.1) -project({{{packageName}}} CXX) +project({{{packageName}}}) # Force -fPIC even if the project is configured for building a static library. set(CMAKE_POSITION_INDEPENDENT_CODE ON) - set(CXX_STANDARD_REQUIRED ON) + if(NOT CMAKE_CXX_STANDARD) - if(DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION OR - DEFINED CMAKE_CXX20_EXTENSION_COMPILE_OPTION) - set(CMAKE_CXX_STANDARD 20) - elseif(DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION OR - DEFINED CMAKE_CXX17_EXTENSION_COMPILE_OPTION) - set(CMAKE_CXX_STANDARD 17) - elseif(DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION OR - DEFINED CMAKE_CXX14_EXTENSION_COMPILE_OPTION) - set(CMAKE_CXX_STANDARD 14) - else() - set(CMAKE_CXX_STANDARD 11) - endif() + set(CMAKE_CXX_STANDARD 14) endif() if(NOT CMAKE_BUILD_TYPE) @@ -49,12 +38,12 @@ add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES}) target_compile_options(${PROJECT_NAME} PRIVATE $<$,$,$>: - -Wall -Wno-unused-variable -Wno-unused-lambda-capture> + -Wall -Wno-unused-variable> ) target_include_directories(${PROJECT_NAME} PUBLIC - $ + $ $ ) @@ -101,4 +90,4 @@ install( install( EXPORT ${PROJECT_NAME}Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} -) +) \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache index 48859cf019e3..b5f070074df6 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache @@ -24,61 +24,6 @@ namespace {{this}} { {{#vendorExtensions.x-forward-declarations}}{{.}} {{/vendorExtensions.x-forward-declarations}} {{/vendorExtensions.x-has-forward-declarations}} -{{#oneOf}}{{#-first}} -#include - -class {{declspec}} {{classname}} -{ -public: - {{classname}}() = default; - ~{{classname}}() = default; - - ///////////////////////////////////////////// - - void validate(); - - web::json::value toJson() const; - - template - bool fromJson(const web::json::value& json) { - // convert json to Target type - Target target; - if (!target.fromJson(json)) { - return false; - } - - m_variantValue = target; - return true; - } - - void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const; - - template - bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) { - // convert multipart to Target type - Target target; - if (!target.fromMultiPart(multipart, namePrefix)) { - return false; - } - - m_variantValue = target; - return true; - } - - ///////////////////////////////////////////// - /// {{classname}} members - - using VariantType = std::variant<{{#oneOf}}{{^-first}}, {{/-first}}{{{.}}}{{/oneOf}}>; - - const VariantType& getVariant() const; - void setVariant(VariantType value); - -protected: - VariantType m_variantValue; -}; - -{{/-first}}{{/oneOf}} -{{^oneOf}} {{#isEnum}} class {{declspec}} {{classname}} : public {{{parent}}}{{^parent}}ModelBase{{/parent}} @@ -175,7 +120,6 @@ protected: }; {{/isEnum}} -{{/oneOf}} {{#modelNamespaceDeclarations}} } diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache index 49e9894da568..e8d2ea96a402 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache @@ -6,56 +6,7 @@ {{#modelNamespaceDeclarations}} namespace {{this}} { {{/modelNamespaceDeclarations}} -{{#oneOf}}{{#-first}} -void {{classname}}::validate() -{ - // TODO: implement validation -} - -const {{classname}}::VariantType& {{classname}}::getVariant() const -{ - return m_variantValue; -} - -void {{classname}}::setVariant({{classname}}::VariantType value) -{ - m_variantValue = value; -} - -web::json::value {{classname}}::toJson() const -{ - web::json::value val = web::json::value::object(); - - std::visit([&](auto&& arg) { - using T = std::decay_t; - if constexpr (std::is_same_v) { - val = web::json::value::null(); - } else { - val = arg.toJson(); - } - }, m_variantValue); - - return val; -} - -void {{classname}}::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const -{ - std::visit([&](auto&& arg) { - using T = std::decay_t; - if constexpr (!std::is_same_v) { - arg.toMultipart(multipart, prefix); - } - }, m_variantValue); -} - -{{#oneOf}} -template bool {{classname}}::fromJson<{{.}}>(const web::json::value& json); -template bool {{classname}}::fromMultiPart<{{.}}>(std::shared_ptr multipart, const utility::string_t& namePrefix); -{{/oneOf}} - -{{/-first}}{{/oneOf}} -{{^oneOf}} {{#isEnum}} namespace @@ -318,7 +269,6 @@ void {{classname}}::unset{{name}}() {{/isInherited}} {{/vars}} {{/isEnum}} -{{/oneOf}} {{#modelNamespaceDeclarations}} } {{/modelNamespaceDeclarations}} diff --git a/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml index 28dc856f83e1..64ca7deaaf89 100644 --- a/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml @@ -569,27 +569,6 @@ paths: description: User not found security: - api_key: [] - /user_or_pet: - post: - tags: - - user_or_pet - summary: Create user or pet - description: This can only be done by the logged in user or pet. - operationId: createUserOrPet - responses: - default: - description: successful operation - security: - - api_key: [] - requestBody: - content: - application/json: - schema: - oneOf: - - $ref: '#/components/schemas/User' - - $ref: '#/components/schemas/Pet' - description: Created user or pet object - required: true externalDocs: description: Find out more about Swagger url: 'http://swagger.io' diff --git a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES index 0570b3e661c6..06401fbfbce3 100644 --- a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES +++ b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES @@ -16,10 +16,8 @@ include/CppRestPetstoreClient/Object.h include/CppRestPetstoreClient/api/PetApi.h include/CppRestPetstoreClient/api/StoreApi.h include/CppRestPetstoreClient/api/UserApi.h -include/CppRestPetstoreClient/api/UserOrPetApi.h include/CppRestPetstoreClient/model/ApiResponse.h include/CppRestPetstoreClient/model/Category.h -include/CppRestPetstoreClient/model/CreateUserOrPet_request.h include/CppRestPetstoreClient/model/Order.h include/CppRestPetstoreClient/model/Pet.h include/CppRestPetstoreClient/model/SchemaWithSet.h @@ -39,10 +37,8 @@ src/Object.cpp src/api/PetApi.cpp src/api/StoreApi.cpp src/api/UserApi.cpp -src/api/UserOrPetApi.cpp src/model/ApiResponse.cpp src/model/Category.cpp -src/model/CreateUserOrPet_request.cpp src/model/Order.cpp src/model/Pet.cpp src/model/SchemaWithSet.cpp diff --git a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt index 4c8236584363..1212e2c4d0fd 100644 --- a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt +++ b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt @@ -8,27 +8,16 @@ # # NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech). -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.1) -project(CppRestPetstoreClient CXX) +project(CppRestPetstoreClient) # Force -fPIC even if the project is configured for building a static library. set(CMAKE_POSITION_INDEPENDENT_CODE ON) - set(CXX_STANDARD_REQUIRED ON) + if(NOT CMAKE_CXX_STANDARD) - if(DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION OR - DEFINED CMAKE_CXX20_EXTENSION_COMPILE_OPTION) - set(CMAKE_CXX_STANDARD 20) - elseif(DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION OR - DEFINED CMAKE_CXX17_EXTENSION_COMPILE_OPTION) - set(CMAKE_CXX_STANDARD 17) - elseif(DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION OR - DEFINED CMAKE_CXX14_EXTENSION_COMPILE_OPTION) - set(CMAKE_CXX_STANDARD 14) - else() - set(CMAKE_CXX_STANDARD 11) - endif() + set(CMAKE_CXX_STANDARD 14) endif() if(NOT CMAKE_BUILD_TYPE) @@ -49,12 +38,12 @@ add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES}) target_compile_options(${PROJECT_NAME} PRIVATE $<$,$,$>: - -Wall -Wno-unused-variable -Wno-unused-lambda-capture> + -Wall -Wno-unused-variable> ) target_include_directories(${PROJECT_NAME} PUBLIC - $ + $ $ ) @@ -101,4 +90,4 @@ install( install( EXPORT ${PROJECT_NAME}Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} -) +) \ No newline at end of file diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserOrPetApi.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserOrPetApi.h deleted file mode 100644 index 0cdff5070966..000000000000 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserOrPetApi.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * The version of the OpenAPI document: 1.0.0 - * - * NOTE: This class is auto generated by OpenAPI-Generator 7.6.0-SNAPSHOT. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/* - * UserOrPetApi.h - * - * - */ - -#ifndef ORG_OPENAPITOOLS_CLIENT_API_UserOrPetApi_H_ -#define ORG_OPENAPITOOLS_CLIENT_API_UserOrPetApi_H_ - - - -#include "CppRestPetstoreClient/ApiClient.h" - -#include "CppRestPetstoreClient/model/CreateUserOrPet_request.h" -#include - -namespace org { -namespace openapitools { -namespace client { -namespace api { - -using namespace org::openapitools::client::model; - - - -class UserOrPetApi -{ -public: - - explicit UserOrPetApi( std::shared_ptr apiClient ); - - virtual ~UserOrPetApi(); - - /// - /// Create user or pet - /// - /// - /// This can only be done by the logged in user or pet. - /// - /// Created user or pet object - pplx::task createUserOrPet( - std::shared_ptr createUserOrPetRequest - ) const; - -protected: - std::shared_ptr m_ApiClient; -}; - -} -} -} -} - -#endif /* ORG_OPENAPITOOLS_CLIENT_API_UserOrPetApi_H_ */ - diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h index 9ac0849a547b..51070cb4ebf5 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h @@ -29,7 +29,6 @@ namespace client { namespace model { - /// /// Describes the result of uploading an image resource /// diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h index 72b3bd910995..56c2e158283b 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h @@ -29,7 +29,6 @@ namespace client { namespace model { - /// /// A category for a pet /// diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/CreateUserOrPet_request.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/CreateUserOrPet_request.h deleted file mode 100644 index fca485b639a0..000000000000 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/CreateUserOrPet_request.h +++ /dev/null @@ -1,98 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * The version of the OpenAPI document: 1.0.0 - * - * NOTE: This class is auto generated by OpenAPI-Generator 7.6.0-SNAPSHOT. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/* - * CreateUserOrPet_request.h - * - * - */ - -#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_CreateUserOrPet_request_H_ -#define ORG_OPENAPITOOLS_CLIENT_MODEL_CreateUserOrPet_request_H_ - - -#include "CppRestPetstoreClient/ModelBase.h" - -#include "CppRestPetstoreClient/model/User.h" -#include "CppRestPetstoreClient/model/Tag.h" -#include "CppRestPetstoreClient/model/Category.h" -#include -#include "CppRestPetstoreClient/model/Pet.h" -#include - -namespace org { -namespace openapitools { -namespace client { -namespace model { - -class Category; -class Tag; - -#include - -class CreateUserOrPet_request -{ -public: - CreateUserOrPet_request() = default; - ~CreateUserOrPet_request() = default; - - ///////////////////////////////////////////// - - void validate(); - - web::json::value toJson() const; - - template - bool fromJson(const web::json::value& json) { - // convert json to Target type - Target target; - if (!target.fromJson(json)) { - return false; - } - - m_variantValue = target; - return true; - } - - void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const; - - template - bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) { - // convert multipart to Target type - Target target; - if (!target.fromMultiPart(multipart, namePrefix)) { - return false; - } - - m_variantValue = target; - return true; - } - - ///////////////////////////////////////////// - /// CreateUserOrPet_request members - - using VariantType = std::variant; - - const VariantType& getVariant() const; - void setVariant(VariantType value); - -protected: - VariantType m_variantValue; -}; - - - -} -} -} -} - -#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_CreateUserOrPet_request_H_ */ diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h index 929b9cadd861..aa553ee97684 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h @@ -29,7 +29,6 @@ namespace client { namespace model { - /// /// An order for a pets from the pet store /// diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h index 8efc8946566e..b00392e43c6d 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h @@ -34,7 +34,6 @@ namespace model { class Category; class Tag; - /// /// A pet for sale in the pet store /// diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h index 0d515b01d279..078b2fb0f77c 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h @@ -29,7 +29,6 @@ namespace client { namespace model { - /// /// A tag for a pet /// diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h index 294358d30e32..79199c5a76be 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h @@ -29,7 +29,6 @@ namespace client { namespace model { - /// /// A User who is purchasing from the pet store /// diff --git a/samples/client/petstore/cpp-restsdk/client/pom.xml b/samples/client/petstore/cpp-restsdk/client/pom.xml index b9113db04229..f127ec6ede34 100644 --- a/samples/client/petstore/cpp-restsdk/client/pom.xml +++ b/samples/client/petstore/cpp-restsdk/client/pom.xml @@ -35,11 +35,8 @@ cmake - -S=${project.basedir} - -B=${project.build.directory} -DCMAKE_CXX_FLAGS="-I/usr/local/opt/openssl/include" -DCMAKE_MODULE_LINKER_FLAGS="-L/usr/local/opt/openssl/lib" - -DCMAKE_BUILD_TYPE=Debug @@ -50,13 +47,7 @@ exec - cmake - - --build - ${project.build.directory} - --config=Debug - --parallel - + make diff --git a/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp b/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp index 10063efefc4f..65a4c04cf920 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp @@ -128,7 +128,7 @@ pplx::task> PetApi::addPet(std::shared_ptr pet) const // oauth2 authentication is added automatically as part of the http_client_config return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -161,7 +161,7 @@ pplx::task> PetApi::addPet(std::shared_ptr pet) const return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { std::shared_ptr localVarResult(new Pet()); @@ -256,7 +256,7 @@ pplx::task PetApi::deletePet(int64_t petId, boost::optionalcallApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -289,7 +289,7 @@ pplx::task PetApi::deletePet(int64_t petId, boost::optional>> PetApi::findPetsByStatus(std::vect // oauth2 authentication is added automatically as part of the http_client_config return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -399,7 +399,7 @@ pplx::task>> PetApi::findPetsByStatus(std::vect return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { std::vector> localVarResult; @@ -498,7 +498,7 @@ pplx::task>> PetApi::findPetsByTags(std::vector // oauth2 authentication is added automatically as part of the http_client_config return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -531,7 +531,7 @@ pplx::task>> PetApi::findPetsByTags(std::vector return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { std::vector> localVarResult; @@ -634,7 +634,7 @@ pplx::task> PetApi::getPetById(int64_t petId) const } return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -667,7 +667,7 @@ pplx::task> PetApi::getPetById(int64_t petId) const return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { std::shared_ptr localVarResult(new Pet()); @@ -783,7 +783,7 @@ pplx::task> PetApi::updatePet(std::shared_ptr pet) con // oauth2 authentication is added automatically as part of the http_client_config return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -816,7 +816,7 @@ pplx::task> PetApi::updatePet(std::shared_ptr pet) con return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { std::shared_ptr localVarResult(new Pet()); @@ -916,7 +916,7 @@ pplx::task PetApi::updatePetWithForm(int64_t petId, boost::optionalcallApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -949,7 +949,7 @@ pplx::task PetApi::updatePetWithForm(int64_t petId, boost::optional> PetApi::uploadFile(int64_t petId, boost // oauth2 authentication is added automatically as part of the http_client_config return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -1065,7 +1065,7 @@ pplx::task> PetApi::uploadFile(int64_t petId, boost return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { std::shared_ptr localVarResult(new ApiResponse()); diff --git a/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp index 9b0cb610dc35..3ac1ae0f7538 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp @@ -101,7 +101,7 @@ pplx::task StoreApi::deleteOrder(utility::string_t orderId) const return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -134,7 +134,7 @@ pplx::task StoreApi::deleteOrder(utility::string_t orderId) const return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -213,7 +213,7 @@ pplx::task> StoreApi::getInventory() const } return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -246,7 +246,7 @@ pplx::task> StoreApi::getInventory() const return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { std::map localVarResult; @@ -342,7 +342,7 @@ pplx::task> StoreApi::getOrderById(int64_t orderId) const return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -375,7 +375,7 @@ pplx::task> StoreApi::getOrderById(int64_t orderId) const return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { std::shared_ptr localVarResult(new Order()); @@ -488,7 +488,7 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr o return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -521,7 +521,7 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr o return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { std::shared_ptr localVarResult(new Order()); diff --git a/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp index 65811119fcd2..0b1e6bd1f485 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp @@ -131,7 +131,7 @@ pplx::task UserApi::createUser(std::shared_ptr user) const } return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -164,7 +164,7 @@ pplx::task UserApi::createUser(std::shared_ptr user) const return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -270,7 +270,7 @@ pplx::task UserApi::createUsersWithArrayInput(std::vectorcallApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -303,7 +303,7 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector UserApi::createUsersWithListInput(std::vectorcallApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -442,7 +442,7 @@ pplx::task UserApi::createUsersWithListInput(std::vector UserApi::deleteUser(utility::string_t username) const } return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -554,7 +554,7 @@ pplx::task UserApi::deleteUser(utility::string_t username) const return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -627,7 +627,7 @@ pplx::task> UserApi::getUserByName(utility::string_t usern return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -660,7 +660,7 @@ pplx::task> UserApi::getUserByName(utility::string_t usern return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { std::shared_ptr localVarResult(new User()); @@ -761,7 +761,7 @@ pplx::task UserApi::loginUser(utility::string_t username, uti return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -794,7 +794,7 @@ pplx::task UserApi::loginUser(utility::string_t username, uti return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { utility::string_t localVarResult(utility::conversions::to_string_t("")); @@ -894,7 +894,7 @@ pplx::task UserApi::logoutUser() const } return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -927,7 +927,7 @@ pplx::task UserApi::logoutUser() const return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -1029,7 +1029,7 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr } return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) + .then([=](web::http::http_response localVarResponse) { if (m_ApiClient->getResponseHandler()) { @@ -1062,7 +1062,7 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr return localVarResponse.extract_string(); }) - .then([=, this](utility::string_t localVarResponse) + .then([=](utility::string_t localVarResponse) { return void(); }); diff --git a/samples/client/petstore/cpp-restsdk/client/src/api/UserOrPetApi.cpp b/samples/client/petstore/cpp-restsdk/client/src/api/UserOrPetApi.cpp deleted file mode 100644 index c6f106804a20..000000000000 --- a/samples/client/petstore/cpp-restsdk/client/src/api/UserOrPetApi.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * The version of the OpenAPI document: 1.0.0 - * - * NOTE: This class is auto generated by OpenAPI-Generator 7.6.0-SNAPSHOT. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -#include "CppRestPetstoreClient/api/UserOrPetApi.h" -#include "CppRestPetstoreClient/IHttpBody.h" -#include "CppRestPetstoreClient/JsonBody.h" -#include "CppRestPetstoreClient/MultipartFormData.h" - -#include - -#include - -namespace org { -namespace openapitools { -namespace client { -namespace api { - -using namespace org::openapitools::client::model; - -UserOrPetApi::UserOrPetApi( std::shared_ptr apiClient ) - : m_ApiClient(apiClient) -{ -} - -UserOrPetApi::~UserOrPetApi() -{ -} - -pplx::task UserOrPetApi::createUserOrPet(std::shared_ptr createUserOrPetRequest) const -{ - - // verify the required parameter 'createUserOrPetRequest' is set - if (createUserOrPetRequest == nullptr) - { - throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'createUserOrPetRequest' when calling UserOrPetApi->createUserOrPet")); - } - - - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/user_or_pet"); - - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; - - std::unordered_set localVarResponseHttpContentTypes; - - utility::string_t localVarResponseHttpContentType; - - // use JSON if possible - if ( localVarResponseHttpContentTypes.size() == 0 ) - { - localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); - } - // JSON - else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) - { - localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); - } - // multipart formdata - else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) - { - localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); - } - else - { - throw ApiException(400, utility::conversions::to_string_t("UserOrPetApi->createUserOrPet does not produce any supported media type")); - } - - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - - std::unordered_set localVarConsumeHttpContentTypes; - localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - - - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; - - // use JSON if possible - if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) - { - localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); - web::json::value localVarJson; - - localVarJson = ModelBase::toJson(createUserOrPetRequest); - - - localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) ); - } - // multipart formdata - else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) - { - localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); - std::shared_ptr localVarMultipart(new MultipartFormData); - - if(createUserOrPetRequest.get()) - { - createUserOrPetRequest->toMultipart(localVarMultipart, utility::conversions::to_string_t("createUserOrPetRequest")); - } - - - localVarHttpBody = localVarMultipart; - localVarRequestHttpContentType += utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary(); - } - else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end()) - { - localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded"); - } - else - { - throw ApiException(415, utility::conversions::to_string_t("UserOrPetApi->createUserOrPet does not consume any supported media type")); - } - - // authentication (api_key) required - { - utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key")); - if ( localVarApiKey.size() > 0 ) - { - localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey; - } - } - - return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) - .then([=, this](web::http::http_response localVarResponse) - { - if (m_ApiClient->getResponseHandler()) - { - m_ApiClient->getResponseHandler()(localVarResponse.status_code(), localVarResponse.headers()); - } - - // 1xx - informational : OK - // 2xx - successful : OK - // 3xx - redirection : OK - // 4xx - client error : not OK - // 5xx - client error : not OK - if (localVarResponse.status_code() >= 400) - { - throw ApiException(localVarResponse.status_code() - , utility::conversions::to_string_t("error calling createUserOrPet: ") + localVarResponse.reason_phrase() - , std::make_shared(localVarResponse.extract_utf8string(true).get())); - } - - // check response content type - if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) - { - utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; - if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) - { - throw ApiException(500 - , utility::conversions::to_string_t("error calling createUserOrPet: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); - } - } - - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - return void(); - }); -} - -} -} -} -} - diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/CreateUserOrPet_request.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/CreateUserOrPet_request.cpp deleted file mode 100644 index bf350d7f0037..000000000000 --- a/samples/client/petstore/cpp-restsdk/client/src/model/CreateUserOrPet_request.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * The version of the OpenAPI document: 1.0.0 - * - * NOTE: This class is auto generated by OpenAPI-Generator 7.6.0-SNAPSHOT. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - - -#include "CppRestPetstoreClient/model/CreateUserOrPet_request.h" - -namespace org { -namespace openapitools { -namespace client { -namespace model { - - -void CreateUserOrPet_request::validate() -{ - // TODO: implement validation -} - -const CreateUserOrPet_request::VariantType& CreateUserOrPet_request::getVariant() const -{ - return m_variantValue; -} - -void CreateUserOrPet_request::setVariant(CreateUserOrPet_request::VariantType value) -{ - m_variantValue = value; -} - -web::json::value CreateUserOrPet_request::toJson() const -{ - web::json::value val = web::json::value::object(); - - std::visit([&](auto&& arg) { - using T = std::decay_t; - if constexpr (std::is_same_v) { - val = web::json::value::null(); - } else { - val = arg.toJson(); - } - }, m_variantValue); - - return val; -} - -void CreateUserOrPet_request::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const -{ - std::visit([&](auto&& arg) { - using T = std::decay_t; - if constexpr (!std::is_same_v) { - arg.toMultipart(multipart, prefix); - } - }, m_variantValue); -} - -template bool CreateUserOrPet_request::fromJson(const web::json::value& json); -template bool CreateUserOrPet_request::fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix); -template bool CreateUserOrPet_request::fromJson(const web::json::value& json); -template bool CreateUserOrPet_request::fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix); - - -} -} -} -} - -