-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Description
Fields can be renamed, even when using JSON format, by setting json_name
and ensuring that it never changes. This allows the field's name to change without impacting how it is serialized to/de-serialized from JSON.
Since enum values are also identified by name in the JSON format, they should have an analogous feature: a json_name
pseudo-option, allowing the enum value's actual name to change while its JSON encoding remains the same.
I call the existing field json_name
a "pseudo-option" because, though it uses the option syntax in proto source, it does not end up in the google.descriptor.FieldOptions
message. Instead, it is promoted to a field of google.descriptor.FieldDescriptorProto
. For symmetry, I would expect the enum value option to behave similarly, resulting in a new json_name
field on google.descriptor.EnumValueDescriptorProto
.