From 153faebc6dc3a5eb95eb3914e63164717969da95 Mon Sep 17 00:00:00 2001 From: delenius Date: Mon, 8 Feb 2016 12:39:30 -0800 Subject: [PATCH] Modify JS PetStore tests for prototypes change This is just the result of running ./bin/javascript-petstore.sh after the fix for #2044. --- .../petstore/javascript/src/model/Category.js | 85 +++--- .../petstore/javascript/src/model/Order.js | 217 +++++++------- .../petstore/javascript/src/model/Pet.js | 217 +++++++------- .../petstore/javascript/src/model/Tag.js | 85 +++--- .../petstore/javascript/src/model/User.js | 281 +++++++++--------- 5 files changed, 440 insertions(+), 445 deletions(-) diff --git a/samples/client/petstore/javascript/src/model/Category.js b/samples/client/petstore/javascript/src/model/Category.js index 9f7c53a2240..4b58f1e7c4d 100644 --- a/samples/client/petstore/javascript/src/model/Category.js +++ b/samples/client/petstore/javascript/src/model/Category.js @@ -20,65 +20,64 @@ var Category = function Category() { - var self = this; /** * datatype: Integer **/ - self['id'] = null; + this['id'] = null; /** * datatype: String **/ - self['name'] = null; + this['name'] = null; + }; - self.constructFromObject = function(data) { - if (!data) { - return this; - } - - self['id'] = ApiClient.convertToType(data['id'], 'Integer'); - - self['name'] = ApiClient.convertToType(data['name'], 'String'); - + Category.prototype.constructFromObject = function(data) { + if (!data) { return this; } - - /** - * @return {Integer} - **/ - self.getId = function() { - return self['id']; - } - - /** - * @param {Integer} id - **/ - self.setId = function(id) { - self['id'] = id; - } + this['id'] = ApiClient.convertToType(data['id'], 'Integer'); - /** - * @return {String} - **/ - self.getName = function() { - return self['name']; - } - - /** - * @param {String} name - **/ - self.setName = function(name) { - self['name'] = name; - } + this['name'] = ApiClient.convertToType(data['name'], 'String'); + return this; + } - self.toJson = function() { - return JSON.stringify(self); - } - }; + + /** + * @return {Integer} + **/ + Category.prototype.getId = function() { + return this['id']; + } + + /** + * @param {Integer} id + **/ + Category.prototype.setId = function(id) { + this['id'] = id; + } + + /** + * @return {String} + **/ + Category.prototype.getName = function() { + return this['name']; + } + + /** + * @param {String} name + **/ + Category.prototype.setName = function(name) { + this['name'] = name; + } + + + Category.prototype.toJson = function() { + return JSON.stringify(this); + } if (module) { module.Category = Category; diff --git a/samples/client/petstore/javascript/src/model/Order.js b/samples/client/petstore/javascript/src/model/Order.js index 1ac5ff706af..c9dd8403a4f 100644 --- a/samples/client/petstore/javascript/src/model/Order.js +++ b/samples/client/petstore/javascript/src/model/Order.js @@ -48,152 +48,151 @@ var StatusEnum = function StatusEnum() { var Order = function Order() { - var self = this; /** * datatype: Integer **/ - self['id'] = null; + this['id'] = null; /** * datatype: Integer **/ - self['petId'] = null; + this['petId'] = null; /** * datatype: Integer **/ - self['quantity'] = null; + this['quantity'] = null; /** * datatype: Date **/ - self['shipDate'] = null; + this['shipDate'] = null; /** * Order Status * datatype: StatusEnum **/ - self['status'] = null; + this['status'] = null; /** * datatype: Boolean **/ - self['complete'] = null; + this['complete'] = null; + }; - self.constructFromObject = function(data) { - if (!data) { - return this; - } - - self['id'] = ApiClient.convertToType(data['id'], 'Integer'); - - self['petId'] = ApiClient.convertToType(data['petId'], 'Integer'); - - self['quantity'] = ApiClient.convertToType(data['quantity'], 'Integer'); - - self['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date'); - - self['status'] = ApiClient.convertToType(data['status'], 'String'); - - self['complete'] = ApiClient.convertToType(data['complete'], 'Boolean'); - + Order.prototype.constructFromObject = function(data) { + if (!data) { return this; } - - /** - * @return {Integer} - **/ - self.getId = function() { - return self['id']; - } - - /** - * @param {Integer} id - **/ - self.setId = function(id) { - self['id'] = id; - } + this['id'] = ApiClient.convertToType(data['id'], 'Integer'); - /** - * @return {Integer} - **/ - self.getPetId = function() { - return self['petId']; - } - - /** - * @param {Integer} petId - **/ - self.setPetId = function(petId) { - self['petId'] = petId; - } + this['petId'] = ApiClient.convertToType(data['petId'], 'Integer'); - /** - * @return {Integer} - **/ - self.getQuantity = function() { - return self['quantity']; - } - - /** - * @param {Integer} quantity - **/ - self.setQuantity = function(quantity) { - self['quantity'] = quantity; - } + this['quantity'] = ApiClient.convertToType(data['quantity'], 'Integer'); - /** - * @return {Date} - **/ - self.getShipDate = function() { - return self['shipDate']; - } - - /** - * @param {Date} shipDate - **/ - self.setShipDate = function(shipDate) { - self['shipDate'] = shipDate; - } + this['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date'); - /** - * get Order Status - * @return {StatusEnum} - **/ - self.getStatus = function() { - return self['status']; - } - - /** - * set Order Status - * @param {StatusEnum} status - **/ - self.setStatus = function(status) { - self['status'] = status; - } + this['status'] = ApiClient.convertToType(data['status'], 'String'); - /** - * @return {Boolean} - **/ - self.getComplete = function() { - return self['complete']; - } - - /** - * @param {Boolean} complete - **/ - self.setComplete = function(complete) { - self['complete'] = complete; - } + this['complete'] = ApiClient.convertToType(data['complete'], 'Boolean'); + return this; + } - self.toJson = function() { - return JSON.stringify(self); - } - }; + + /** + * @return {Integer} + **/ + Order.prototype.getId = function() { + return this['id']; + } + + /** + * @param {Integer} id + **/ + Order.prototype.setId = function(id) { + this['id'] = id; + } + + /** + * @return {Integer} + **/ + Order.prototype.getPetId = function() { + return this['petId']; + } + + /** + * @param {Integer} petId + **/ + Order.prototype.setPetId = function(petId) { + this['petId'] = petId; + } + + /** + * @return {Integer} + **/ + Order.prototype.getQuantity = function() { + return this['quantity']; + } + + /** + * @param {Integer} quantity + **/ + Order.prototype.setQuantity = function(quantity) { + this['quantity'] = quantity; + } + + /** + * @return {Date} + **/ + Order.prototype.getShipDate = function() { + return this['shipDate']; + } + + /** + * @param {Date} shipDate + **/ + Order.prototype.setShipDate = function(shipDate) { + this['shipDate'] = shipDate; + } + + /** + * get Order Status + * @return {StatusEnum} + **/ + Order.prototype.getStatus = function() { + return this['status']; + } + + /** + * set Order Status + * @param {StatusEnum} status + **/ + Order.prototype.setStatus = function(status) { + this['status'] = status; + } + + /** + * @return {Boolean} + **/ + Order.prototype.getComplete = function() { + return this['complete']; + } + + /** + * @param {Boolean} complete + **/ + Order.prototype.setComplete = function(complete) { + this['complete'] = complete; + } + + + Order.prototype.toJson = function() { + return JSON.stringify(this); + } if (module) { module.Order = Order; diff --git a/samples/client/petstore/javascript/src/model/Pet.js b/samples/client/petstore/javascript/src/model/Pet.js index d50823edefb..60b24a3f8e5 100644 --- a/samples/client/petstore/javascript/src/model/Pet.js +++ b/samples/client/petstore/javascript/src/model/Pet.js @@ -48,154 +48,153 @@ var StatusEnum = function StatusEnum() { var Pet = function Pet(photoUrls, name) { - var self = this; /** * datatype: Integer **/ - self['id'] = null; + this['id'] = null; /** * datatype: Category **/ - self['category'] = new Category(); + this['category'] = new Category(); /** * datatype: String * required **/ - self['name'] = name; + this['name'] = name; /** * datatype: [String] * required **/ - self['photoUrls'] = photoUrls; + this['photoUrls'] = photoUrls; /** * datatype: [Tag] **/ - self['tags'] = []; + this['tags'] = []; /** * pet status in the store * datatype: StatusEnum **/ - self['status'] = null; + this['status'] = null; + }; - self.constructFromObject = function(data) { - if (!data) { - return this; - } - - self['id'] = ApiClient.convertToType(data['id'], 'Integer'); - - self['category'].constructFromObject(data['category']); - - self['name'] = ApiClient.convertToType(data['name'], 'String'); - - self['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']); - - self['tags'] = ApiClient.convertToType(data['tags'], [Tag]); - - self['status'] = ApiClient.convertToType(data['status'], 'String'); - + Pet.prototype.constructFromObject = function(data) { + if (!data) { return this; } - - /** - * @return {Integer} - **/ - self.getId = function() { - return self['id']; - } - - /** - * @param {Integer} id - **/ - self.setId = function(id) { - self['id'] = id; - } + this['id'] = ApiClient.convertToType(data['id'], 'Integer'); - /** - * @return {Category} - **/ - self.getCategory = function() { - return self['category']; - } - - /** - * @param {Category} category - **/ - self.setCategory = function(category) { - self['category'] = category; - } + this['category'].constructFromObject(data['category']); - /** - * @return {String} - **/ - self.getName = function() { - return self['name']; - } - - /** - * @param {String} name - **/ - self.setName = function(name) { - self['name'] = name; - } + this['name'] = ApiClient.convertToType(data['name'], 'String'); - /** - * @return {[String]} - **/ - self.getPhotoUrls = function() { - return self['photoUrls']; - } - - /** - * @param {[String]} photoUrls - **/ - self.setPhotoUrls = function(photoUrls) { - self['photoUrls'] = photoUrls; - } + this['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']); - /** - * @return {[Tag]} - **/ - self.getTags = function() { - return self['tags']; - } - - /** - * @param {[Tag]} tags - **/ - self.setTags = function(tags) { - self['tags'] = tags; - } + this['tags'] = ApiClient.convertToType(data['tags'], [Tag]); - /** - * get pet status in the store - * @return {StatusEnum} - **/ - self.getStatus = function() { - return self['status']; - } - - /** - * set pet status in the store - * @param {StatusEnum} status - **/ - self.setStatus = function(status) { - self['status'] = status; - } + this['status'] = ApiClient.convertToType(data['status'], 'String'); + return this; + } - self.toJson = function() { - return JSON.stringify(self); - } - }; + + /** + * @return {Integer} + **/ + Pet.prototype.getId = function() { + return this['id']; + } + + /** + * @param {Integer} id + **/ + Pet.prototype.setId = function(id) { + this['id'] = id; + } + + /** + * @return {Category} + **/ + Pet.prototype.getCategory = function() { + return this['category']; + } + + /** + * @param {Category} category + **/ + Pet.prototype.setCategory = function(category) { + this['category'] = category; + } + + /** + * @return {String} + **/ + Pet.prototype.getName = function() { + return this['name']; + } + + /** + * @param {String} name + **/ + Pet.prototype.setName = function(name) { + this['name'] = name; + } + + /** + * @return {[String]} + **/ + Pet.prototype.getPhotoUrls = function() { + return this['photoUrls']; + } + + /** + * @param {[String]} photoUrls + **/ + Pet.prototype.setPhotoUrls = function(photoUrls) { + this['photoUrls'] = photoUrls; + } + + /** + * @return {[Tag]} + **/ + Pet.prototype.getTags = function() { + return this['tags']; + } + + /** + * @param {[Tag]} tags + **/ + Pet.prototype.setTags = function(tags) { + this['tags'] = tags; + } + + /** + * get pet status in the store + * @return {StatusEnum} + **/ + Pet.prototype.getStatus = function() { + return this['status']; + } + + /** + * set pet status in the store + * @param {StatusEnum} status + **/ + Pet.prototype.setStatus = function(status) { + this['status'] = status; + } + + + Pet.prototype.toJson = function() { + return JSON.stringify(this); + } if (module) { module.Pet = Pet; diff --git a/samples/client/petstore/javascript/src/model/Tag.js b/samples/client/petstore/javascript/src/model/Tag.js index 3180975e976..ac3d5373491 100644 --- a/samples/client/petstore/javascript/src/model/Tag.js +++ b/samples/client/petstore/javascript/src/model/Tag.js @@ -20,65 +20,64 @@ var Tag = function Tag() { - var self = this; /** * datatype: Integer **/ - self['id'] = null; + this['id'] = null; /** * datatype: String **/ - self['name'] = null; + this['name'] = null; + }; - self.constructFromObject = function(data) { - if (!data) { - return this; - } - - self['id'] = ApiClient.convertToType(data['id'], 'Integer'); - - self['name'] = ApiClient.convertToType(data['name'], 'String'); - + Tag.prototype.constructFromObject = function(data) { + if (!data) { return this; } - - /** - * @return {Integer} - **/ - self.getId = function() { - return self['id']; - } - - /** - * @param {Integer} id - **/ - self.setId = function(id) { - self['id'] = id; - } + this['id'] = ApiClient.convertToType(data['id'], 'Integer'); - /** - * @return {String} - **/ - self.getName = function() { - return self['name']; - } - - /** - * @param {String} name - **/ - self.setName = function(name) { - self['name'] = name; - } + this['name'] = ApiClient.convertToType(data['name'], 'String'); + return this; + } - self.toJson = function() { - return JSON.stringify(self); - } - }; + + /** + * @return {Integer} + **/ + Tag.prototype.getId = function() { + return this['id']; + } + + /** + * @param {Integer} id + **/ + Tag.prototype.setId = function(id) { + this['id'] = id; + } + + /** + * @return {String} + **/ + Tag.prototype.getName = function() { + return this['name']; + } + + /** + * @param {String} name + **/ + Tag.prototype.setName = function(name) { + this['name'] = name; + } + + + Tag.prototype.toJson = function() { + return JSON.stringify(this); + } if (module) { module.Tag = Tag; diff --git a/samples/client/petstore/javascript/src/model/User.js b/samples/client/petstore/javascript/src/model/User.js index dab5d3791b5..2ee006e0ac9 100644 --- a/samples/client/petstore/javascript/src/model/User.js +++ b/samples/client/petstore/javascript/src/model/User.js @@ -20,194 +20,193 @@ var User = function User() { - var self = this; /** * datatype: Integer **/ - self['id'] = null; + this['id'] = null; /** * datatype: String **/ - self['username'] = null; + this['username'] = null; /** * datatype: String **/ - self['firstName'] = null; + this['firstName'] = null; /** * datatype: String **/ - self['lastName'] = null; + this['lastName'] = null; /** * datatype: String **/ - self['email'] = null; + this['email'] = null; /** * datatype: String **/ - self['password'] = null; + this['password'] = null; /** * datatype: String **/ - self['phone'] = null; + this['phone'] = null; /** * User Status * datatype: Integer **/ - self['userStatus'] = null; + this['userStatus'] = null; + }; - self.constructFromObject = function(data) { - if (!data) { - return this; - } - - self['id'] = ApiClient.convertToType(data['id'], 'Integer'); - - self['username'] = ApiClient.convertToType(data['username'], 'String'); - - self['firstName'] = ApiClient.convertToType(data['firstName'], 'String'); - - self['lastName'] = ApiClient.convertToType(data['lastName'], 'String'); - - self['email'] = ApiClient.convertToType(data['email'], 'String'); - - self['password'] = ApiClient.convertToType(data['password'], 'String'); - - self['phone'] = ApiClient.convertToType(data['phone'], 'String'); - - self['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Integer'); - + User.prototype.constructFromObject = function(data) { + if (!data) { return this; } - - /** - * @return {Integer} - **/ - self.getId = function() { - return self['id']; - } - - /** - * @param {Integer} id - **/ - self.setId = function(id) { - self['id'] = id; - } + this['id'] = ApiClient.convertToType(data['id'], 'Integer'); - /** - * @return {String} - **/ - self.getUsername = function() { - return self['username']; - } - - /** - * @param {String} username - **/ - self.setUsername = function(username) { - self['username'] = username; - } + this['username'] = ApiClient.convertToType(data['username'], 'String'); - /** - * @return {String} - **/ - self.getFirstName = function() { - return self['firstName']; - } - - /** - * @param {String} firstName - **/ - self.setFirstName = function(firstName) { - self['firstName'] = firstName; - } + this['firstName'] = ApiClient.convertToType(data['firstName'], 'String'); - /** - * @return {String} - **/ - self.getLastName = function() { - return self['lastName']; - } - - /** - * @param {String} lastName - **/ - self.setLastName = function(lastName) { - self['lastName'] = lastName; - } + this['lastName'] = ApiClient.convertToType(data['lastName'], 'String'); - /** - * @return {String} - **/ - self.getEmail = function() { - return self['email']; - } - - /** - * @param {String} email - **/ - self.setEmail = function(email) { - self['email'] = email; - } + this['email'] = ApiClient.convertToType(data['email'], 'String'); - /** - * @return {String} - **/ - self.getPassword = function() { - return self['password']; - } - - /** - * @param {String} password - **/ - self.setPassword = function(password) { - self['password'] = password; - } + this['password'] = ApiClient.convertToType(data['password'], 'String'); - /** - * @return {String} - **/ - self.getPhone = function() { - return self['phone']; - } - - /** - * @param {String} phone - **/ - self.setPhone = function(phone) { - self['phone'] = phone; - } + this['phone'] = ApiClient.convertToType(data['phone'], 'String'); - /** - * get User Status - * @return {Integer} - **/ - self.getUserStatus = function() { - return self['userStatus']; - } - - /** - * set User Status - * @param {Integer} userStatus - **/ - self.setUserStatus = function(userStatus) { - self['userStatus'] = userStatus; - } + this['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Integer'); + return this; + } - self.toJson = function() { - return JSON.stringify(self); - } - }; + + /** + * @return {Integer} + **/ + User.prototype.getId = function() { + return this['id']; + } + + /** + * @param {Integer} id + **/ + User.prototype.setId = function(id) { + this['id'] = id; + } + + /** + * @return {String} + **/ + User.prototype.getUsername = function() { + return this['username']; + } + + /** + * @param {String} username + **/ + User.prototype.setUsername = function(username) { + this['username'] = username; + } + + /** + * @return {String} + **/ + User.prototype.getFirstName = function() { + return this['firstName']; + } + + /** + * @param {String} firstName + **/ + User.prototype.setFirstName = function(firstName) { + this['firstName'] = firstName; + } + + /** + * @return {String} + **/ + User.prototype.getLastName = function() { + return this['lastName']; + } + + /** + * @param {String} lastName + **/ + User.prototype.setLastName = function(lastName) { + this['lastName'] = lastName; + } + + /** + * @return {String} + **/ + User.prototype.getEmail = function() { + return this['email']; + } + + /** + * @param {String} email + **/ + User.prototype.setEmail = function(email) { + this['email'] = email; + } + + /** + * @return {String} + **/ + User.prototype.getPassword = function() { + return this['password']; + } + + /** + * @param {String} password + **/ + User.prototype.setPassword = function(password) { + this['password'] = password; + } + + /** + * @return {String} + **/ + User.prototype.getPhone = function() { + return this['phone']; + } + + /** + * @param {String} phone + **/ + User.prototype.setPhone = function(phone) { + this['phone'] = phone; + } + + /** + * get User Status + * @return {Integer} + **/ + User.prototype.getUserStatus = function() { + return this['userStatus']; + } + + /** + * set User Status + * @param {Integer} userStatus + **/ + User.prototype.setUserStatus = function(userStatus) { + this['userStatus'] = userStatus; + } + + + User.prototype.toJson = function() { + return JSON.stringify(this); + } if (module) { module.User = User;