Skip to content

Request to add functionality for default value setting of 'proto-loader' #1742

Open
@0Ams

Description

@0Ams

Is your feature request related to a problem? Please describe.

syntax = "proto3";
package dummy;

service Test {
  rpc ping(PingParam) returns (PingReturn) {}
}
message PingParam {
  string __param = 1 [default = 'ping'];
}
message PingReturn {
  string __result = 1;
}
  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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions