-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Milestone
Description
It seems that the generation of enums in the JS client generator is a bit odd. Currently, I get something like (omitting comments):
var AccountTypeEnum = function AccountTypeEnum() {
var self = this;
self.PAIDACCOUNT = "paidAccount",
self.FREEACCOUNT = "freeAccount"
}This is a class, where each instance has its own copy of the fields PAIDACCOUNT and FREEACCOUNT. To use this, you would currently have to do:
var myAccountType = new AccountTypeEnum();
doSomething(myAccountType.PAIDACCOUNT);This is a strange way to encode enums.
I propose that we change it to just an object,
var AccountTypeEnum = {
PAIDACCOUNT: "paidAccount",
FREEACCOUNT: "freeAccount"
}The usage would then be
doSomething(AccountTypeEnum.PAIDACCOUNT);If the powers that be agree, I can file a PR.
Reactions are currently unavailable