Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JavaScript] Fix duplicated superclass constructor calls #1270

Merged
merged 1 commit into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{{#models}}{{#model}}
{{#emitJSDoc}}
/**
Expand All @@ -21,11 +20,28 @@
var _this = this;
{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array();
Object.setPrototypeOf(_this, exports);
{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});{{/parentModel}}
{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});
{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}}
{{/vars}}{{#parent}}{{^parentModel}} return _this;
{{/parentModel}}{{/parent}} };
{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}
{{#useInheritance}}
{{#parentModel}}
{{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});
{{/parentModel}}
{{^parentModel}}
{{#interfaceModels}}
{{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});
{{/interfaceModels}}
{{/parentModel}}
{{/useInheritance}}
{{#vars}}
{{#required}}
_this['{{baseName}}'] = {{name}};
{{/required}}
{{/vars}}
{{#parent}}
{{^parentModel}}
return _this;
{{/parentModel}}
{{/parent}}
};

{{#emitJSDoc}}
/**
Expand All @@ -45,13 +61,27 @@
exports.constructFromObject = function(data, obj) {
if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} {
obj = obj || new exports();
{{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-itemType}}');
{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.constructFromObject(data, obj);{{/parentModel}}
{{#interfaces}} {{.}}.constructFromObject(data, obj);
{{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) {
{{#parent}}
{{^parentModel}}
ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-itemType}}');
{{/parentModel}}
{{/parent}}
{{#useInheritance}}
{{#parentModel}}
{{classname}}.constructFromObject(data, obj);
{{/parentModel}}
{{^parentModel}}
{{#interfaces}}
{{.}}.constructFromObject(data, obj);
{{/interfaces}}
{{/parentModel}}
{{/useInheritance}}
{{#vars}}
if (data.hasOwnProperty('{{baseName}}')) {
obj['{{baseName}}']{{{defaultValueWithParam}}}
}
{{/vars}} }
{{/vars}}
}
return obj;
}
{{/vendorExtensions.x-isPrimitive}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.0-SNAPSHOT
3.3.2-SNAPSHOT
2 changes: 1 addition & 1 deletion samples/client/petstore/javascript-es6/docs/FakeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ test inline additionalProperties
import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let requestBody = {key: "inner_example"}; // {String: String} | request body
let requestBody = {key: "null"}; // {String: String} | request body
apiInstance.testInlineAdditionalProperties(requestBody, (error, data, response) => {
if (error) {
console.error(error);
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/javascript-es6/docs/MapTest.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name | Type | Description | Notes
**mapMapOfString** | **{String: {String: String}}** | | [optional]
**mapOfEnumString** | **{String: String}** | | [optional]
**directMap** | **{String: Boolean}** | | [optional]
**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
**indirectMap** | **{String: Boolean}** | | [optional]


<a name="{String: String}"></a>
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/javascript-es6/docs/PetApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ let petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new OpenApiPetstore.PetApi();
let tags = ["inner_example"]; // [String] | Tags to filter by
let tags = ["null"]; // [String] | Tags to filter by
apiInstance.findPetsByTags(tags, (error, data, response) => {
if (error) {
console.error(error);
Expand Down
5 changes: 2 additions & 3 deletions samples/client/petstore/javascript-es6/src/model/MapTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/

import ApiClient from '../ApiClient';
import StringBooleanMap from './StringBooleanMap';

/**
* The MapTest model module.
Expand Down Expand Up @@ -58,7 +57,7 @@ class MapTest {
obj['direct_map'] = ApiClient.convertToType(data['direct_map'], {'String': 'Boolean'});
}
if (data.hasOwnProperty('indirect_map')) {
obj['indirect_map'] = StringBooleanMap.constructFromObject(data['indirect_map']);
obj['indirect_map'] = ApiClient.convertToType(data['indirect_map'], {'String': 'Boolean'});
}
}
return obj;
Expand All @@ -83,7 +82,7 @@ MapTest.prototype['map_of_enum_string'] = undefined;
MapTest.prototype['direct_map'] = undefined;

/**
* @member {module:model/StringBooleanMap} indirect_map
* @member {Object.<String, Boolean>} indirect_map
*/
MapTest.prototype['indirect_map'] = undefined;

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.0-SNAPSHOT
3.3.2-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ test inline additionalProperties
import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let requestBody = {key: "inner_example"}; // {String: String} | request body
let requestBody = {key: "null"}; // {String: String} | request body
apiInstance.testInlineAdditionalProperties(requestBody).then(() => {
console.log('API called successfully.');
}, (error) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name | Type | Description | Notes
**mapMapOfString** | **{String: {String: String}}** | | [optional]
**mapOfEnumString** | **{String: String}** | | [optional]
**directMap** | **{String: Boolean}** | | [optional]
**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
**indirectMap** | **{String: Boolean}** | | [optional]


<a name="{String: String}"></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ let petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new OpenApiPetstore.PetApi();
let tags = ["inner_example"]; // [String] | Tags to filter by
let tags = ["null"]; // [String] | Tags to filter by
apiInstance.findPetsByTags(tags).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/

import ApiClient from '../ApiClient';
import StringBooleanMap from './StringBooleanMap';

/**
* The MapTest model module.
Expand Down Expand Up @@ -58,7 +57,7 @@ class MapTest {
obj['direct_map'] = ApiClient.convertToType(data['direct_map'], {'String': 'Boolean'});
}
if (data.hasOwnProperty('indirect_map')) {
obj['indirect_map'] = StringBooleanMap.constructFromObject(data['indirect_map']);
obj['indirect_map'] = ApiClient.convertToType(data['indirect_map'], {'String': 'Boolean'});
}
}
return obj;
Expand All @@ -83,7 +82,7 @@ MapTest.prototype['map_of_enum_string'] = undefined;
MapTest.prototype['direct_map'] = undefined;

/**
* @member {module:model/StringBooleanMap} indirect_map
* @member {Object.<String, Boolean>} indirect_map
*/
MapTest.prototype['indirect_map'] = undefined;

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.0-SNAPSHOT
3.3.2-SNAPSHOT
2 changes: 1 addition & 1 deletion samples/client/petstore/javascript-promise/docs/FakeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ test inline additionalProperties
var OpenApiPetstore = require('open_api_petstore');

var apiInstance = new OpenApiPetstore.FakeApi();
var requestBody = {key: "inner_example"}; // {String: String} | request body
var requestBody = {key: "null"}; // {String: String} | request body
apiInstance.testInlineAdditionalProperties(requestBody).then(function() {
console.log('API called successfully.');
}, function(error) {
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/javascript-promise/docs/MapTest.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name | Type | Description | Notes
**mapMapOfString** | **{String: {String: String}}** | | [optional]
**mapOfEnumString** | **{String: String}** | | [optional]
**directMap** | **{String: Boolean}** | | [optional]
**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
**indirectMap** | **{String: Boolean}** | | [optional]


<a name="{String: String}"></a>
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/javascript-promise/docs/PetApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new OpenApiPetstore.PetApi();
var tags = ["inner_example"]; // [String] | Tags to filter by
var tags = ["null"]; // [String] | Tags to filter by
apiInstance.findPetsByTags(tags).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/javascript-promise/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand All @@ -32,7 +32,6 @@




/**
* The AdditionalPropertiesClass model module.
* @module model/AdditionalPropertiesClass
Expand All @@ -47,8 +46,6 @@
var exports = function() {
var _this = this;



};

/**
Expand All @@ -61,7 +58,6 @@
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();

if (data.hasOwnProperty('map_property')) {
obj['map_property'] = ApiClient.convertToType(data['map_property'], {'String': 'String'});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand All @@ -32,7 +32,6 @@




/**
* The Animal model module.
* @module model/Animal
Expand All @@ -49,7 +48,6 @@
var _this = this;

_this['className'] = className;

};

/**
Expand All @@ -62,7 +60,6 @@
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();

if (data.hasOwnProperty('className')) {
obj['className'] = ApiClient.convertToType(data['className'], 'String');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.3.0-SNAPSHOT
* OpenAPI Generator version: 3.3.2-SNAPSHOT
*
* Do not edit the class manually.
*
Expand All @@ -32,7 +32,6 @@




/**
* The AnimalFarm model module.
* @module model/AnimalFarm
Expand Down Expand Up @@ -64,7 +63,6 @@
if (data) {
obj = obj || new exports();
ApiClient.constructFromObject(data, obj, 'Animal');

}
return obj;
}
Expand Down
Loading