Typescript dto Flags enum generated without quotes


I have an issue when generating enums using ServiceStack 5.5 and EnumMember(Value="")

An enum without the [Flags] attribute is generated correctly e.g.

public enum AuditCategory
        [EnumMember(Value="User Action")] UserAction = 1,
        [EnumMember(Value="System Action")] SystemAction = 2

translates to

export enum AuditCategory
    UserAction = 'User Action',
    SystemAction = 'System Action',

However an enum with the [Flags] attributes is generated without the single quotes breaking the dto.

 public enum EnvironmentType
        [EnumMember(Value = "Development")]
        Development= 1,
        [EnumMember(Value = "Production")]
        Production= 2,
        [EnumMember(Value = "All")]
        All = Development| Production

is generated without quotes

// @Flags()
export enum EnvironmentType
    Development= Development,
    Production= Production,
    All = All,

You shouldn’t be using [EnumMember] with [Flags] Enums, The EnumMember serialization attribute specifies how an enum should be serialized but if you’re using [Flag] enums then you only want them serialized as an integer so they can be combined as Enum Flags.

If you want to add a description to the enum values use the [Description] attribute instead.

But I’ve just added a change which will ignore EnumMember for integer enums in this commit, this change is available from the latest v5.5.1 that’s now available on MyGet.