[JavaScript] Duplicate superclass constructor calls
Created by: delenius
Description
The JavaScript client generator generates two calls to the superclass constructor. For example, in samples/client/petstore/javascript/src/model/Dog.js
, we have
/**
* Constructs a new <code>Dog</code>.
* @alias module:model/Dog
* @class
* @extends module:model/Animal
* @implements module:model/Animal
* @param className {}
*/
var exports = function(className) {
var _this = this;
Animal.call(_this, className);
Animal.call(_this, className);
};
and also
/**
* Constructs a <code>Dog</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Dog} obj Optional instance to populate.
* @return {module:model/Dog} The populated <code>Dog</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
Animal.constructFromObject(data, obj);
Animal.constructFromObject(data, obj);
if (data.hasOwnProperty('breed')) {
obj['breed'] = ApiClient.convertToType(data['breed'], 'String');
}
}
return obj;
}
Looking at the code, one of the calls comes from the parent
property, and one from interfaceModels
.
I'm not sure where those values ultimately come from. "interfaceModels" is not an openapi concept AFAIK.
openapi-generator version
3.3.1-SNAPSHOT (latest from git at the time of writing).
Suggest a fix/enhancement
I am guessing a reasonable solution would be to remove the parent
from the interfaceModels
in DefaultCodegen.postProcessAllModels
, but I am not sure how this would affect e.g. the Java client generator.