Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casing of enums #21

Closed
manu-st opened this issue Aug 21, 2017 · 1 comment
Closed

Casing of enums #21

manu-st opened this issue Aug 21, 2017 · 1 comment
Milestone

Comments

@manu-st
Copy link

manu-st commented Aug 21, 2017

If I have the following definition:

message MyMsg
{
   enum MyEnum
   {
      None = 0;
      Manual = 1;
      Auto = 2;
   }
   MyEnum type = 1;
}

It generates the following TypeScript definition:

export namespace MyMsg{
  export type AsObject = {
    type: MyMsg.MyEnum,
  }

  export enum MyEnum {
    None = 0,
    Manual = 1,
    Auto = 2,
  }
}

However at runtime, the runtime object for MyEnum has values that are all uppercase, not what specified in the TypeScript definition. Shouldn't ts-protoc-gen generates the uppercase names to match what is generated?

@jonnyreeves
Copy link
Contributor

Indeed, protoc will convert the case of enums into ALL_CAPS; the fix for ts-protoc-gen is straightforward, but I would also like to confirm that this behaviour in protoc is intentional so I've raised protocolbuffers/protobuf#3551.

@jonnyreeves jonnyreeves self-assigned this Aug 23, 2017
jonnyreeves added a commit to jonnyreeves/ts-protoc-gen that referenced this issue Aug 23, 2017
@jonnyreeves jonnyreeves added this to the 0.4.1 milestone Aug 23, 2017
@jonny-improbable jonny-improbable modified the milestones: 0.4.1, 0.5.0 Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants