github.com/googleapis/api-linter@v1.65.2/docs/rules/0217/unreachable-field-type.md (about) 1 --- 2 rule: 3 aip: 217 4 name: [core, '0217', unreachable-field-type] 5 summary: The unreachable field should be a repeated string. 6 permalink: /217/unreachable-field-type 7 redirect_from: 8 - /0217/unreachable-field-type 9 --- 10 11 # States 12 13 This rule enforces that the `unreachable` field is a `repeated string`, as 14 mandated in [AIP-217][]. 15 16 ## Details 17 18 This rule looks at fields named `unreachable`, and complains if they are 19 anything other than a `repeated string`. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 message ListBooksResponse { 28 repeated Book books = 1; 29 string next_page_token = 2; 30 string unreachable = 3; // Should be repeated. 31 } 32 ``` 33 34 ```proto 35 // Incorrect. 36 message ListBooksResponse { 37 repeated Book books = 1; 38 string next_page_token = 2; 39 repeated ErrorInfo unreachable = 3; // Should be a string. 40 } 41 ``` 42 43 **Correct** code for this rule: 44 45 ```proto 46 // Correct. 47 message ListBooksResponse { 48 repeated Book books = 1; 49 string next_page_token = 2; 50 repeated string unreachable = 3; 51 } 52 ``` 53 54 ## Disabling 55 56 If you need to violate this rule, use a leading comment above the field. 57 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 58 59 ```proto 60 message ListBooksResponse { 61 repeated Book books = 1; 62 string next_page_token = 2; 63 // (-- api-linter: core::0217::unreachable-field-type=disabled 64 // aip.dev/not-precedent: We need to do this because reasons. --) 65 repeated string unreachable_locations = 3; 66 } 67 ``` 68 69 If you need to violate this rule for an entire file, place the comment at the 70 top of the file. 71 72 [aip-217]: https://aip.dev/217 73 [aip.dev/not-precedent]: https://aip.dev/not-precedent