forked from loafle/openapi-generator-original
Add constructFromObject to Javascript enum generation. (#4120)
* Add constructFromObject to Javascript enum generation. Generated code calls constructFromObject on enum types, but enum did not define the necessary function. Returns the value of the enum. * Update Petstore JS API client
This commit is contained in:
parent
1a2b345c57
commit
ab9ea5b2c3
@ -20,5 +20,14 @@
|
|||||||
{{/allowableValues}}
|
{{/allowableValues}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a <code>{{classname}}</code> enum value from a Javascript object name.
|
||||||
|
* @param {Object} data The plain JavaScript object containing the name of the enum value.
|
||||||
|
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The enum <code>{{classname}}</code> value.
|
||||||
|
*/
|
||||||
|
exports.constructFromObject = function(object) {
|
||||||
|
return exports[object];
|
||||||
|
}
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
}));
|
}));
|
||||||
|
@ -62,6 +62,15 @@
|
|||||||
*/
|
*/
|
||||||
"(xyz)": "(xyz)" };
|
"(xyz)": "(xyz)" };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a <code>EnumClass</code> enum value from a Javascript object name.
|
||||||
|
* @param {Object} data The plain JavaScript object containing the name of the enum value.
|
||||||
|
* @return {module:model/EnumClass} The enum <code>EnumClass</code> value.
|
||||||
|
*/
|
||||||
|
exports.constructFromObject = function(object) {
|
||||||
|
return exports[object];
|
||||||
|
}
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -62,6 +62,15 @@
|
|||||||
*/
|
*/
|
||||||
"(xyz)": "(xyz)" };
|
"(xyz)": "(xyz)" };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a <code>EnumClass</code> enum value from a Javascript object name.
|
||||||
|
* @param {Object} data The plain JavaScript object containing the name of the enum value.
|
||||||
|
* @return {module:model/EnumClass} The enum <code>EnumClass</code> value.
|
||||||
|
*/
|
||||||
|
exports.constructFromObject = function(object) {
|
||||||
|
return exports[object];
|
||||||
|
}
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user