grpcurl
grpcurl copied to clipboard
Missing special handling for json 'null' value for google.protobuf.NullValue
According to the documentation https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/struct.proto for google.protobuf.NullValue type:
// `NullValue` is a singleton enumeration to represent the null value for the
// `Value` type union.
//
// The JSON representation for `NullValue` is JSON `null`.
enum NullValue {
// Null value.
NULL_VALUE = 0;
}
json null value has to be interpreted as NULL_VALUE.
It seems to be not the case.
My TestMessage has a field as follows:
google.protobuf.NullValue null_value = 1;
When I try to send the following payload:
"null_value": null
I am getting an error:
"Error invoking method "TestService/test": error getting request data: message type TestMessage cannot set field null_value to null: it is not a message type".
If I handle the NullValue as an enum and send the following payload:
"null_value": "NULL_VALUE"
the request succeeds.
I would expect json null to be handled in the same as the "NULL_VALUE".