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