Skip to content

Commit 3b53ac4

Browse files
authored
fix duplicate call in JS (#1270)
1 parent 1b115bb commit 3b53ac4

File tree

107 files changed

+165
-441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+165
-441
lines changed

modules/openapi-generator/src/main/resources/Javascript/partial_model_generic.mustache

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
{{#models}}{{#model}}
32
{{#emitJSDoc}}
43
/**
@@ -21,11 +20,28 @@
2120
var _this = this;
2221
{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array();
2322
Object.setPrototypeOf(_this, exports);
24-
{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});{{/parentModel}}
25-
{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});
26-
{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}}
27-
{{/vars}}{{#parent}}{{^parentModel}} return _this;
28-
{{/parentModel}}{{/parent}} };
23+
{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}
24+
{{#useInheritance}}
25+
{{#parentModel}}
26+
{{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});
27+
{{/parentModel}}
28+
{{^parentModel}}
29+
{{#interfaceModels}}
30+
{{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});
31+
{{/interfaceModels}}
32+
{{/parentModel}}
33+
{{/useInheritance}}
34+
{{#vars}}
35+
{{#required}}
36+
_this['{{baseName}}'] = {{name}};
37+
{{/required}}
38+
{{/vars}}
39+
{{#parent}}
40+
{{^parentModel}}
41+
return _this;
42+
{{/parentModel}}
43+
{{/parent}}
44+
};
2945

3046
{{#emitJSDoc}}
3147
/**
@@ -45,13 +61,27 @@
4561
exports.constructFromObject = function(data, obj) {
4662
if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} {
4763
obj = obj || new exports();
48-
{{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-itemType}}');
49-
{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.constructFromObject(data, obj);{{/parentModel}}
50-
{{#interfaces}} {{.}}.constructFromObject(data, obj);
51-
{{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) {
64+
{{#parent}}
65+
{{^parentModel}}
66+
ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-itemType}}');
67+
{{/parentModel}}
68+
{{/parent}}
69+
{{#useInheritance}}
70+
{{#parentModel}}
71+
{{classname}}.constructFromObject(data, obj);
72+
{{/parentModel}}
73+
{{^parentModel}}
74+
{{#interfaces}}
75+
{{.}}.constructFromObject(data, obj);
76+
{{/interfaces}}
77+
{{/parentModel}}
78+
{{/useInheritance}}
79+
{{#vars}}
80+
if (data.hasOwnProperty('{{baseName}}')) {
5281
obj['{{baseName}}']{{{defaultValueWithParam}}}
5382
}
54-
{{/vars}} }
83+
{{/vars}}
84+
}
5585
return obj;
5686
}
5787
{{/vendorExtensions.x-isPrimitive}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.3.0-SNAPSHOT
1+
3.3.2-SNAPSHOT

samples/client/petstore/javascript-es6/docs/FakeApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ test inline additionalProperties
464464
import OpenApiPetstore from 'open_api_petstore';
465465

466466
let apiInstance = new OpenApiPetstore.FakeApi();
467-
let requestBody = {key: "inner_example"}; // {String: String} | request body
467+
let requestBody = {key: "null"}; // {String: String} | request body
468468
apiInstance.testInlineAdditionalProperties(requestBody, (error, data, response) => {
469469
if (error) {
470470
console.error(error);

samples/client/petstore/javascript-es6/docs/MapTest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Name | Type | Description | Notes
66
**mapMapOfString** | **{String: {String: String}}** | | [optional]
77
**mapOfEnumString** | **{String: String}** | | [optional]
88
**directMap** | **{String: Boolean}** | | [optional]
9-
**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
9+
**indirectMap** | **{String: Boolean}** | | [optional]
1010

1111

1212
<a name="{String: String}"></a>

samples/client/petstore/javascript-es6/docs/PetApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ let petstore_auth = defaultClient.authentications['petstore_auth'];
174174
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
175175

176176
let apiInstance = new OpenApiPetstore.PetApi();
177-
let tags = ["inner_example"]; // [String] | Tags to filter by
177+
let tags = ["null"]; // [String] | Tags to filter by
178178
apiInstance.findPetsByTags(tags, (error, data, response) => {
179179
if (error) {
180180
console.error(error);

samples/client/petstore/javascript-es6/src/model/MapTest.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*/
1313

1414
import ApiClient from '../ApiClient';
15-
import StringBooleanMap from './StringBooleanMap';
1615

1716
/**
1817
* The MapTest model module.
@@ -58,7 +57,7 @@ class MapTest {
5857
obj['direct_map'] = ApiClient.convertToType(data['direct_map'], {'String': 'Boolean'});
5958
}
6059
if (data.hasOwnProperty('indirect_map')) {
61-
obj['indirect_map'] = StringBooleanMap.constructFromObject(data['indirect_map']);
60+
obj['indirect_map'] = ApiClient.convertToType(data['indirect_map'], {'String': 'Boolean'});
6261
}
6362
}
6463
return obj;
@@ -83,7 +82,7 @@ MapTest.prototype['map_of_enum_string'] = undefined;
8382
MapTest.prototype['direct_map'] = undefined;
8483

8584
/**
86-
* @member {module:model/StringBooleanMap} indirect_map
85+
* @member {Object.<String, Boolean>} indirect_map
8786
*/
8887
MapTest.prototype['indirect_map'] = undefined;
8988

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.3.0-SNAPSHOT
1+
3.3.2-SNAPSHOT

samples/client/petstore/javascript-promise-es6/docs/FakeApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ test inline additionalProperties
455455
import OpenApiPetstore from 'open_api_petstore';
456456

457457
let apiInstance = new OpenApiPetstore.FakeApi();
458-
let requestBody = {key: "inner_example"}; // {String: String} | request body
458+
let requestBody = {key: "null"}; // {String: String} | request body
459459
apiInstance.testInlineAdditionalProperties(requestBody).then(() => {
460460
console.log('API called successfully.');
461461
}, (error) => {

samples/client/petstore/javascript-promise-es6/docs/MapTest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Name | Type | Description | Notes
66
**mapMapOfString** | **{String: {String: String}}** | | [optional]
77
**mapOfEnumString** | **{String: String}** | | [optional]
88
**directMap** | **{String: Boolean}** | | [optional]
9-
**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
9+
**indirectMap** | **{String: Boolean}** | | [optional]
1010

1111

1212
<a name="{String: String}"></a>

samples/client/petstore/javascript-promise-es6/docs/PetApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ let petstore_auth = defaultClient.authentications['petstore_auth'];
171171
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
172172

173173
let apiInstance = new OpenApiPetstore.PetApi();
174-
let tags = ["inner_example"]; // [String] | Tags to filter by
174+
let tags = ["null"]; // [String] | Tags to filter by
175175
apiInstance.findPetsByTags(tags).then((data) => {
176176
console.log('API called successfully. Returned data: ' + data);
177177
}, (error) => {

samples/client/petstore/javascript-promise-es6/src/model/MapTest.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*/
1313

1414
import ApiClient from '../ApiClient';
15-
import StringBooleanMap from './StringBooleanMap';
1615

1716
/**
1817
* The MapTest model module.
@@ -58,7 +57,7 @@ class MapTest {
5857
obj['direct_map'] = ApiClient.convertToType(data['direct_map'], {'String': 'Boolean'});
5958
}
6059
if (data.hasOwnProperty('indirect_map')) {
61-
obj['indirect_map'] = StringBooleanMap.constructFromObject(data['indirect_map']);
60+
obj['indirect_map'] = ApiClient.convertToType(data['indirect_map'], {'String': 'Boolean'});
6261
}
6362
}
6463
return obj;
@@ -83,7 +82,7 @@ MapTest.prototype['map_of_enum_string'] = undefined;
8382
MapTest.prototype['direct_map'] = undefined;
8483

8584
/**
86-
* @member {module:model/StringBooleanMap} indirect_map
85+
* @member {Object.<String, Boolean>} indirect_map
8786
*/
8887
MapTest.prototype['indirect_map'] = undefined;
8988

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.3.0-SNAPSHOT
1+
3.3.2-SNAPSHOT

samples/client/petstore/javascript-promise/docs/FakeApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ test inline additionalProperties
455455
var OpenApiPetstore = require('open_api_petstore');
456456

457457
var apiInstance = new OpenApiPetstore.FakeApi();
458-
var requestBody = {key: "inner_example"}; // {String: String} | request body
458+
var requestBody = {key: "null"}; // {String: String} | request body
459459
apiInstance.testInlineAdditionalProperties(requestBody).then(function() {
460460
console.log('API called successfully.');
461461
}, function(error) {

samples/client/petstore/javascript-promise/docs/MapTest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Name | Type | Description | Notes
66
**mapMapOfString** | **{String: {String: String}}** | | [optional]
77
**mapOfEnumString** | **{String: String}** | | [optional]
88
**directMap** | **{String: Boolean}** | | [optional]
9-
**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
9+
**indirectMap** | **{String: Boolean}** | | [optional]
1010

1111

1212
<a name="{String: String}"></a>

samples/client/petstore/javascript-promise/docs/PetApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ var petstore_auth = defaultClient.authentications['petstore_auth'];
167167
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
168168

169169
var apiInstance = new OpenApiPetstore.PetApi();
170-
var tags = ["inner_example"]; // [String] | Tags to filter by
170+
var tags = ["null"]; // [String] | Tags to filter by
171171
apiInstance.findPetsByTags(tags).then(function(data) {
172172
console.log('API called successfully. Returned data: ' + data);
173173
}, function(error) {

samples/client/petstore/javascript-promise/src/ApiClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*

samples/client/petstore/javascript-promise/src/api/AnotherFakeApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*

samples/client/petstore/javascript-promise/src/api/FakeApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*

samples/client/petstore/javascript-promise/src/api/FakeClassnameTags123Api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*

samples/client/petstore/javascript-promise/src/api/PetApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*

samples/client/petstore/javascript-promise/src/api/StoreApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*

samples/client/petstore/javascript-promise/src/api/UserApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*

samples/client/petstore/javascript-promise/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*

samples/client/petstore/javascript-promise/src/model/AdditionalPropertiesClass.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*
@@ -32,7 +32,6 @@
3232

3333

3434

35-
3635
/**
3736
* The AdditionalPropertiesClass model module.
3837
* @module model/AdditionalPropertiesClass
@@ -47,8 +46,6 @@
4746
var exports = function() {
4847
var _this = this;
4948

50-
51-
5249
};
5350

5451
/**
@@ -61,7 +58,6 @@
6158
exports.constructFromObject = function(data, obj) {
6259
if (data) {
6360
obj = obj || new exports();
64-
6561
if (data.hasOwnProperty('map_property')) {
6662
obj['map_property'] = ApiClient.convertToType(data['map_property'], {'String': 'String'});
6763
}

samples/client/petstore/javascript-promise/src/model/Animal.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*
@@ -32,7 +32,6 @@
3232

3333

3434

35-
3635
/**
3736
* The Animal model module.
3837
* @module model/Animal
@@ -49,7 +48,6 @@
4948
var _this = this;
5049

5150
_this['className'] = className;
52-
5351
};
5452

5553
/**
@@ -62,7 +60,6 @@
6260
exports.constructFromObject = function(data, obj) {
6361
if (data) {
6462
obj = obj || new exports();
65-
6663
if (data.hasOwnProperty('className')) {
6764
obj['className'] = ApiClient.convertToType(data['className'], 'String');
6865
}

samples/client/petstore/javascript-promise/src/model/AnimalFarm.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
88
* https://openapi-generator.tech
99
*
10-
* OpenAPI Generator version: 3.3.0-SNAPSHOT
10+
* OpenAPI Generator version: 3.3.2-SNAPSHOT
1111
*
1212
* Do not edit the class manually.
1313
*
@@ -32,7 +32,6 @@
3232

3333

3434

35-
3635
/**
3736
* The AnimalFarm model module.
3837
* @module model/AnimalFarm
@@ -64,7 +63,6 @@
6463
if (data) {
6564
obj = obj || new exports();
6665
ApiClient.constructFromObject(data, obj, 'Animal');
67-
6866
}
6967
return obj;
7068
}

0 commit comments

Comments
 (0)