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