fullstorydev / fullstorydev/grpcurl

Missing special handling for json 'null' value for google.protobuf.NullValue

Open
#473 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
12.8k
Forks
580
Avg merge
1h 8m
Merged PRs (30d)
5

Description

According to the documentation https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/struct.proto
for google.protobuf.NullValue type:
```proto
// `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:
```proto
google.protobuf.NullValue null_value = 1;
```

When I try to send the following payload:
```json
"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:
```json
"null_value": "NULL_VALUE"
```
the request succeeds.

I would expect json `null` to be handled in the same as the "NULL_VALUE".

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.