You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know @EvanHahn you brought this up. Our use of ts-proto kind of hides that this is needed, but the protobuf docs recommend it. It seems it is only really an issue for enums added after initial release (because decoding when the enum is missing will decode the default enum), but maybe it's best for us to start with this? We could hide it in our encode/decode functions by setting a default enum value when it is unspecified.
The text was updated successfully, but these errors were encountered:
I think it depends on the use case, but I generally feel we should have some "unknown" default value for enums.
I agree that our decoder code can treat unknown as some other default. For example, we might decide that unrecognized invite decisions are equivalent to "REJECT".
Just to be clear, because "unknown" is possibly unspecific, there are two different cases:
"unrecognized" - this is an enum value that is not recognized, e.g. a newer version of a proto def adds a new enum value, and an older client would not recognize this value. We already handle this (and decode to UNRECOGNIZED)
"unspecified" - this is when a newer proto def adds a new enum field, and decodes protobufs from the older def. These enum values would be missing, and protobuf defaults to decode the enum value to the first enum defined (=0).
I know @EvanHahn you brought this up. Our use of ts-proto kind of hides that this is needed, but the protobuf docs recommend it. It seems it is only really an issue for enums added after initial release (because decoding when the enum is missing will decode the default enum), but maybe it's best for us to start with this? We could hide it in our encode/decode functions by setting a default enum value when it is unspecified.
The text was updated successfully, but these errors were encountered: