-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistently declare Protobuf enums #115
Consistently declare Protobuf enums #115
Conversation
Codecov Report
@@ Coverage Diff @@
## main #115 +/- ##
==========================================
+ Coverage 74.61% 76.72% +2.11%
==========================================
Files 23 23
Lines 1765 1706 -59
==========================================
- Hits 1317 1309 -8
+ Misses 334 298 -36
+ Partials 114 99 -15
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
a06d155
to
57922c7
Compare
57922c7
to
3b3e9fc
Compare
Enums were not consistently declared. Some were at the global scope, some others wire nested in messages. This moves all enums to the global scope and uses most of the official style guide rules here: https://developers.google.com/protocol-buffers/docs/style#enums Unfortunately this results in long and stuttering names of enum values in the code but this change is necessary to future-proof the proto and ensure no enum names conflict when we add new enums and values (all enum value names are in one namespace). I don't like the end result but not doing it appears to be worse. We have seen this first-hand in OTLP proto where enum names are inconsistent and are now impossible to fix due to backward compatibility concerns. Note: I ignored the rule to CAPITALIZE names and use underscores because if I do that the names in the code become unreadable walls of text.
3b3e9fc
to
3e0ac5c
Compare
Rebased and fixed merge conflicts. @andykellr if you have time please take another look (just want to make sure I didn't miss anything), otherwise I will merge soon. |
Enums were not consistently declared. Some were at the global scope,
some others wire nested in messages. This moves all enums to the global
scope and uses most of the official style guide rules here:
https://developers.google.com/protocol-buffers/docs/style#enums
Unfortunately this results in long and stuttering names of enum values in
the code but this change is necessary to future-proof the proto and ensure
no enum names conflict when we add new enums and values (all enum value
names are in one namespace).
I don't like the end result but not doing it appears to be worse.
We have seen this first-hand in OTLP proto where enum names are
inconsistent and are now impossible to fix due to backward compatibility
concerns.
Note: I ignored the rule to CAPITALIZE names and use underscores
because if I do that the names in the code become unreadable walls
of text.
If anyone has any ideas how to fix the enum names issue in a nicer
way I am happy to discard this PR.
One alternate is to remove the prefixes from enum value names and
just require that all enum value names introduced in the future are
also unique, but I think it can result in weird names in the future.