Skip to content

enum values should have json_name pseudo-option just like fields #4328

@jhump

Description

@jhump

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.

Metadata

Metadata

Labels

enhancementjsonuntriagedauto added to all issues by default when created.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions