grpc / grpc/grpc-node

if the message has an optional field with a return value, the proto will attach a same name field with `_` prefix. why?

Open
#2,754 5 comments 1 reaction 0 assignees View on GitHub
package: @grpc/proto-loader
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

### Problem description
if the message has an option field with a return value, the proto will attach a same name field with `_` prefix. why?

### Reproduction steps
- message like this
```js
message Res {
uint32 code = 1;
optional string msg = 2;
string status = 3;
optional string error = 4;
optional uint32 count = 5;
}
```
- server retun
![image](https://github.com/grpc/grpc-node/assets/44340137/3cab737d-4064-430f-a5c5-a084b6938a17)

- real result client got
![image](https://github.com/grpc/grpc-node/assets/44340137/4b8e3c6f-8032-41a2-9c64-73a0f62c7e55)

### Environment
- OS name, version and architecture: windows11
- Node version : 16.15
- Node installation method. binary
- If applicable, compiler version [e.g. clang 3.8.0-2ubuntu4]
- Package name and version: 1.10.8

### Additional context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.