Dont set group for optional fields (#528)

Fixes #523
This commit is contained in:
Erik Friese
2023-10-16 04:43:42 +02:00
committed by GitHub
parent 3514991133
commit 8b5dd6c1f8
2 changed files with 5 additions and 2 deletions

View File

@@ -909,7 +909,7 @@ class Message(ABC):
# Note that proto3 field presence/optional fields are put in a
# synthetic single-item oneof by protoc, which helps us ensure we
# send the value even if the value is the default zero value.
selected_in_group = bool(meta.group)
selected_in_group = bool(meta.group) or meta.optional
# Empty messages can still be sent on the wire if they were
# set (or received empty).