Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement support for proto3 optional #26

Merged
merged 3 commits into from
Apr 24, 2024

Conversation

jchaffraix-slack
Copy link
Collaborator

proto3 optional requires opting into the
experimental feature in our code generator.

proto3 optional is implemented as a one-off
synthetic field so we must treat those as normal
objects in our codegenerator. You can find the
instructions on how to handle those in the upstream protobuf documentation:
https://github.com/protocolbuffers/protobuf/blob/main/docs/implementing_proto3_presence.md

The PR adds tests for the logic for both binary
and JSON decoding. We are missing reflection
support but that seemed reasonable for now.

proto3 optional requires opting into the
experimental feature in our code generator.

proto3 optional is implemented as a one-off
synthetic field so we must treat those as normal
objects in our codegenerator. You can find the
instructions on how to handle those in the upstream
protobuf documentation:
https://github.com/protocolbuffers/protobuf/blob/main/docs/implementing_proto3_presence.md

The PR adds tests for the logic for both binary
and JSON decoding. We are missing reflection
support but that seemed reasonable for now.
Copy link

@junoatwork junoatwork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation seems good and straightforward. I'm not 100% familiar with all of the cases which should be covered, so this shouldn't be taken as a correctness audit, but from what I can tell this implementation seems consistent with the proto3 optional documentation linked in the PR description, and the test cases seem reasonable. See comments inline.

LGTM

generated/test/custom_optional_proto3.pb.bin Show resolved Hide resolved
test/test_suite.php Show resolved Hide resolved
@jchaffraix-slack jchaffraix-slack merged commit 9eb21c3 into master Apr 24, 2024
2 checks passed
@jchaffraix-slack jchaffraix-slack deleted the julien_support_optional_proto3 branch April 24, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants