Skip to content

grpc-common: Add field presence tracking, required field enforcing and generation of the MessageCodec implementation #421

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

Open
wants to merge 8 commits into
base: grpc-common
Choose a base branch
from

Conversation

Jozott00
Copy link
Collaborator

@Jozott00 Jozott00 commented Aug 1, 2025

Subsystem
gRPC/Common - Protobuf

Description
This PR adds presence tracking for fields with explicit presence on the wire.
It does this by adding a presenceMask to each message, implemented as BitSet. The presence of each field that has explicit presence is represented by a bit in the mask.

If a required field (required field in proto2 or a field annotated with [ LEGACY_REQUIRED ] in editions) is not present after construction, an error is thrown.
This is done for both, user constructed messages (e.i. by the generated invoke function) and messages that were decoded from the wire using the message's decode function.

Additionally, the PR adds generation of an implementation of the MessageCodec interface, used by the gRPC implementation to encode and decode messages. It is made available as object in the companion object of the generated internal message. E.g. MyMessageInternal.CODEC

@Jozott00 Jozott00 self-assigned this Aug 1, 2025
@Jozott00 Jozott00 added the feature New feature or request label Aug 1, 2025
@Jozott00 Jozott00 requested a review from Mr3zee August 1, 2025 17:46
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant