-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: singular fields should be optional to write (#83)
As per [`proto3`'s language guide](https://developers.google.com/protocol-buffers/docs/proto3#specifying_field_rules): > Message fields can be one of the following: > - singular: a well-formed message can have zero or one of this field (but not more than one). And this is the default field rule for proto3 syntax. This means that all `proto3` fields are effectively optional when writing, so it's relatively easy to implement by accepting a `Partial` version of the message interface for encoding. When reading messages singular fields are initialized to their default values when reading and optional values are not so the plain non-`Partial` interface can be returned. This also has the nice side effect of not requiring the user to pass empty lists/maps for `repeated` and `map` fields which never really felt right. These values are initialized to their empty forms when reading messages from the wire. Fixes #42
- Loading branch information
1 parent
fd2e7a7
commit 229afbc
Showing
16 changed files
with
272 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.