Open globberwops opened 1 year ago
Hi Martin, at least for the pluralized repeated I think I can add to the discussion. We have talked about this several times in the past and one argument for not using a plural was that we had occasions in which we changed an optional message to a repeated message. The moment we then have to use a "s" at the end we would break compatibility which is why we thought it might be handy to just leave the singular. Best regards Carlo
zero values do not use the suffix
UNSPECIFIED
The enum structure of OSI has been adapted to the need of the application. The first value is UNKNOWN
and the second is OTHER
Those two are sematically somehow in combination UNCECIFIED
:
1) UKNOWN
means that it is unclear what the value means, it can be false, non existant in the interface and unsupported or anything else
2) OTHER
means on the other hand that the reading was correct and that there is a clear unterstanding of what the value is but it is just not one of the values described in the ENUM
. In this case e.g. an application could be missing a color and using other to represent the value and add the value for the next version of OSI.
Hi Martin, at least for the pluralized repeated I think I can add to the discussion. We have talked about this several times in the past and one argument for not using a plural was that we had occasions in which we changed an optional message to a repeated message. The moment we then have to use a "s" at the end we would break compatibility which is why we thought it might be handy to just leave the singular. Best regards Carlo
Hi Carlo, Thank you for the clarification. Just to be clear, I am not calling for blindly following every rule in the Style Guide. This specific exception is well documented, which is totally fine in my opinion.
zero values do not use the suffix
UNSPECIFIED
The enum structure of OSI has been adapted to the need of the application. The first value is
UNKNOWN
and the second isOTHER
Those two are sematically somehow in combination
UNCECIFIED
:
UKNOWN
means that it is unclear what the value means, it can be false, non existant in the interface and unsupported or anything elseOTHER
means on the other hand that the reading was correct and that there is a clear unterstanding of what the value is but it is just not one of the values described in theENUM
. In this case e.g. an application could be missing a color and using other to represent the value and add the value for the next version of OSI.
Again, thank you for the clarification.
The reason for the rule is stated as
The zero value enum should have the suffix UNSPECIFIED, because a server or application that gets an unexpected enum value will mark the field as unset in the proto instance. The field accessor will then return the default value, which for enum fields is the first enum value.
This is basically what UNKNOWN
is for in OSI, right?
I'll update the example .protolint.yml
above to reflect that exception.
Describe the bug
OSI violates several Protobuf Style Guide rules, see Style Guide
UNSPECIFIED
Expected
Follow the Style Guide and explicitly list exceptions as it is done here:
Provide a protolint config file, use protolint in CI.
Regards, Martin
Martin Stump martin.stump@mercedes-benz.com on behalf of MBition GmbH, Provider Information