Hello.
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?
Hello.
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
HelloReplymessageand I just added a small print statement to
dynamic_codegen/greeter_client.jsand it prints:
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?