SIGN IN SIGN UP

Protocol Buffers - Google's data interchange format

0 0 1 C++

Nextgen Proto Pythonic API: Add 'in' operator

The “in” operator will be consistent with HasField but a little different with Proto Plus.

The detail behavior of “in” operator in Nextgen for Struct (to be consist with old Struct behavior):
-Raise TypeError if not pass a string
-Check if the key is in the struct.fields

The detail behavior of “in” operator in Nextgen(for other message):
-Raise ValueError if not pass a string
-Raise ValueError if the string is not a field
-For Oneof: Check any field under the oneof is set
-For has-presence field: check if set
-For non-has-presence field (include repeated fields): raise ValueError

PiperOrigin-RevId: 621240977
J
Jie Luo committed
de8e550e90cf2542310085b74f71e036a4159341
Parent: 3a2cd26
Committed by Copybara-Service <copybara-worker@google.com> on 4/2/2024, 6:32:18 PM