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

Add support for proto3 optional keyword #225

Open
david-bakin-sl opened this issue Mar 7, 2024 · 0 comments
Open

Add support for proto3 optional keyword #225

david-bakin-sl opened this issue Mar 7, 2024 · 0 comments

Comments

@david-bakin-sl
Copy link
Member

Problem

I'm always frustrated when I see google.protobuf.Int32Value in a protobuf schema to represent an optional int32 field, when the proto3 language has support for that directly via the optional keyword - including the programmer being able to detect whether the field is there or not. (As opposed to being "implicitly optional" in the usual proto3 way.)

This was added as a standard feature in protobuf v3.15.0, documented on this page.

Solution

Support optional in PBJ, hopefully identically to protoc from Google, but in any event meeting whatever (backward) compatibility we need w.r.t. our permanent protobuf structures.

Alternatives

Continue using wrappers such as google.protobuf.Int32Value. People who see that in our schemas will just understand it means optional int32.

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

No branches or pull requests

1 participant