Unused message properties are being defaulted
See original GitHub issueHello.
If I send a message via gRPC which doesn’t have all of its properties set, they are being defaulted to a null/empty value. I’ve modified the officially provided example to simulate this issue.
I included some more properties in the HelloReply
message
message HelloReply {
string message = 1;
double number_property = 2;
string string_property = 3;
repeated string array_property = 4;
message NestedMsg {
string property = 1;
}
NestedMsg nested_property = 5;
}
and I just added a small print statement to dynamic_codegen/greeter_client.js
console.log('Total message:', JSON.stringify(response));
and it prints:
Total message: {"message":"Hello world","number_property":0,"string_property":"","array_property":[],"nested_property":null}
So, all properties are being defaulted to 0/“”/[]/null. Is this the expected behaviour? I thought it could also be a protobuf.js-specific issue. In my case, this behaviour is not desirable as in some cases I override existing data in my system with data from protobuf messages and if those properties are defaulted I might even override valid data with a null or empty value.
If this is the expected workflow for gRPC messages, can it be turned off?
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
@respinha-ribeiro there’s an issue with node 10 (nodejs/node#20258) that prevents us from running tests with node 10 at the moment, so we can’t legitimately recommend using node 10 with gRPC just yet. This will require a new release of node 10.
This is fixed with #307 but not released yet