protocolbuffers / protocolbuffers/protobuf
enum values should have `json_name` pseudo-option just like fields
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 72k
- Forks
- 16.3k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 140
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.