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

Does not match uppercasing of enum keys of protoc #25

Closed
TLadd opened this issue Jul 8, 2018 · 2 comments
Closed

Does not match uppercasing of enum keys of protoc #25

TLadd opened this issue Jul 8, 2018 · 2 comments

Comments

@TLadd
Copy link

TLadd commented Jul 8, 2018

grpc_tools_node_protoc automatically uppercases enum keys, whereas grpc_tools_node_protoc_ts maintains whatever casing is in the proto file. The mismatch causes typescript errors when using the javascript enum correctly.

Example repo here: https://github.com/TLadd/example-grpc-enum.

Proto file: https://github.com/TLadd/example-grpc-enum/blob/master/helloworld.proto#L32

message HelloRequest {
  enum Value {
    hello = 0;
    hi = 1;
  }
  string name = 1;
  HelloRequest.Value value = 2;

Generated js: https://github.com/TLadd/example-grpc-enum/blob/master/helloworld_pb.js#L160

proto.helloworld.HelloRequest.Value = {
  HELLO: 0,
  HI: 1
};

Generated ts:
https://github.com/TLadd/example-grpc-enum/blob/master/helloworld_pb.d.ts#L33

    export enum Value {
    hello = 0,
    hi = 1,
    }
@agreatfool
Copy link
Owner

Just merged, and latest version 2.3.1 has been published. Thank you for your issue & pr.

@TLadd
Copy link
Author

TLadd commented Jul 9, 2018

Thank you for the timely review and publish!

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

2 participants