Closed zchenyu closed 1 month ago
I found this: https://github.com/protocolbuffers/protobuf/blob/main/docs/implementing_proto3_presence.md
To minimize this risk we chose a descriptor representation that is semantically compatible with existing proto3 reflection. Every proto3 optional field is placed into a one-field oneof. We call this a "synthetic" oneof, as it was not present in the source .proto file.
Is there some way to distinguish between these synthetic oneofs vs real ones? Basically I'm trying to loop over all FieldDescriptor
s in a MessageDescriptor
, ignoring ones that are part of a oneof.
If I have an optional field, the
fieldDescriptor.GetOneOf()
seems to be non-nil with namename:"_my_field"
. Is this expected?