connectrpc / connect-es

The TypeScript implementation of Connect: Protobuf RPC that works.
https://connectrpc.com/
Apache License 2.0
1.4k stars 82 forks source link

Issue with protoc-gen-es when using hyphens in json_name #1285

Closed nicole0707 closed 1 month ago

nicole0707 commented 1 month ago

Describe the bug

When using protoc-gen-es with json_types=true option, if the value of json_name includes a hyphen(e.g. "x-id"), it causes errors in the generated Typescript or Javascript files.

To Reproduce

 /**
   * @generated from field: string x_id = 101 [json_name = "x-id"];
   */
  x-id?: string;

Additional context The generated code should correctly handle the hyphen without causing syntax errors.

nicole0707 commented 1 month ago

Apologize, just create a new issue in the appropriate repo - https://github.com/bufbuild/protobuf-es/issues/995