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

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

@alexander-fenster alexander-fenster merged commit 6c4d307 into master Apr 15, 2021
@alexander-fenster alexander-fenster deleted the optional branch April 15, 2021 17:56
dae added a commit to ankitects/protobuf.js that referenced this pull request 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 pull request 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).
@hxsf
Copy link

hxsf commented Oct 17, 2022

Does the change for commets(cli/targets/static.js) be reset by other PR #1597 link

renawolford6 added a commit to renawolford6/protobuf-script-build-javascript that referenced this pull request Nov 10, 2022
… (#1693)

protobufjs/protobuf.js#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.

4 participants