github.com/googleapis/api-linter@v1.65.2/docs/rules/0122/name-suffix.md (about) 1 --- 2 rule: 3 aip: 122 4 name: [core, '0122', name-suffix] 5 summary: Fields should not use the suffix `_name`. 6 permalink: /122/name-suffix 7 redirect_from: 8 - /0122/name-suffix 9 --- 10 11 # Name field suffix 12 13 This rule enforces that fields do not use the suffix `_name`, as mandated in 14 [AIP-122][]. 15 16 ## Details 17 18 This rule scans all fields complains if it sees the suffix `_name` on a field. 19 20 **Note:** The standard field `display_name` is exempt, as are `given_name` and 21 `family_name` (used to represent the human-readable name of a person), 22 `full_resource_name`, and `crypto_key_name`. 23 24 ## Examples 25 26 **Incorrect** code for this rule: 27 28 ```proto 29 // Incorrect. 30 message Book { 31 string name = 1; 32 string author_name = 2; // Should be `author`. 33 } 34 ``` 35 36 **Correct** code for this rule: 37 38 ```proto 39 // Correct. 40 message Book { 41 string name = 1; 42 string author = 2; 43 } 44 ``` 45 46 ## Disabling 47 48 If you need to violate this rule, use a leading comment above the method. 49 50 ```proto 51 // (-- api-linter: core::0122::name-suffix=disabled 52 // aip.dev/not-precedent: We need to do this because reasons. --) 53 message Book { 54 string name = 1; 55 string author_name = 2; // Should be `author`. 56 } 57 ``` 58 59 If you need to violate this rule for an entire file, place the comment at the 60 top of the file. 61 62 [aip-122]: http://aip.dev/122 63 [aip.dev/not-precedent]: https://aip.dev/not-precedent