Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GVladi opened this issue Jul 2, 2024 · 0 comments

Comments

@GVladi
Copy link

GVladi commented Jul 2, 2024

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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant