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