thrift2flow icon indicating copy to clipboard operation
thrift2flow copied to clipboard

Generated enum values are strings when numbers are needed

Open NameFILIP opened this issue 6 years ago • 0 comments

Thrift enum:

enum SomeEnum {
    A = 1,
    B = 2,
    C = 3,
}

I need (as in response from Java code):

const SomeEnum = {
  A: 1,
  B: 2,
  C: 3,
}

but getting:

const SomeEnum = {
  A: 'A',
  B: 'B',
  C: 'C',
}

I think thriftrw uses strings as values (https://github.com/thriftrw/thriftrw-node#enums), but whatever is used on the Java server returns numbers, so I guess this should generate both variants.

NameFILIP avatar Oct 04 '19 00:10 NameFILIP