hashgraph / hashgraph/pbj

Add support for proto3 `optional` keyword

Open
#225 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
44
Forks
15
Avg merge
1d 15h
Merged PRs (30d)
12

Description

### 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](https://github.com/protocolbuffers/protobuf/releases/tag/v3.15.0), documented [on this page](https://protobuf.dev/programming-guides/proto3/#field-labels).

### 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`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.