github.com/googleapis/api-linter@v1.65.2/docs/rules/0134/request-resource-field.md (about) 1 --- 2 rule: 3 aip: 134 4 name: [core, '0134', request-resource-field] 5 summary: Update RPCs must have a field for the resource in the request. 6 permalink: /134/request-resource-field 7 redirect_from: 8 - /0134/request-resource-field 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 19 the field of the resource's type is not named properly. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 message UpdateBookRequest { 28 // Field name should be `book`. 29 Book payload = 1; 30 google.protobuf.FieldMask update_mask = 2; 31 } 32 ``` 33 34 **Correct** code for this rule: 35 36 ```proto 37 // Correct. 38 message UpdateBookRequest { 39 Book book = 1; 40 google.protobuf.FieldMask update_mask = 2; 41 } 42 ``` 43 44 ## Disabling 45 46 If you need to violate this rule, use a leading comment above the field. 47 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 48 49 ```proto 50 message UpdateBookRequest { 51 // (-- api-linter: core::0134::request-resource-field=disabled 52 // aip.dev/not-precedent: We need to do this because reasons. --) 53 Book payload = 1; 54 google.protobuf.FieldMask update_mask = 2; 55 } 56 ``` 57 58 If you need to violate this rule for an entire file, place the comment at the 59 top of the file. 60 61 [aip-134]: https://aip.dev/134 62 [aip.dev/not-precedent]: https://aip.dev/not-precedent