Add a section to explain recommended default enum value. (#422)

Signed-off-by: Hong Zhang <wora2000@gmail.com>
pull/345/head
Hong Zhang 7 years ago committed by Matt Klein
parent 6986001789
commit 204032707e
  1. 6
      STYLE.md

@ -69,3 +69,9 @@ In addition, the following conventions should be followed:
This is more efficient, extendable and self-describing. This is more efficient, extendable and self-describing.
* To represent percentage values, use the Percent message type defined in [api/base.proto](api/base.proto). * To represent percentage values, use the Percent message type defined in [api/base.proto](api/base.proto).
* For enum types, if one of the enum values is used for most cases, make it the
first enum value with `0` numeric value. Otherwise, define the first enum
value like `TYPE_NAME_UNSPECIFIED = 0`, and treat it as an error. This design
pattern forces developers to explicitly choose the correct enum value for
their use case, and avoid misunderstanding of the default behavior.

Loading…
Cancel
Save