Repository navigation
Support proto3 field presence - #332
Merged
Merged
Conversation
Protobuf recently added support for [optional fields][].
These are opt-in on a per-code-generator basis.
Without this flag, you get an error:
example.proto: is a proto3 file that contains optional fields, but code generator protoc-gen-twirp hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional.
As far as I can tell, there should not be anything special we need to do
to support optional fields in Twirp as we only reference message types
and don't do anything with their fields.
[optional fields]: https://github.com/protocolbuffers/protobuf/blob/v3.12.0/docs/field_presence.md#application-note-field-presence
1 task done
|
Can' wait to have it in official release generator. |
Contributor
|
Looks good to me, thanks for the PR! |
|
thanks a lot for merge @zulakm, it's also possible to release it as minor version? |
|
Thank you @zulakm! It would be great if this change appeared in next release ;) |
This was referenced Apr 13, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Protobuf recently added support for field presence. In a proto file, they are denoted by the
optionalkeyword, e.g.Support for optional fields is opt-in on a per-code-generator basis. Without adding a particular flag, you get an error:
As far as I can tell, there should not be anything special we need to do to support optional fields in Twirp as we only reference message types and don't do anything with their fields.
Support was previously attempted in #275 but that was closed.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.