diff --git a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache index bea074dfe6d..aa7fdc70c71 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache @@ -470,7 +470,7 @@ if (_this.enableCookies && typeof window === 'undefined'){ _this.agent.saveCookies(response); } - resolve({data, response}); + resolve({data: data, response: response}); } catch (err) { reject(err); } diff --git a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache index 9bbf4b4f43a..c13314a8960 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache @@ -53,6 +53,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/modules/swagger-codegen/src/main/resources/Javascript/es6/README.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/README.mustache index 9bbf4b4f43a..c13314a8960 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/es6/README.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/es6/README.mustache @@ -53,6 +53,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/modules/swagger-codegen/src/main/resources/cpprest/model-header.mustache b/modules/swagger-codegen/src/main/resources/cpprest/model-header.mustache index c32084eebc2..aefcec63437 100644 --- a/modules/swagger-codegen/src/main/resources/cpprest/model-header.mustache +++ b/modules/swagger-codegen/src/main/resources/cpprest/model-header.mustache @@ -51,10 +51,10 @@ public: /// {{^isNotContainer}}{{{datatype}}}& {{getter}}(); {{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{getter}}() const; - void {{setter}}({{{datatype}}} value); {{/isNotContainer}}{{^required}}bool {{baseName}}IsSet() const; void unset{{name}}(); {{/required}} + void {{setter}}({{{datatype}}} value); {{/isInherited}} {{/vars}} diff --git a/modules/swagger-codegen/src/main/resources/cpprest/model-source.mustache b/modules/swagger-codegen/src/main/resources/cpprest/model-source.mustache index 1830651b368..6d4a18bf2f0 100644 --- a/modules/swagger-codegen/src/main/resources/cpprest/model-source.mustache +++ b/modules/swagger-codegen/src/main/resources/cpprest/model-source.mustache @@ -408,6 +408,11 @@ void {{classname}}::fromMultiPart(std::shared_ptr multipart, return m_{{name}}; } +void {{classname}}::{{setter}}({{{datatype}}} value) +{ + m_{{name}} = value; + {{^required}}m_{{name}}IsSet = true;{{/required}} +} {{/isNotContainer}} {{#isNotContainer}} {{{datatype}}} {{classname}}::{{getter}}() const @@ -415,12 +420,12 @@ void {{classname}}::fromMultiPart(std::shared_ptr multipart, return m_{{name}}; } + void {{classname}}::{{setter}}({{{datatype}}} value) { m_{{name}} = value; {{^required}}m_{{name}}IsSet = true;{{/required}} } - {{/isNotContainer}} {{^required}} bool {{classname}}::{{baseName}}IsSet() const diff --git a/samples/client/petstore/cpprest/model/ApiResponse.cpp b/samples/client/petstore/cpprest/model/ApiResponse.cpp index 255660cf02b..d2f4238deeb 100644 --- a/samples/client/petstore/cpprest/model/ApiResponse.cpp +++ b/samples/client/petstore/cpprest/model/ApiResponse.cpp @@ -125,12 +125,12 @@ int32_t ApiResponse::getCode() const return m_Code; } + void ApiResponse::setCode(int32_t value) { m_Code = value; m_CodeIsSet = true; } - bool ApiResponse::codeIsSet() const { return m_CodeIsSet; @@ -146,12 +146,12 @@ utility::string_t ApiResponse::getType() const return m_Type; } + void ApiResponse::setType(utility::string_t value) { m_Type = value; m_TypeIsSet = true; } - bool ApiResponse::typeIsSet() const { return m_TypeIsSet; @@ -167,12 +167,12 @@ utility::string_t ApiResponse::getMessage() const return m_Message; } + void ApiResponse::setMessage(utility::string_t value) { m_Message = value; m_MessageIsSet = true; } - bool ApiResponse::messageIsSet() const { return m_MessageIsSet; diff --git a/samples/client/petstore/cpprest/model/ApiResponse.h b/samples/client/petstore/cpprest/model/ApiResponse.h index 1f8e7feb2bc..ec0a3a1b012 100644 --- a/samples/client/petstore/cpprest/model/ApiResponse.h +++ b/samples/client/petstore/cpprest/model/ApiResponse.h @@ -57,23 +57,23 @@ public: /// /// int32_t getCode() const; - void setCode(int32_t value); bool codeIsSet() const; void unsetCode(); + void setCode(int32_t value); /// /// /// utility::string_t getType() const; - void setType(utility::string_t value); bool typeIsSet() const; void unsetType(); + void setType(utility::string_t value); /// /// /// utility::string_t getMessage() const; - void setMessage(utility::string_t value); bool messageIsSet() const; void unsetMessage(); + void setMessage(utility::string_t value); protected: int32_t m_Code; diff --git a/samples/client/petstore/cpprest/model/Category.cpp b/samples/client/petstore/cpprest/model/Category.cpp index 19e14171b7a..4d185607149 100644 --- a/samples/client/petstore/cpprest/model/Category.cpp +++ b/samples/client/petstore/cpprest/model/Category.cpp @@ -106,12 +106,12 @@ int64_t Category::getId() const return m_Id; } + void Category::setId(int64_t value) { m_Id = value; m_IdIsSet = true; } - bool Category::idIsSet() const { return m_IdIsSet; @@ -127,12 +127,12 @@ utility::string_t Category::getName() const return m_Name; } + void Category::setName(utility::string_t value) { m_Name = value; m_NameIsSet = true; } - bool Category::nameIsSet() const { return m_NameIsSet; diff --git a/samples/client/petstore/cpprest/model/Category.h b/samples/client/petstore/cpprest/model/Category.h index 88cc7148202..860918c0822 100644 --- a/samples/client/petstore/cpprest/model/Category.h +++ b/samples/client/petstore/cpprest/model/Category.h @@ -57,16 +57,16 @@ public: /// /// int64_t getId() const; - void setId(int64_t value); bool idIsSet() const; void unsetId(); + void setId(int64_t value); /// /// /// utility::string_t getName() const; - void setName(utility::string_t value); bool nameIsSet() const; void unsetName(); + void setName(utility::string_t value); protected: int64_t m_Id; diff --git a/samples/client/petstore/cpprest/model/Order.cpp b/samples/client/petstore/cpprest/model/Order.cpp index f9ed1375ece..b205701b76f 100644 --- a/samples/client/petstore/cpprest/model/Order.cpp +++ b/samples/client/petstore/cpprest/model/Order.cpp @@ -179,12 +179,12 @@ int64_t Order::getId() const return m_Id; } + void Order::setId(int64_t value) { m_Id = value; m_IdIsSet = true; } - bool Order::idIsSet() const { return m_IdIsSet; @@ -200,12 +200,12 @@ int64_t Order::getPetId() const return m_PetId; } + void Order::setPetId(int64_t value) { m_PetId = value; m_PetIdIsSet = true; } - bool Order::petIdIsSet() const { return m_PetIdIsSet; @@ -221,12 +221,12 @@ int32_t Order::getQuantity() const return m_Quantity; } + void Order::setQuantity(int32_t value) { m_Quantity = value; m_QuantityIsSet = true; } - bool Order::quantityIsSet() const { return m_QuantityIsSet; @@ -242,12 +242,12 @@ utility::datetime Order::getShipDate() const return m_ShipDate; } + void Order::setShipDate(utility::datetime value) { m_ShipDate = value; m_ShipDateIsSet = true; } - bool Order::shipDateIsSet() const { return m_ShipDateIsSet; @@ -263,12 +263,12 @@ utility::string_t Order::getStatus() const return m_Status; } + void Order::setStatus(utility::string_t value) { m_Status = value; m_StatusIsSet = true; } - bool Order::statusIsSet() const { return m_StatusIsSet; @@ -284,12 +284,12 @@ bool Order::getComplete() const return m_Complete; } + void Order::setComplete(bool value) { m_Complete = value; m_CompleteIsSet = true; } - bool Order::completeIsSet() const { return m_CompleteIsSet; diff --git a/samples/client/petstore/cpprest/model/Order.h b/samples/client/petstore/cpprest/model/Order.h index bd838e920e7..da065593b84 100644 --- a/samples/client/petstore/cpprest/model/Order.h +++ b/samples/client/petstore/cpprest/model/Order.h @@ -57,44 +57,44 @@ public: /// /// int64_t getId() const; - void setId(int64_t value); bool idIsSet() const; void unsetId(); + void setId(int64_t value); /// /// /// int64_t getPetId() const; - void setPetId(int64_t value); bool petIdIsSet() const; void unsetPetId(); + void setPetId(int64_t value); /// /// /// int32_t getQuantity() const; - void setQuantity(int32_t value); bool quantityIsSet() const; void unsetQuantity(); + void setQuantity(int32_t value); /// /// /// utility::datetime getShipDate() const; - void setShipDate(utility::datetime value); bool shipDateIsSet() const; void unsetShipDate(); + void setShipDate(utility::datetime value); /// /// Order Status /// utility::string_t getStatus() const; - void setStatus(utility::string_t value); bool statusIsSet() const; void unsetStatus(); + void setStatus(utility::string_t value); /// /// /// bool getComplete() const; - void setComplete(bool value); bool completeIsSet() const; void unsetComplete(); + void setComplete(bool value); protected: int64_t m_Id; diff --git a/samples/client/petstore/cpprest/model/Pet.cpp b/samples/client/petstore/cpprest/model/Pet.cpp index a59a8da759e..5d8a4bb9725 100644 --- a/samples/client/petstore/cpprest/model/Pet.cpp +++ b/samples/client/petstore/cpprest/model/Pet.cpp @@ -240,12 +240,12 @@ int64_t Pet::getId() const return m_Id; } + void Pet::setId(int64_t value) { m_Id = value; m_IdIsSet = true; } - bool Pet::idIsSet() const { return m_IdIsSet; @@ -261,12 +261,12 @@ std::shared_ptr Pet::getCategory() const return m_Category; } + void Pet::setCategory(std::shared_ptr value) { m_Category = value; m_CategoryIsSet = true; } - bool Pet::categoryIsSet() const { return m_CategoryIsSet; @@ -282,22 +282,32 @@ utility::string_t Pet::getName() const return m_Name; } + void Pet::setName(utility::string_t value) { m_Name = value; } - std::vector& Pet::getPhotoUrls() { return m_PhotoUrls; } +void Pet::setPhotoUrls(std::vector value) +{ + m_PhotoUrls = value; + +} std::vector>& Pet::getTags() { return m_Tags; } +void Pet::setTags(std::vector> value) +{ + m_Tags = value; + m_TagsIsSet = true; +} bool Pet::tagsIsSet() const { return m_TagsIsSet; @@ -313,12 +323,12 @@ utility::string_t Pet::getStatus() const return m_Status; } + void Pet::setStatus(utility::string_t value) { m_Status = value; m_StatusIsSet = true; } - bool Pet::statusIsSet() const { return m_StatusIsSet; diff --git a/samples/client/petstore/cpprest/model/Pet.h b/samples/client/petstore/cpprest/model/Pet.h index 403db5b0236..61ae8b92f17 100644 --- a/samples/client/petstore/cpprest/model/Pet.h +++ b/samples/client/petstore/cpprest/model/Pet.h @@ -60,38 +60,40 @@ public: /// /// int64_t getId() const; - void setId(int64_t value); bool idIsSet() const; void unsetId(); + void setId(int64_t value); /// /// /// std::shared_ptr getCategory() const; - void setCategory(std::shared_ptr value); bool categoryIsSet() const; void unsetCategory(); + void setCategory(std::shared_ptr value); /// /// /// utility::string_t getName() const; - void setName(utility::string_t value); - /// + void setName(utility::string_t value); + /// /// /// std::vector& getPhotoUrls(); - /// + void setPhotoUrls(std::vector value); + /// /// /// std::vector>& getTags(); bool tagsIsSet() const; void unsetTags(); + void setTags(std::vector> value); /// /// pet status in the store /// utility::string_t getStatus() const; - void setStatus(utility::string_t value); bool statusIsSet() const; void unsetStatus(); + void setStatus(utility::string_t value); protected: int64_t m_Id; diff --git a/samples/client/petstore/cpprest/model/Tag.cpp b/samples/client/petstore/cpprest/model/Tag.cpp index 0b3220e5110..6d5e350ab91 100644 --- a/samples/client/petstore/cpprest/model/Tag.cpp +++ b/samples/client/petstore/cpprest/model/Tag.cpp @@ -106,12 +106,12 @@ int64_t Tag::getId() const return m_Id; } + void Tag::setId(int64_t value) { m_Id = value; m_IdIsSet = true; } - bool Tag::idIsSet() const { return m_IdIsSet; @@ -127,12 +127,12 @@ utility::string_t Tag::getName() const return m_Name; } + void Tag::setName(utility::string_t value) { m_Name = value; m_NameIsSet = true; } - bool Tag::nameIsSet() const { return m_NameIsSet; diff --git a/samples/client/petstore/cpprest/model/Tag.h b/samples/client/petstore/cpprest/model/Tag.h index 311a05461c2..30159052950 100644 --- a/samples/client/petstore/cpprest/model/Tag.h +++ b/samples/client/petstore/cpprest/model/Tag.h @@ -57,16 +57,16 @@ public: /// /// int64_t getId() const; - void setId(int64_t value); bool idIsSet() const; void unsetId(); + void setId(int64_t value); /// /// /// utility::string_t getName() const; - void setName(utility::string_t value); bool nameIsSet() const; void unsetName(); + void setName(utility::string_t value); protected: int64_t m_Id; diff --git a/samples/client/petstore/cpprest/model/User.cpp b/samples/client/petstore/cpprest/model/User.cpp index bf40c4741bd..3cf4e4258d5 100644 --- a/samples/client/petstore/cpprest/model/User.cpp +++ b/samples/client/petstore/cpprest/model/User.cpp @@ -219,12 +219,12 @@ int64_t User::getId() const return m_Id; } + void User::setId(int64_t value) { m_Id = value; m_IdIsSet = true; } - bool User::idIsSet() const { return m_IdIsSet; @@ -240,12 +240,12 @@ utility::string_t User::getUsername() const return m_Username; } + void User::setUsername(utility::string_t value) { m_Username = value; m_UsernameIsSet = true; } - bool User::usernameIsSet() const { return m_UsernameIsSet; @@ -261,12 +261,12 @@ utility::string_t User::getFirstName() const return m_FirstName; } + void User::setFirstName(utility::string_t value) { m_FirstName = value; m_FirstNameIsSet = true; } - bool User::firstNameIsSet() const { return m_FirstNameIsSet; @@ -282,12 +282,12 @@ utility::string_t User::getLastName() const return m_LastName; } + void User::setLastName(utility::string_t value) { m_LastName = value; m_LastNameIsSet = true; } - bool User::lastNameIsSet() const { return m_LastNameIsSet; @@ -303,12 +303,12 @@ utility::string_t User::getEmail() const return m_Email; } + void User::setEmail(utility::string_t value) { m_Email = value; m_EmailIsSet = true; } - bool User::emailIsSet() const { return m_EmailIsSet; @@ -324,12 +324,12 @@ utility::string_t User::getPassword() const return m_Password; } + void User::setPassword(utility::string_t value) { m_Password = value; m_PasswordIsSet = true; } - bool User::passwordIsSet() const { return m_PasswordIsSet; @@ -345,12 +345,12 @@ utility::string_t User::getPhone() const return m_Phone; } + void User::setPhone(utility::string_t value) { m_Phone = value; m_PhoneIsSet = true; } - bool User::phoneIsSet() const { return m_PhoneIsSet; @@ -366,12 +366,12 @@ int32_t User::getUserStatus() const return m_UserStatus; } + void User::setUserStatus(int32_t value) { m_UserStatus = value; m_UserStatusIsSet = true; } - bool User::userStatusIsSet() const { return m_UserStatusIsSet; diff --git a/samples/client/petstore/cpprest/model/User.h b/samples/client/petstore/cpprest/model/User.h index c3c0ee8aeea..3ecd51ce96d 100644 --- a/samples/client/petstore/cpprest/model/User.h +++ b/samples/client/petstore/cpprest/model/User.h @@ -57,58 +57,58 @@ public: /// /// int64_t getId() const; - void setId(int64_t value); bool idIsSet() const; void unsetId(); + void setId(int64_t value); /// /// /// utility::string_t getUsername() const; - void setUsername(utility::string_t value); bool usernameIsSet() const; void unsetUsername(); + void setUsername(utility::string_t value); /// /// /// utility::string_t getFirstName() const; - void setFirstName(utility::string_t value); bool firstNameIsSet() const; void unsetFirstName(); + void setFirstName(utility::string_t value); /// /// /// utility::string_t getLastName() const; - void setLastName(utility::string_t value); bool lastNameIsSet() const; void unsetLastName(); + void setLastName(utility::string_t value); /// /// /// utility::string_t getEmail() const; - void setEmail(utility::string_t value); bool emailIsSet() const; void unsetEmail(); + void setEmail(utility::string_t value); /// /// /// utility::string_t getPassword() const; - void setPassword(utility::string_t value); bool passwordIsSet() const; void unsetPassword(); + void setPassword(utility::string_t value); /// /// /// utility::string_t getPhone() const; - void setPhone(utility::string_t value); bool phoneIsSet() const; void unsetPhone(); + void setPhone(utility::string_t value); /// /// User Status /// int32_t getUserStatus() const; - void setUserStatus(int32_t value); bool userStatusIsSet() const; void unsetUserStatus(); + void setUserStatus(int32_t value); protected: int64_t m_Id; diff --git a/samples/client/petstore/javascript-es6/README.md b/samples/client/petstore/javascript-es6/README.md index 2ea09ae3d9e..35810e96c73 100644 --- a/samples/client/petstore/javascript-es6/README.md +++ b/samples/client/petstore/javascript-es6/README.md @@ -45,6 +45,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/samples/client/petstore/javascript-promise-es6/README.md b/samples/client/petstore/javascript-promise-es6/README.md index b6ceec1bbdd..062b3dd1a27 100644 --- a/samples/client/petstore/javascript-promise-es6/README.md +++ b/samples/client/petstore/javascript-promise-es6/README.md @@ -45,6 +45,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index b6ceec1bbdd..062b3dd1a27 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -45,6 +45,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index 91ef1e6b5ee..5c5f317fa97 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -467,7 +467,7 @@ if (_this.enableCookies && typeof window === 'undefined'){ _this.agent.saveCookies(response); } - resolve({data, response}); + resolve({data: data, response: response}); } catch (err) { reject(err); } diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 2ea09ae3d9e..35810e96c73 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -45,6 +45,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: