From 3dbab1b8931492dbc03d105830b3d48fcd2025e4 Mon Sep 17 00:00:00 2001 From: xhh Date: Fri, 6 May 2016 17:36:07 +0800 Subject: [PATCH] JavaScript client: fix exporting of outer enum model --- .../partial_model_enum_class.mustache | 2 +- .../javascript/docs/InlineResponse200.md | 13 -- .../javascript/src/model/EnumClass.js | 2 +- .../javascript/src/model/InlineResponse200.js | 132 ------------------ 4 files changed, 2 insertions(+), 147 deletions(-) delete mode 100644 samples/client/petstore/javascript/docs/InlineResponse200.md delete mode 100644 samples/client/petstore/javascript/src/model/InlineResponse200.js diff --git a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache index c7d18d35841..c85e82aa764 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache @@ -5,7 +5,7 @@ * @readonly */ {{/emitJSDoc}} - exports.{{classname}} = { + var exports = { {{#allowableValues}} {{#values}} {{#emitJSDoc}} diff --git a/samples/client/petstore/javascript/docs/InlineResponse200.md b/samples/client/petstore/javascript/docs/InlineResponse200.md deleted file mode 100644 index bbb11067e9a..00000000000 --- a/samples/client/petstore/javascript/docs/InlineResponse200.md +++ /dev/null @@ -1,13 +0,0 @@ -# SwaggerPetstore.InlineResponse200 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**tags** | [**[Tag]**](Tag.md) | | [optional] -**id** | **Integer** | | -**category** | **Object** | | [optional] -**status** | **String** | pet status in the store | [optional] -**name** | **String** | | [optional] -**photoUrls** | **[String]** | | [optional] - - diff --git a/samples/client/petstore/javascript/src/model/EnumClass.js b/samples/client/petstore/javascript/src/model/EnumClass.js index 2ff3398113a..268addcbaed 100644 --- a/samples/client/petstore/javascript/src/model/EnumClass.js +++ b/samples/client/petstore/javascript/src/model/EnumClass.js @@ -21,7 +21,7 @@ * @enum {} * @readonly */ - exports.EnumClass = { + var exports = { /** * value: _abc * @const diff --git a/samples/client/petstore/javascript/src/model/InlineResponse200.js b/samples/client/petstore/javascript/src/model/InlineResponse200.js deleted file mode 100644 index f2abaf1bd1b..00000000000 --- a/samples/client/petstore/javascript/src/model/InlineResponse200.js +++ /dev/null @@ -1,132 +0,0 @@ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Tag'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('./Tag')); - } else { - // Browser globals (root is window) - if (!root.SwaggerPetstore) { - root.SwaggerPetstore = {}; - } - root.SwaggerPetstore.InlineResponse200 = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Tag); - } -}(this, function(ApiClient, Tag) { - 'use strict'; - - /** - * The InlineResponse200 model module. - * @module model/InlineResponse200 - * @version 1.0.0 - */ - - /** - * Constructs a new InlineResponse200. - * @alias module:model/InlineResponse200 - * @class - * @param id - */ - var exports = function(id) { - - - this['id'] = id; - - - - - }; - - /** - * Constructs a InlineResponse200 from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/InlineResponse200} obj Optional instance to populate. - * @return {module:model/InlineResponse200} The populated InlineResponse200 instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('tags')) { - obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]); - } - if (data.hasOwnProperty('id')) { - obj['id'] = ApiClient.convertToType(data['id'], 'Integer'); - } - if (data.hasOwnProperty('category')) { - obj['category'] = ApiClient.convertToType(data['category'], Object); - } - if (data.hasOwnProperty('status')) { - obj['status'] = ApiClient.convertToType(data['status'], 'String'); - } - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'String'); - } - if (data.hasOwnProperty('photoUrls')) { - obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']); - } - } - return obj; - } - - - /** - * @member {Array.} tags - */ - exports.prototype['tags'] = undefined; - - /** - * @member {Integer} id - */ - exports.prototype['id'] = undefined; - - /** - * @member {Object} category - */ - exports.prototype['category'] = undefined; - - /** - * pet status in the store - * @member {module:model/InlineResponse200.StatusEnum} status - */ - exports.prototype['status'] = undefined; - - /** - * @member {String} name - */ - exports.prototype['name'] = undefined; - - /** - * @member {Array.} photoUrls - */ - exports.prototype['photoUrls'] = undefined; - - - /** - * Allowed values for the status property. - * @enum {String} - * @readonly - */ - exports.StatusEnum = { - /** - * value: available - * @const - */ - AVAILABLE: "available", - - /** - * value: pending - * @const - */ - PENDING: "pending", - - /** - * value: sold - * @const - */ - SOLD: "sold" - }; - - return exports; -}));