github.com/googleapis/api-linter@v1.65.2/docs/rules/0165/response-purge-sample-reference.md (about) 1 --- 2 rule: 3 aip: 165 4 name: [core, '0165', response-purge-sample-reference] 5 summary: | 6 Purge responses should annotate the `purge_sample` field with `google.api.resource_reference`. 7 permalink: /165/response-purge-sample-reference 8 redirect_from: 9 - /0165/response-purge-sample-reference 10 --- 11 12 # Purge responses: Purge sample resource reference 13 14 This rule enforces that all `Purge` responses have 15 `google.api.resource_reference` on their `repeated string purge_sample` field, 16 as mandated in [AIP-165][]. 17 18 ## Details 19 20 This rule looks at the `purge_sample` field of any message matching 21 `Purge*Response` and complains if it does not have a 22 `google.api.resource_reference` annotation. 23 24 ## Examples 25 26 **Incorrect** code for this rule: 27 28 ```proto 29 // Incorrect. 30 message PurgeBooksResponse { 31 int32 purge_count = 1; 32 33 // The `google.api.resource_reference` annotation should be included. 34 repeated string purge_sample = 2; 35 } 36 ``` 37 38 **Correct** code for this rule: 39 40 ```proto 41 // Correct. 42 message PurgeBooksResponse { 43 int32 purge_count = 1; 44 45 repeated string purge_sample = 2 [ 46 (google.api.resource_reference).type = "library.googleapis.com/Book" 47 ]; 48 } 49 ``` 50 51 ## Disabling 52 53 If you need to violate this rule, use a leading comment above the field. 54 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 55 56 ```proto 57 message PurgeBooksResponse { 58 int32 purge_count = 1; 59 60 // (-- api-linter: core::0165::response-purge-sample-reference=disabled 61 // aip.dev/not-precedent: We need to do this because reasons. --) 62 repeated string purge_sample = 2; 63 } 64 ``` 65 66 If you need to violate this rule for an entire file, place the comment at the 67 top of the file. 68 69 [aip-165]: https://aip.dev/165 70 [aip.dev/not-precedent]: https://aip.dev/not-precedent