api style: repeated field guidance (#5589)

Signed-off-by: Matt Klein <mklein@lyft.com>

Mirrored from https://github.com/envoyproxy/envoy @ 74ef1a9030c0179412a6938439896a18cc81bf74
pull/620/head
data-plane-api(CircleCI) 6 years ago
parent 07644456ee
commit 48a9b510b1
  1. 10
      STYLE.md

@ -71,6 +71,16 @@ In addition, the following conventions should be followed:
* Always use plural field names for `repeated` fields, such as `filters`.
* Due to the fact that we consider JSON/YAML to be first class inputs, we cannot easily change a
a singular field to a repeated field (both due to JSON/YAML array structural differences as well
as singular vs. plural field naming). If there is a reasonable expectation that a field may need
to be repeated in the future, but we don't need it to be repeated right away, consider making it
repeated now but using constraints to enforce a maximum repeated size of 1. E.g.:
```proto
repeated OutputSink sinks = 1 [(validate.rules).repeated = {min_items: 1, max_items: 1}];
```
* Always use upper camel case names for message types and enum types without embedded
acronyms, such as `HttpRequest`.

Loading…
Cancel
Save