protobuf.js
protobuf.js copied to clipboard
Use Default Value to Clear OneOf Field
Write field type's default value when clearing a OneOf field instead of null. This fixes a bug with the gRPC repository which depends on protobufjs5. Specifically proto3 asserts that nonexistent string fields should be set to the empty string and not null. The breaks serialization/deserialization of OneOf fields, where there is an unset string type field. e.g oneof Foo { string bar = 1; Baz baz = 2; } If baz is set, but bar is not, bar will throw an error when serializing/deserializing with the grpc package.