commit | 76b1389531e20b7e892cd4a3179252cb889744b0 | [log] [tgz] |
---|---|---|
author | Ömer Sinan Ağacan <omersa@google.com> | Tue Oct 18 08:05:13 2022 +0200 |
committer | GitHub <noreply@github.com> | Tue Oct 18 09:05:13 2022 +0300 |
tree | e07644d499bee6e7dc15a2a30ad57d3da6819245 | |
parent | 1d175bef6043bc4bdef5970f6dbd6d3001124373 [diff] |
Fix `null` handling in proto3 JSON deserializer (#763) [proto3 JSON spec][1] says this about `null` values: > If a value is missing in the JSON-encoded data or if its value is > null, it will be interpreted as the appropriate default value when > parsed into a protocol buffer proto3 spec does not talk about presence, but in an internal spec we have this about proto3 JSON null values: > When parsing, a “null” value is accepted for all field types. It will > be treated as if the field has the default value (the field itself > would not be set, but its getter will return the default value for > proto3). So we shouldn't be initializing the fields with `null` values. The "interpreted as default value" part in the public spec is already handled by the getters. With this #760 is no longer an issue as we don't generate empty message for the field value when we have a message-field. We will still accept proto3 JSON message encodings with missing `required` fields, but that's by design. We don't check for `required` fields until `GeneratedMessage.check` is called. Closes #760 [1]: https://developers.google.com/protocol-buffers/docs/proto3#json
Protocol Buffers (protobuf) are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.
This repository is home to packages related to protobuf for Dart.
Package | Description | Published Version |
---|---|---|
protobuf | A support library for the generated code | |
protoc_plugin | A Dart back-end for the protoc compiler | |
api_benchmark | Benchmarking for various API calls | |
query_benchmark | Benchmark for encoding and decoding of a “real-world” protobuf |