github.com/googleapis/api-linter@v1.65.2/docs/rules/0134/request-resource-required.md (about) 1 --- 2 rule: 3 aip: 134 4 name: [core, '0134', request-resource-required] 5 summary: Update RPCs must have a field for the resource in the request. 6 permalink: /134/request-resource-required 7 redirect_from: 8 - /0134/request-resource-required 9 --- 10 11 # Update methods: Resource field 12 13 This rule enforces that all `Update` standard methods have a field in the 14 request message for the resource itself, as mandated in [AIP-134][]. 15 16 ## Details 17 18 This rule looks at any message matching `Update*Request` and complains if there 19 is no field of the resource's type with the expected field name. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 // `Book book` is missing. 28 message UpdateBookRequest { 29 google.protobuf.FieldMask update_mask = 2; 30 } 31 ``` 32 33 **Correct** code for this rule: 34 35 ```proto 36 // Correct. 37 message UpdateBookRequest { 38 Book book = 1; 39 google.protobuf.FieldMask update_mask = 2; 40 } 41 ``` 42 43 ## Disabling 44 45 If you need to violate this rule, use a leading comment above the message. 46 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 47 48 ```proto 49 // (-- api-linter: core::0134::request-resource-required=disabled 50 // aip.dev/not-precedent: We need to do this because reasons. --) 51 message UpdateBookRequest { 52 google.protobuf.FieldMask update_mask = 2; 53 } 54 ``` 55 56 If you need to violate this rule for an entire file, place the comment at the 57 top of the file. 58 59 [aip-134]: https://aip.dev/134 60 [aip.dev/not-precedent]: https://aip.dev/not-precedent