github.com/googleapis/api-linter@v1.65.2/docs/rules/0140/numbers.md (about) 1 --- 2 rule: 3 aip: 140 4 name: [core, '0140', numbers] 5 summary: Field names should not have words beginning with numbers. 6 permalink: /140/numbers 7 redirect_from: 8 - /0140/numbers 9 --- 10 11 # Field names: Numbers 12 13 This rule enforces that field names do not begin any word in the field with a 14 number, as mandated in [AIP-140][]. 15 16 ## Details 17 18 This rule checks every field in the proto and complains if any individual word 19 begins with a number. It treats the underscore (`_`) character as the only word 20 separator for this purpose. 21 22 ## Examples 23 24 **Incorrect** code for this rule: 25 26 ```proto 27 // Incorrect. 28 message Book { 29 string name = 1; 30 int32 review_90th_percentile_stars = 2; 31 } 32 ``` 33 34 **Correct** code for this rule: 35 36 The correct code here is likely to vary based on the situation. This may be 37 fixed by spelling out the number: 38 39 ```proto 40 // Correct. 41 message Book { 42 string name = 1; 43 int32 review_ninetieth_percentile_stars = 2; 44 } 45 ``` 46 47 Many cases we see involving numbers like this may be better designed with a 48 map: 49 50 ```proto 51 // Correct. 52 message Book { 53 string name = 1; 54 map<int32, int32> review_stars_per_percentile = 2; 55 } 56 ``` 57 58 ## Disabling 59 60 If you need to violate this rule, use a leading comment above the method. 61 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 62 63 ```proto 64 // (-- api-linter: core::0140::numbers=disabled 65 // aip.dev/not-precedent: We need to do this because reasons. --) 66 message Book { 67 string name = 1; 68 int32 review_90th_percentile_stars = 2; 69 } 70 ``` 71 72 If you need to violate this rule for an entire file, place the comment at the 73 top of the file. 74 75 [aip-140]: https://aip.dev/140 76 [aip.dev/not-precedent]: https://aip.dev/not-precedent