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

feat: proto3 optional support #1584

Merged
merged 2 commits into from Apr 15, 2021
Merged

feat: proto3 optional support #1584

merged 2 commits into from Apr 15, 2021

Conversation

alexander-fenster
Copy link
Contributor

@alexander-fenster alexander-fenster commented Apr 9, 2021

Adding support for proto3 optional fields as described in the design.

Summary: if the proto has syntax = "proto3";, then for every optional field the parser will create a synthetic single member oneof field. Also, in the static code (produced by pbjs), proto3 optional fields will be set to null by default.

@alexander-fenster
Copy link
Contributor Author

alexander-fenster commented Apr 9, 2021

For testing in Google Cloud client libraries, I published this from this branch as v6.11.0-pre (tagging it next).

bcoe
bcoe approved these changes Apr 14, 2021
@alexander-fenster alexander-fenster merged commit 6c4d307 into master Apr 15, 2021
9 checks passed
@alexander-fenster alexander-fenster deleted the optional branch Apr 15, 2021
dae added a commit to ankitects/protobuf.js that referenced this issue Feb 27, 2022
protobufjs#1584 made proto3 optional
scalars default to null when using static/static-module, but the old
behaviour remained when using reflection (eg json-module).
alexander-fenster pushed a commit that referenced this issue Jul 8, 2022
…#1693)

#1584 made proto3 optional
scalars default to null when using static/static-module, but the old
behaviour remained when using reflection (eg json-module).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants