Request to add functionality for default value setting of 'proto-loader'
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 716
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 10
Description
### Is your feature request related to a problem? Please describe.
```proto
syntax = "proto3";
package dummy;
service Test {
rpc ping(PingParam) returns (PingReturn) {}
}
message PingParam {
string __param = 1 [default = 'ping'];
}
message PingReturn {
string __result = 1;
}
```
```typescript
const protoLoaderOptions: protoLoader.Options = {
keepCase: true
// longs: String,
// enums: String,
// defaults: true
// oneofs: true
};
const protoDescriptor = grpc.loadPackageDefinition(protoLoader.loadSync(path, protoLoaderOptions));
```
When used as above, `protoLoader.Options` only adds the default value when `defaults: true`.
I want the default value to enter only when there is a setting such as [default = 'XX'] within the proto file
If you set defaults: true, all fields will have default values.
### Describe the solution you'd like
* It is recommended that the default value is set only if [default = ''] is set within the proto file.
### Describe alternatives you've considered
* If the default value is set to [default = ''], shouldn't we choose to set only those fields
### Additional context
* Nothing
> PS. If have the same method as the function, please advise me. I thought there was no way to solve this. That's why we create an issue.
Contributor guide
Assessment
This issue has not been assessed yet.