We're using the openapi generator to generate our REST client. Works really well, until we started using enums in the UPERCASE_UNDERSCORE
format. It strips out the underscore. The main problem with this is it makes casting this enum a real pain in Typescript as the property name doesn't match the definition.
Here's an example,m the YAML:
properties:
boostId:
type: string
maxLength: 50
type:
type: string
enum:
- BOOST_UNIQUE_ALERT_TYPE_COUNTER
- BOOST_UNIQUE_SOURCE_SYSTEM_COUNTER
Produces:
var BoostConfiguration;
(function (BoostConfiguration) {
/**
* @export
* @enum {string}
*/
var TypeEnum;
(function (TypeEnum) {
TypeEnum["UNIQUEALERTTYPECOUNTER"] = "BOOST_UNIQUE_ALERT_TYPE_COUNTER";
TypeEnum["UNIQUESOURCESYSTEMCOUNTER"] = "BOOST_UNIQUE_SOURCE_SYSTEM_COUNTER";
})(TypeEnum = BoostConfiguration.TypeEnum || (BoostConfiguration.TypeEnum = {}));
})(BoostConfiguration = exports.BoostConfiguration || (exports.BoostConfiguration = {}));
It's stripped out the "BOOST" for some reason, and removed underscores. I've tried both enumPropertyNaming=original
and modelPropertyNaming=original
, neither seem to change anything (in the enums). This is our generator script:
openapi-generator generate -i api/socosApi.yaml -g typescript-axios -o generated-sources/api --additional-properties=enumPropertyNaming=original,modelPropertyNaming=original