From 054c5c69ad0ca5b6de6113b5a6f83b773575aa75 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Wed, 18 Jul 2018 15:09:32 -0700 Subject: [PATCH 1/9] Port GMock feature from NativeInstruments swagger-codegen fork: https://github.com/NativeInstruments/swagger-codegen/pull/9 --- .../languages/CppRestSdkClientCodegen.java | 8 +++++ .../cpp-rest-sdk-client/api-gmock.mustache | 35 +++++++++++++++++++ .../cpp-rest-sdk-client/api-header.mustache | 19 ++++++++-- 3 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache 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 4212923bc4d2..48186c3e81ba 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 @@ -49,6 +49,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { public static final String DECLSPEC = "declspec"; public static final String DEFAULT_INCLUDE = "defaultInclude"; + public static final String GENERATE_GMOCKS_FOR_APIS = "generateGMocksForApis"; protected String packageVersion = "1.0.0"; protected String declspec = ""; @@ -114,6 +115,9 @@ public CppRestSdkClientCodegen() { addOption(DEFAULT_INCLUDE, "The default include statement that should be placed in all headers for including things like the declspec (convention: #include \"Commons.h\" ", this.defaultInclude); + addOption(GENERATE_GMOCKS_FOR_APIS, + "Generate Google Mock classes for APIs.", + null); supportingFiles.add(new SupportingFile("modelbase-header.mustache", "", "ModelBase.h")); supportingFiles.add(new SupportingFile("modelbase-source.mustache", "", "ModelBase.cpp")); @@ -176,6 +180,10 @@ public void processOpts() { defaultInclude = additionalProperties.get(DEFAULT_INCLUDE).toString(); } + if (convertPropertyToBoolean(GENERATE_GMOCKS_FOR_APIS)) { + apiTemplateFiles.put("api-gmock.mustache", "GMock.h"); + } + additionalProperties.put("modelNamespaceDeclarations", modelPackage.split("\\.")); additionalProperties.put("modelNamespace", modelPackage.replaceAll("\\.", "::")); additionalProperties.put("modelHeaderGuardPrefix", modelPackage.replaceAll("\\.", "_").toUpperCase()); diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache new file mode 100644 index 000000000000..e1e2491749ed --- /dev/null +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache @@ -0,0 +1,35 @@ +{{>licenseInfo}} +{{#operations}} +#ifndef {{apiHeaderGuardPrefix}}_{{classname}}GMock_H_ +#define {{apiHeaderGuardPrefix}}_{{classname}}GMock_H_ + +#include + +#include "{{classname}}.h" + +{{#apiNamespaceDeclarations}} +namespace {{this}} { +{{/apiNamespaceDeclarations}} + +using namespace {{modelNamespace}}; + + +class {{declspec}} {{classname}}Mock : public I{{classname}} +{ +public: + {{#operation}} + MOCK_METHOD{{allParams.size}}( {{operationId}}, pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> ( + {{#allParams}} + {{^required}}boost::optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}}{{#hasMore}},{{/hasMore}} + {{/allParams}} + ) ); + {{/operation}} +}; + +{{#apiNamespaceDeclarations}} +} +{{/apiNamespaceDeclarations}} + +#endif /* {{apiHeaderGuardPrefix}}_{{classname}}GMock_H_ */ + +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache index 49200e4f2ab4..090a11cbe8e0 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache @@ -22,11 +22,24 @@ namespace {{this}} { using namespace {{modelNamespace}}; -class {{declspec}} {{classname}} +class {{declspec}} I{{classname}} +{ +public: + virtual ~I{{classname}}() = default; + {{#operation}} + virtual pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{operationId}}( + {{#allParams}} + {{^required}}boost::optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}} {{paramName}}{{#hasMore}},{{/hasMore}} + {{/allParams}} + ) = 0; + {{/operation}} +}; + +class {{declspec}} {{classname}} : public I{{classname}} { public: {{classname}}( std::shared_ptr apiClient ); - virtual ~{{classname}}(); + ~{{classname}}() override; {{#operation}} /// /// {{summary}} @@ -41,7 +54,7 @@ public: {{#allParams}} {{^required}}boost::optional<{{/required}}{{#isFile}}std::shared_ptr<{{/isFile}}{{{dataType}}}{{#isFile}}>{{/isFile}}{{^required}}>{{/required}} {{paramName}}{{#hasMore}},{{/hasMore}} {{/allParams}} - ); + ) override; {{/operation}} protected: From d2eb7b69c510da6294f8af25cc5c4b5abcbfcaa6 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Wed, 18 Jul 2018 15:10:29 -0700 Subject: [PATCH 2/9] Update petstore for Mockable APIs --- .../client/petstore/cpp-restsdk/api/PetApi.h | 55 +++++++++++++++---- .../petstore/cpp-restsdk/api/StoreApi.h | 29 ++++++++-- .../client/petstore/cpp-restsdk/api/UserApi.h | 51 +++++++++++++---- 3 files changed, 109 insertions(+), 26 deletions(-) diff --git a/samples/client/petstore/cpp-restsdk/api/PetApi.h b/samples/client/petstore/cpp-restsdk/api/PetApi.h index 01cc1f218bc5..ad680f58dd46 100644 --- a/samples/client/petstore/cpp-restsdk/api/PetApi.h +++ b/samples/client/petstore/cpp-restsdk/api/PetApi.h @@ -35,11 +35,46 @@ namespace api { using namespace org::openapitools::client::model; -class PetApi +class IPetApi +{ +public: + virtual ~IPetApi() = default; + virtual pplx::task addPet( + std::shared_ptr pet + ) = 0; + virtual pplx::task deletePet( + int64_t petId, + boost::optional apiKey + ) = 0; + virtual pplx::task>> findPetsByStatus( + std::vector status + ) = 0; + virtual pplx::task>> findPetsByTags( + std::vector tags + ) = 0; + virtual pplx::task> getPetById( + int64_t petId + ) = 0; + virtual pplx::task updatePet( + std::shared_ptr pet + ) = 0; + virtual pplx::task updatePetWithForm( + int64_t petId, + boost::optional name, + boost::optional status + ) = 0; + virtual pplx::task> uploadFile( + int64_t petId, + boost::optional additionalMetadata, + boost::optional file + ) = 0; +}; + +class PetApi : public IPetApi { public: PetApi( std::shared_ptr apiClient ); - virtual ~PetApi(); + ~PetApi() override; /// /// Add a new pet to the store /// @@ -49,7 +84,7 @@ class PetApi /// Pet object that needs to be added to the store pplx::task addPet( std::shared_ptr pet - ); + ) override; /// /// Deletes a pet /// @@ -61,7 +96,7 @@ class PetApi pplx::task deletePet( int64_t petId, boost::optional apiKey - ); + ) override; /// /// Finds Pets by status /// @@ -71,7 +106,7 @@ class PetApi /// Status values that need to be considered for filter pplx::task>> findPetsByStatus( std::vector status - ); + ) override; /// /// Finds Pets by tags /// @@ -81,7 +116,7 @@ class PetApi /// Tags to filter by pplx::task>> findPetsByTags( std::vector tags - ); + ) override; /// /// Find pet by ID /// @@ -91,7 +126,7 @@ class PetApi /// ID of pet to return pplx::task> getPetById( int64_t petId - ); + ) override; /// /// Update an existing pet /// @@ -101,7 +136,7 @@ class PetApi /// Pet object that needs to be added to the store pplx::task updatePet( std::shared_ptr pet - ); + ) override; /// /// Updates a pet in the store with form data /// @@ -115,7 +150,7 @@ class PetApi int64_t petId, boost::optional name, boost::optional status - ); + ) override; /// /// uploads an image /// @@ -129,7 +164,7 @@ class PetApi int64_t petId, boost::optional additionalMetadata, boost::optional> file - ); + ) override; protected: std::shared_ptr m_ApiClient; diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/api/StoreApi.h index 303345a8d7c2..c4fdfc8d79d6 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.h +++ b/samples/client/petstore/cpp-restsdk/api/StoreApi.h @@ -34,11 +34,28 @@ namespace api { using namespace org::openapitools::client::model; -class StoreApi +class IStoreApi +{ +public: + virtual ~IStoreApi() = default; + virtual pplx::task deleteOrder( + utility::string_t orderId + ) = 0; + virtual pplx::task> getInventory( + ) = 0; + virtual pplx::task> getOrderById( + int64_t orderId + ) = 0; + virtual pplx::task> placeOrder( + std::shared_ptr order + ) = 0; +}; + +class StoreApi : public IStoreApi { public: StoreApi( std::shared_ptr apiClient ); - virtual ~StoreApi(); + ~StoreApi() override; /// /// Delete purchase order by ID /// @@ -48,7 +65,7 @@ class StoreApi /// ID of the order that needs to be deleted pplx::task deleteOrder( utility::string_t orderId - ); + ) override; /// /// Returns pet inventories by status /// @@ -56,7 +73,7 @@ class StoreApi /// Returns a map of status codes to quantities /// pplx::task> getInventory( - ); + ) override; /// /// Find purchase order by ID /// @@ -66,7 +83,7 @@ class StoreApi /// ID of pet that needs to be fetched pplx::task> getOrderById( int64_t orderId - ); + ) override; /// /// Place an order for a pet /// @@ -76,7 +93,7 @@ class StoreApi /// order placed for purchasing the pet pplx::task> placeOrder( std::shared_ptr order - ); + ) override; protected: std::shared_ptr m_ApiClient; diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.h b/samples/client/petstore/cpp-restsdk/api/UserApi.h index 2b198b383a88..ca78cff8978a 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.h +++ b/samples/client/petstore/cpp-restsdk/api/UserApi.h @@ -34,11 +34,42 @@ namespace api { using namespace org::openapitools::client::model; -class UserApi +class IUserApi +{ +public: + virtual ~IUserApi() = default; + virtual pplx::task createUser( + std::shared_ptr user + ) = 0; + virtual pplx::task createUsersWithArrayInput( + std::vector> user + ) = 0; + virtual pplx::task createUsersWithListInput( + std::vector> user + ) = 0; + virtual pplx::task deleteUser( + utility::string_t username + ) = 0; + virtual pplx::task> getUserByName( + utility::string_t username + ) = 0; + virtual pplx::task loginUser( + utility::string_t username, + utility::string_t password + ) = 0; + virtual pplx::task logoutUser( + ) = 0; + virtual pplx::task updateUser( + utility::string_t username, + std::shared_ptr user + ) = 0; +}; + +class UserApi : public IUserApi { public: UserApi( std::shared_ptr apiClient ); - virtual ~UserApi(); + ~UserApi() override; /// /// Create user /// @@ -48,7 +79,7 @@ class UserApi /// Created user object pplx::task createUser( std::shared_ptr user - ); + ) override; /// /// Creates list of users with given input array /// @@ -58,7 +89,7 @@ class UserApi /// List of user object pplx::task createUsersWithArrayInput( std::vector> user - ); + ) override; /// /// Creates list of users with given input array /// @@ -68,7 +99,7 @@ class UserApi /// List of user object pplx::task createUsersWithListInput( std::vector> user - ); + ) override; /// /// Delete user /// @@ -78,7 +109,7 @@ class UserApi /// The name that needs to be deleted pplx::task deleteUser( utility::string_t username - ); + ) override; /// /// Get user by user name /// @@ -88,7 +119,7 @@ class UserApi /// The name that needs to be fetched. Use user1 for testing. pplx::task> getUserByName( utility::string_t username - ); + ) override; /// /// Logs user into the system /// @@ -100,7 +131,7 @@ class UserApi pplx::task loginUser( utility::string_t username, utility::string_t password - ); + ) override; /// /// Logs out current logged in user session /// @@ -108,7 +139,7 @@ class UserApi /// /// pplx::task logoutUser( - ); + ) override; /// /// Updated user /// @@ -120,7 +151,7 @@ class UserApi pplx::task updateUser( utility::string_t username, std::shared_ptr user - ); + ) override; protected: std::shared_ptr m_ApiClient; From 4fdbc730ae6adef4b4c3e4bfbc4439ca547b1341 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Wed, 18 Jul 2018 15:59:10 -0700 Subject: [PATCH 3/9] Fix shared_ptr in templates for File params --- .../src/main/resources/cpp-rest-sdk-client/api-gmock.mustache | 2 +- .../src/main/resources/cpp-rest-sdk-client/api-header.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache index e1e2491749ed..15c4a667d3a9 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache @@ -20,7 +20,7 @@ public: {{#operation}} MOCK_METHOD{{allParams.size}}( {{operationId}}, pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> ( {{#allParams}} - {{^required}}boost::optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}boost::optional<{{/required}}{{#isFile}}std::shared_ptr<{{/isFile}}{{{dataType}}}{{#isFile}}>{{/isFile}}{{^required}}>{{/required}} {{paramName}}{{#hasMore}},{{/hasMore}} {{/allParams}} ) ); {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache index 090a11cbe8e0..024bc9b53736 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache @@ -29,7 +29,7 @@ public: {{#operation}} virtual pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{operationId}}( {{#allParams}} - {{^required}}boost::optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}} {{paramName}}{{#hasMore}},{{/hasMore}} + {{^required}}boost::optional<{{/required}}{{#isFile}}std::shared_ptr<{{/isFile}}{{{dataType}}}{{#isFile}}>{{/isFile}}{{^required}}>{{/required}} {{paramName}}{{#hasMore}},{{/hasMore}} {{/allParams}} ) = 0; {{/operation}} From 0fcee549342f9fd565ab027eae9e87b0f2c00ed9 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Mon, 23 Jul 2018 10:18:25 -0700 Subject: [PATCH 4/9] Add guards in templates for GMock APIs --- .../languages/CppRestSdkClientCodegen.java | 1 + .../cpp-rest-sdk-client/api-gmock.mustache | 2 +- .../cpp-rest-sdk-client/api-header.mustache | 18 +++++++++++++++--- 3 files changed, 17 insertions(+), 4 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 48186c3e81ba..f271b740f8ac 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 @@ -182,6 +182,7 @@ public void processOpts() { if (convertPropertyToBoolean(GENERATE_GMOCKS_FOR_APIS)) { apiTemplateFiles.put("api-gmock.mustache", "GMock.h"); + additionalProperties.put("gmockApis", "true"); } additionalProperties.put("modelNamespaceDeclarations", modelPackage.split("\\.")); diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache index 15c4a667d3a9..6a9b372e723b 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache @@ -14,7 +14,7 @@ namespace {{this}} { using namespace {{modelNamespace}}; -class {{declspec}} {{classname}}Mock : public I{{classname}} +class {{declspec}} {{classname}}Mock {{#gmockApis}} : public I{{classname}} {{/gmockApis}} { public: {{#operation}} diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache index 024bc9b53736..535070935523 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache @@ -22,6 +22,7 @@ namespace {{this}} { using namespace {{modelNamespace}}; +{{#gmockApis}} class {{declspec}} I{{classname}} { public: @@ -33,13 +34,24 @@ public: {{/allParams}} ) = 0; {{/operation}} -}; +};{{/gmockApis}} -class {{declspec}} {{classname}} : public I{{classname}} +class {{declspec}} {{classname}} {{#gmockApis}} : public I{{classname}} {{/gmockApis}} { public: + {{#gmockApis}} + using Base = I{{classname}}; + {{/gmockApis}} + {{classname}}( std::shared_ptr apiClient ); + + {{#gmockApis}} ~{{classname}}() override; + {{/gmockApis}} + {{^gmockApis}} + virtual ~{{classname}}(); + {{/gmockApis}} + {{#operation}} /// /// {{summary}} @@ -54,7 +66,7 @@ public: {{#allParams}} {{^required}}boost::optional<{{/required}}{{#isFile}}std::shared_ptr<{{/isFile}}{{{dataType}}}{{#isFile}}>{{/isFile}}{{^required}}>{{/required}} {{paramName}}{{#hasMore}},{{/hasMore}} {{/allParams}} - ) override; + ){{#gmockApis}} override{{/gmockApis}}; {{/operation}} protected: From 37220f804f28997a8f1b85add7b1f242b9725bf9 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Mon, 23 Jul 2018 10:19:22 -0700 Subject: [PATCH 5/9] Regenerate samples without GMocks --- .../cpp-restsdk/.openapi-generator/VERSION | 2 +- .../client/petstore/cpp-restsdk/ApiClient.cpp | 2 +- .../client/petstore/cpp-restsdk/ApiClient.h | 2 +- .../petstore/cpp-restsdk/ApiConfiguration.cpp | 2 +- .../petstore/cpp-restsdk/ApiConfiguration.h | 2 +- .../petstore/cpp-restsdk/ApiException.cpp | 2 +- .../petstore/cpp-restsdk/ApiException.h | 2 +- .../petstore/cpp-restsdk/HttpContent.cpp | 2 +- .../client/petstore/cpp-restsdk/HttpContent.h | 2 +- .../client/petstore/cpp-restsdk/IHttpBody.h | 2 +- .../client/petstore/cpp-restsdk/JsonBody.cpp | 2 +- .../client/petstore/cpp-restsdk/JsonBody.h | 2 +- .../client/petstore/cpp-restsdk/ModelBase.cpp | 2 +- .../client/petstore/cpp-restsdk/ModelBase.h | 2 +- .../cpp-restsdk/MultipartFormData.cpp | 2 +- .../petstore/cpp-restsdk/MultipartFormData.h | 4 +- .../client/petstore/cpp-restsdk/Object.cpp | 2 +- samples/client/petstore/cpp-restsdk/Object.h | 2 +- .../petstore/cpp-restsdk/api/PetApi.cpp | 2 +- .../client/petstore/cpp-restsdk/api/PetApi.h | 60 +++++-------------- .../petstore/cpp-restsdk/api/StoreApi.cpp | 2 +- .../petstore/cpp-restsdk/api/StoreApi.h | 34 ++++------- .../petstore/cpp-restsdk/api/UserApi.cpp | 2 +- .../client/petstore/cpp-restsdk/api/UserApi.h | 56 +++++------------ .../cpp-restsdk/model/ApiResponse.cpp | 2 +- .../petstore/cpp-restsdk/model/ApiResponse.h | 2 +- .../petstore/cpp-restsdk/model/Category.cpp | 2 +- .../petstore/cpp-restsdk/model/Category.h | 2 +- .../petstore/cpp-restsdk/model/Order.cpp | 2 +- .../client/petstore/cpp-restsdk/model/Order.h | 2 +- .../client/petstore/cpp-restsdk/model/Pet.cpp | 2 +- .../client/petstore/cpp-restsdk/model/Pet.h | 2 +- .../client/petstore/cpp-restsdk/model/Tag.cpp | 2 +- .../client/petstore/cpp-restsdk/model/Tag.h | 2 +- .../petstore/cpp-restsdk/model/User.cpp | 2 +- .../client/petstore/cpp-restsdk/model/User.h | 2 +- 36 files changed, 75 insertions(+), 143 deletions(-) diff --git a/samples/client/petstore/cpp-restsdk/.openapi-generator/VERSION b/samples/client/petstore/cpp-restsdk/.openapi-generator/VERSION index 096bf47efe31..dde25ef08e8c 100644 --- a/samples/client/petstore/cpp-restsdk/.openapi-generator/VERSION +++ b/samples/client/petstore/cpp-restsdk/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.1.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/cpp-restsdk/ApiClient.cpp b/samples/client/petstore/cpp-restsdk/ApiClient.cpp index 448f377926ee..1b2256bcdbd1 100644 --- a/samples/client/petstore/cpp-restsdk/ApiClient.cpp +++ b/samples/client/petstore/cpp-restsdk/ApiClient.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiClient.h b/samples/client/petstore/cpp-restsdk/ApiClient.h index 355a119f395e..ace5dbc15b56 100644 --- a/samples/client/petstore/cpp-restsdk/ApiClient.h +++ b/samples/client/petstore/cpp-restsdk/ApiClient.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp b/samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp index 2d5d39513ec9..eba083739981 100644 --- a/samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp +++ b/samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiConfiguration.h b/samples/client/petstore/cpp-restsdk/ApiConfiguration.h index c39b29fc61f1..8f39ba36aa9b 100644 --- a/samples/client/petstore/cpp-restsdk/ApiConfiguration.h +++ b/samples/client/petstore/cpp-restsdk/ApiConfiguration.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiException.cpp b/samples/client/petstore/cpp-restsdk/ApiException.cpp index bb41df86f97c..c6d9e2ea004a 100644 --- a/samples/client/petstore/cpp-restsdk/ApiException.cpp +++ b/samples/client/petstore/cpp-restsdk/ApiException.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiException.h b/samples/client/petstore/cpp-restsdk/ApiException.h index 6073db8d1ec2..da0cb95a516a 100644 --- a/samples/client/petstore/cpp-restsdk/ApiException.h +++ b/samples/client/petstore/cpp-restsdk/ApiException.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/HttpContent.cpp b/samples/client/petstore/cpp-restsdk/HttpContent.cpp index 8922e724304d..cc09bfac319b 100644 --- a/samples/client/petstore/cpp-restsdk/HttpContent.cpp +++ b/samples/client/petstore/cpp-restsdk/HttpContent.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/HttpContent.h b/samples/client/petstore/cpp-restsdk/HttpContent.h index 71b055aaadcc..2141c8beb8b8 100644 --- a/samples/client/petstore/cpp-restsdk/HttpContent.h +++ b/samples/client/petstore/cpp-restsdk/HttpContent.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/IHttpBody.h b/samples/client/petstore/cpp-restsdk/IHttpBody.h index 88ce14a536da..b63ee0ce9637 100644 --- a/samples/client/petstore/cpp-restsdk/IHttpBody.h +++ b/samples/client/petstore/cpp-restsdk/IHttpBody.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/JsonBody.cpp b/samples/client/petstore/cpp-restsdk/JsonBody.cpp index e3fbd7b340bd..c9394f3a1af2 100644 --- a/samples/client/petstore/cpp-restsdk/JsonBody.cpp +++ b/samples/client/petstore/cpp-restsdk/JsonBody.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/JsonBody.h b/samples/client/petstore/cpp-restsdk/JsonBody.h index 5ec9da11d709..b863e1a59849 100644 --- a/samples/client/petstore/cpp-restsdk/JsonBody.h +++ b/samples/client/petstore/cpp-restsdk/JsonBody.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ModelBase.cpp b/samples/client/petstore/cpp-restsdk/ModelBase.cpp index d13dc7ac9806..2008917d9468 100644 --- a/samples/client/petstore/cpp-restsdk/ModelBase.cpp +++ b/samples/client/petstore/cpp-restsdk/ModelBase.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ModelBase.h b/samples/client/petstore/cpp-restsdk/ModelBase.h index 6b9818617bcb..d98ca65230c2 100644 --- a/samples/client/petstore/cpp-restsdk/ModelBase.h +++ b/samples/client/petstore/cpp-restsdk/ModelBase.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/MultipartFormData.cpp b/samples/client/petstore/cpp-restsdk/MultipartFormData.cpp index fb9b11dfee1b..b17730c40863 100644 --- a/samples/client/petstore/cpp-restsdk/MultipartFormData.cpp +++ b/samples/client/petstore/cpp-restsdk/MultipartFormData.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/MultipartFormData.h b/samples/client/petstore/cpp-restsdk/MultipartFormData.h index 166ada330cae..203112fb7356 100644 --- a/samples/client/petstore/cpp-restsdk/MultipartFormData.h +++ b/samples/client/petstore/cpp-restsdk/MultipartFormData.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -12,7 +12,7 @@ /* * MultipartFormData.h * - * This class represents a container for building a application/x-multipart-formdata requests. + * This class represents a container for building application/x-multipart-formdata requests. */ #ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_MultipartFormData_H_ diff --git a/samples/client/petstore/cpp-restsdk/Object.cpp b/samples/client/petstore/cpp-restsdk/Object.cpp index 326ada285e9b..c0f179a0e8b9 100644 --- a/samples/client/petstore/cpp-restsdk/Object.cpp +++ b/samples/client/petstore/cpp-restsdk/Object.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/Object.h b/samples/client/petstore/cpp-restsdk/Object.h index ec9505e194b8..109051fa4b35 100644 --- a/samples/client/petstore/cpp-restsdk/Object.h +++ b/samples/client/petstore/cpp-restsdk/Object.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/PetApi.cpp b/samples/client/petstore/cpp-restsdk/api/PetApi.cpp index 69b595fc629a..5c7f06fc2b91 100644 --- a/samples/client/petstore/cpp-restsdk/api/PetApi.cpp +++ b/samples/client/petstore/cpp-restsdk/api/PetApi.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/PetApi.h b/samples/client/petstore/cpp-restsdk/api/PetApi.h index ad680f58dd46..8ef394a11d8f 100644 --- a/samples/client/petstore/cpp-restsdk/api/PetApi.h +++ b/samples/client/petstore/cpp-restsdk/api/PetApi.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -35,46 +35,16 @@ namespace api { using namespace org::openapitools::client::model; -class IPetApi -{ -public: - virtual ~IPetApi() = default; - virtual pplx::task addPet( - std::shared_ptr pet - ) = 0; - virtual pplx::task deletePet( - int64_t petId, - boost::optional apiKey - ) = 0; - virtual pplx::task>> findPetsByStatus( - std::vector status - ) = 0; - virtual pplx::task>> findPetsByTags( - std::vector tags - ) = 0; - virtual pplx::task> getPetById( - int64_t petId - ) = 0; - virtual pplx::task updatePet( - std::shared_ptr pet - ) = 0; - virtual pplx::task updatePetWithForm( - int64_t petId, - boost::optional name, - boost::optional status - ) = 0; - virtual pplx::task> uploadFile( - int64_t petId, - boost::optional additionalMetadata, - boost::optional file - ) = 0; -}; -class PetApi : public IPetApi + +class PetApi { public: + PetApi( std::shared_ptr apiClient ); - ~PetApi() override; + + virtual ~PetApi(); + /// /// Add a new pet to the store /// @@ -84,7 +54,7 @@ class PetApi : public IPetApi /// Pet object that needs to be added to the store pplx::task addPet( std::shared_ptr pet - ) override; + ); /// /// Deletes a pet /// @@ -96,7 +66,7 @@ class PetApi : public IPetApi pplx::task deletePet( int64_t petId, boost::optional apiKey - ) override; + ); /// /// Finds Pets by status /// @@ -106,7 +76,7 @@ class PetApi : public IPetApi /// Status values that need to be considered for filter pplx::task>> findPetsByStatus( std::vector status - ) override; + ); /// /// Finds Pets by tags /// @@ -116,7 +86,7 @@ class PetApi : public IPetApi /// Tags to filter by pplx::task>> findPetsByTags( std::vector tags - ) override; + ); /// /// Find pet by ID /// @@ -126,7 +96,7 @@ class PetApi : public IPetApi /// ID of pet to return pplx::task> getPetById( int64_t petId - ) override; + ); /// /// Update an existing pet /// @@ -136,7 +106,7 @@ class PetApi : public IPetApi /// Pet object that needs to be added to the store pplx::task updatePet( std::shared_ptr pet - ) override; + ); /// /// Updates a pet in the store with form data /// @@ -150,7 +120,7 @@ class PetApi : public IPetApi int64_t petId, boost::optional name, boost::optional status - ) override; + ); /// /// uploads an image /// @@ -164,7 +134,7 @@ class PetApi : public IPetApi int64_t petId, boost::optional additionalMetadata, boost::optional> file - ) override; + ); protected: std::shared_ptr m_ApiClient; diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp index 188730555804..d466cb50539f 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp +++ b/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/api/StoreApi.h index c4fdfc8d79d6..b8eb6a0e5160 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.h +++ b/samples/client/petstore/cpp-restsdk/api/StoreApi.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -34,28 +34,16 @@ namespace api { using namespace org::openapitools::client::model; -class IStoreApi -{ -public: - virtual ~IStoreApi() = default; - virtual pplx::task deleteOrder( - utility::string_t orderId - ) = 0; - virtual pplx::task> getInventory( - ) = 0; - virtual pplx::task> getOrderById( - int64_t orderId - ) = 0; - virtual pplx::task> placeOrder( - std::shared_ptr order - ) = 0; -}; -class StoreApi : public IStoreApi + +class StoreApi { public: + StoreApi( std::shared_ptr apiClient ); - ~StoreApi() override; + + virtual ~StoreApi(); + /// /// Delete purchase order by ID /// @@ -65,7 +53,7 @@ class StoreApi : public IStoreApi /// ID of the order that needs to be deleted pplx::task deleteOrder( utility::string_t orderId - ) override; + ); /// /// Returns pet inventories by status /// @@ -73,7 +61,7 @@ class StoreApi : public IStoreApi /// Returns a map of status codes to quantities /// pplx::task> getInventory( - ) override; + ); /// /// Find purchase order by ID /// @@ -83,7 +71,7 @@ class StoreApi : public IStoreApi /// ID of pet that needs to be fetched pplx::task> getOrderById( int64_t orderId - ) override; + ); /// /// Place an order for a pet /// @@ -93,7 +81,7 @@ class StoreApi : public IStoreApi /// order placed for purchasing the pet pplx::task> placeOrder( std::shared_ptr order - ) override; + ); protected: std::shared_ptr m_ApiClient; diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/api/UserApi.cpp index 9c319adf0230..c67d7afe658f 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.cpp +++ b/samples/client/petstore/cpp-restsdk/api/UserApi.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.h b/samples/client/petstore/cpp-restsdk/api/UserApi.h index ca78cff8978a..a2723a97ba63 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.h +++ b/samples/client/petstore/cpp-restsdk/api/UserApi.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -34,42 +34,16 @@ namespace api { using namespace org::openapitools::client::model; -class IUserApi -{ -public: - virtual ~IUserApi() = default; - virtual pplx::task createUser( - std::shared_ptr user - ) = 0; - virtual pplx::task createUsersWithArrayInput( - std::vector> user - ) = 0; - virtual pplx::task createUsersWithListInput( - std::vector> user - ) = 0; - virtual pplx::task deleteUser( - utility::string_t username - ) = 0; - virtual pplx::task> getUserByName( - utility::string_t username - ) = 0; - virtual pplx::task loginUser( - utility::string_t username, - utility::string_t password - ) = 0; - virtual pplx::task logoutUser( - ) = 0; - virtual pplx::task updateUser( - utility::string_t username, - std::shared_ptr user - ) = 0; -}; -class UserApi : public IUserApi + +class UserApi { public: + UserApi( std::shared_ptr apiClient ); - ~UserApi() override; + + virtual ~UserApi(); + /// /// Create user /// @@ -79,7 +53,7 @@ class UserApi : public IUserApi /// Created user object pplx::task createUser( std::shared_ptr user - ) override; + ); /// /// Creates list of users with given input array /// @@ -89,7 +63,7 @@ class UserApi : public IUserApi /// List of user object pplx::task createUsersWithArrayInput( std::vector> user - ) override; + ); /// /// Creates list of users with given input array /// @@ -99,7 +73,7 @@ class UserApi : public IUserApi /// List of user object pplx::task createUsersWithListInput( std::vector> user - ) override; + ); /// /// Delete user /// @@ -109,7 +83,7 @@ class UserApi : public IUserApi /// The name that needs to be deleted pplx::task deleteUser( utility::string_t username - ) override; + ); /// /// Get user by user name /// @@ -119,7 +93,7 @@ class UserApi : public IUserApi /// The name that needs to be fetched. Use user1 for testing. pplx::task> getUserByName( utility::string_t username - ) override; + ); /// /// Logs user into the system /// @@ -131,7 +105,7 @@ class UserApi : public IUserApi pplx::task loginUser( utility::string_t username, utility::string_t password - ) override; + ); /// /// Logs out current logged in user session /// @@ -139,7 +113,7 @@ class UserApi : public IUserApi /// /// pplx::task logoutUser( - ) override; + ); /// /// Updated user /// @@ -151,7 +125,7 @@ class UserApi : public IUserApi pplx::task updateUser( utility::string_t username, std::shared_ptr user - ) override; + ); protected: std::shared_ptr m_ApiClient; diff --git a/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp index 1d8ebbac8b7a..11a0cd4c0a6a 100644 --- a/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp +++ b/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/model/ApiResponse.h index 0514fcd38c9c..2568511d5176 100644 --- a/samples/client/petstore/cpp-restsdk/model/ApiResponse.h +++ b/samples/client/petstore/cpp-restsdk/model/ApiResponse.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Category.cpp b/samples/client/petstore/cpp-restsdk/model/Category.cpp index 60f92843df05..0a2be543714e 100644 --- a/samples/client/petstore/cpp-restsdk/model/Category.cpp +++ b/samples/client/petstore/cpp-restsdk/model/Category.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Category.h b/samples/client/petstore/cpp-restsdk/model/Category.h index f77cf6c508bd..45ae74a0f9f6 100644 --- a/samples/client/petstore/cpp-restsdk/model/Category.h +++ b/samples/client/petstore/cpp-restsdk/model/Category.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Order.cpp b/samples/client/petstore/cpp-restsdk/model/Order.cpp index f23fd13926c0..610e66f4c630 100644 --- a/samples/client/petstore/cpp-restsdk/model/Order.cpp +++ b/samples/client/petstore/cpp-restsdk/model/Order.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Order.h b/samples/client/petstore/cpp-restsdk/model/Order.h index 43893a44fa40..a9e5362f97e3 100644 --- a/samples/client/petstore/cpp-restsdk/model/Order.h +++ b/samples/client/petstore/cpp-restsdk/model/Order.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/model/Pet.cpp index 3c477013b10a..f5be1d38434e 100644 --- a/samples/client/petstore/cpp-restsdk/model/Pet.cpp +++ b/samples/client/petstore/cpp-restsdk/model/Pet.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Pet.h b/samples/client/petstore/cpp-restsdk/model/Pet.h index d83922397660..a7a9f5dd4c8f 100644 --- a/samples/client/petstore/cpp-restsdk/model/Pet.h +++ b/samples/client/petstore/cpp-restsdk/model/Pet.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/model/Tag.cpp index 584a4b24cf56..2f7b3596aa4d 100644 --- a/samples/client/petstore/cpp-restsdk/model/Tag.cpp +++ b/samples/client/petstore/cpp-restsdk/model/Tag.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Tag.h b/samples/client/petstore/cpp-restsdk/model/Tag.h index 663fe05cfcc8..cb0fcedef41a 100644 --- a/samples/client/petstore/cpp-restsdk/model/Tag.h +++ b/samples/client/petstore/cpp-restsdk/model/Tag.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/User.cpp b/samples/client/petstore/cpp-restsdk/model/User.cpp index a06e9f5aa4bb..2779424d4a8d 100644 --- a/samples/client/petstore/cpp-restsdk/model/User.cpp +++ b/samples/client/petstore/cpp-restsdk/model/User.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/User.h b/samples/client/petstore/cpp-restsdk/model/User.h index 0e5f4dc08447..f02e9ef719f4 100644 --- a/samples/client/petstore/cpp-restsdk/model/User.h +++ b/samples/client/petstore/cpp-restsdk/model/User.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ From 9f4b0d11bb7a8f352ef1e65eb5d8e4df39bf914b Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Mon, 23 Jul 2018 16:22:00 -0700 Subject: [PATCH 6/9] Add useful constructors for GMock APIs --- .../resources/cpp-rest-sdk-client/api-gmock.mustache | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache index 6a9b372e723b..fb38c0a1384f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache @@ -14,9 +14,19 @@ namespace {{this}} { using namespace {{modelNamespace}}; -class {{declspec}} {{classname}}Mock {{#gmockApis}} : public I{{classname}} {{/gmockApis}} +class {{declspec}} {{classname}}Mock : public I{{classname}} { public: + using Base = I{{classname}}; + + {{classname}}Mock() { }; + + // `apiClient` argument not used. Constructor only provided to match + // constructor of the non-mocked API + {{classname}}Mock( std::shared_ptr apiClient ) { }; + + ~{{classname}}Mock() override; + {{#operation}} MOCK_METHOD{{allParams.size}}( {{operationId}}, pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> ( {{#allParams}} From 714de1cb2bddf19e91d194a4572420daf53e75a6 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Mon, 23 Jul 2018 16:59:18 -0700 Subject: [PATCH 7/9] Add constructors to API header interface --- .../main/resources/cpp-rest-sdk-client/api-gmock.mustache | 8 ++------ .../resources/cpp-rest-sdk-client/api-header.mustache | 4 +++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache index fb38c0a1384f..78efaba7c35f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache @@ -19,12 +19,8 @@ class {{declspec}} {{classname}}Mock : public I{{classname}} public: using Base = I{{classname}}; - {{classname}}Mock() { }; - - // `apiClient` argument not used. Constructor only provided to match - // constructor of the non-mocked API - {{classname}}Mock( std::shared_ptr apiClient ) { }; - + {{classname}}Mock() = default; + explicit {{classname}}Mock( std::shared_ptr apiClient ) { }; ~{{classname}}Mock() override; {{#operation}} diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache index 535070935523..b1dc5bfff8f2 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache @@ -26,7 +26,9 @@ using namespace {{modelNamespace}}; class {{declspec}} I{{classname}} { public: + I{{classname}}() = default; virtual ~I{{classname}}() = default; + {{#operation}} virtual pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{operationId}}( {{#allParams}} @@ -43,7 +45,7 @@ public: using Base = I{{classname}}; {{/gmockApis}} - {{classname}}( std::shared_ptr apiClient ); + explicit {{classname}}( std::shared_ptr apiClient ); {{#gmockApis}} ~{{classname}}() override; From 961e342f4f9e299ded7e8302d265cb73990d42b2 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Mon, 23 Jul 2018 17:00:37 -0700 Subject: [PATCH 8/9] Update samples with explicit monadic constructors --- samples/client/petstore/cpp-restsdk/api/PetApi.h | 2 +- samples/client/petstore/cpp-restsdk/api/StoreApi.h | 2 +- samples/client/petstore/cpp-restsdk/api/UserApi.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/client/petstore/cpp-restsdk/api/PetApi.h b/samples/client/petstore/cpp-restsdk/api/PetApi.h index 8ef394a11d8f..c0c1f7b63c27 100644 --- a/samples/client/petstore/cpp-restsdk/api/PetApi.h +++ b/samples/client/petstore/cpp-restsdk/api/PetApi.h @@ -41,7 +41,7 @@ class PetApi { public: - PetApi( std::shared_ptr apiClient ); + explicit PetApi( std::shared_ptr apiClient ); virtual ~PetApi(); diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/api/StoreApi.h index b8eb6a0e5160..b7b033e04aff 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.h +++ b/samples/client/petstore/cpp-restsdk/api/StoreApi.h @@ -40,7 +40,7 @@ class StoreApi { public: - StoreApi( std::shared_ptr apiClient ); + explicit StoreApi( std::shared_ptr apiClient ); virtual ~StoreApi(); diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.h b/samples/client/petstore/cpp-restsdk/api/UserApi.h index a2723a97ba63..6be583c9a5b2 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.h +++ b/samples/client/petstore/cpp-restsdk/api/UserApi.h @@ -40,7 +40,7 @@ class UserApi { public: - UserApi( std::shared_ptr apiClient ); + explicit UserApi( std::shared_ptr apiClient ); virtual ~UserApi(); From 6b20a5addeb7f61863e575ec0027453b5dd19dcb Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Mon, 23 Jul 2018 17:21:27 -0700 Subject: [PATCH 9/9] Add default implementations for destructors --- .../src/main/resources/cpp-rest-sdk-client/api-gmock.mustache | 2 +- .../src/main/resources/cpp-rest-sdk-client/api-header.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache index 78efaba7c35f..804099e4caf5 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-gmock.mustache @@ -21,7 +21,7 @@ public: {{classname}}Mock() = default; explicit {{classname}}Mock( std::shared_ptr apiClient ) { }; - ~{{classname}}Mock() override; + ~{{classname}}Mock() override = default; {{#operation}} MOCK_METHOD{{allParams.size}}( {{operationId}}, pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> ( diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache index b1dc5bfff8f2..ec97511314fc 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache @@ -51,7 +51,7 @@ public: ~{{classname}}() override; {{/gmockApis}} {{^gmockApis}} - virtual ~{{classname}}(); + virtual ~{{classname}}() = default; {{/gmockApis}} {{#operation}}