Skip to content

jsonpb: unmarshal does not properly support null input values #1361

Open
@jeffrngu

Description

@jeffrngu

What version of protobuf and what language are you using?
Version: v1.5.2
Language: Golang

What did you do?
Unmarshal JSON message where input data contain key of type google.protobuf.NullValue and value set to "null"

.proto and test file can be found under https://github.com/jeffrngu/null_value

test JSON object:

{
"parameter": {
"key": "$param",
"null_value": null
}
}

What did you expect to see?
In the test driver, I expect both "key" and "null_value" to be in the un-marshaled object.
This is the behavior with v1.3.2.

What did you see instead?
Only"key" exists in the un-marshaled object

=== RUN TestNullValue
null_value_test.go:28: Failed to unmarshall foo/parameter/null_value: expected: KeyValue_NullValue; got:
--- FAIL: TestNullValue (0.00s)

FAIL

Process finished with exit code 1

Anything else we should know about your project / environment?
No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions