I'm unable to find specific guidance on naming conventions for Google protobuff enum values to avoid naming collisions.
since protobuff enums are global, the following would cause a naming collision :
enum CommissionType {
UNKNOWN = 0;
AMOUNT = 1;
PERCENTAGE = 2;
}
enum ChargeType {
UNKNOWN = 0;
AMOUNT = 1;
PERCENTAGE = 2;
}
Therefore, the advice I have received is to include the TypeName, but its unclear whether the convention is to prepend or append that typename (as below). I'm personally of the opinion that its more readable to append it and get the benefit of intellisense, but I'm unable to find any evidence for or against. I would be grateful if you could link to any examples or discussions. Thanks.
enum CommissionType {
COMMISSION_TYPE_UNKNOWN = 0;
COMMISSION_TYPE_AMOUNT = 1;
COMMISSION_TYPE_PERCENTAGE = 2;
}
enum CommissionType {
UNKNOWN_COMMISSION_TYPE = 0;
AMOUNT_COMMISSION_TYPE = 1;
PERCENTAGE_COMMISSION_TYPE = 2;
}