github.com/googleapis/api-linter@v1.65.2/docs/rules/0162/delete-revision-request-name-behavior.md (about) 1 --- 2 rule: 3 aip: 162 4 name: [core, '0162', delete-revision-request-name-behavior] 5 summary: | 6 Delete Revision requests should annotate the `name` field with `google.api.field_behavior`. 7 permalink: /162/delete-revision-request-name-behavior 8 redirect_from: 9 - /0162/delete-revision-request-name-behavior 10 --- 11 12 # Delete Revision requests: Name field behavior 13 14 This rule enforces that all Delete Revision requests have 15 `google.api.field_behavior` set to `REQUIRED` on their `string name` field, as 16 mandated in [AIP-162][]. 17 18 ## Details 19 20 This rule looks at any message matching `Delete*RevisionRequest` and complains if the 21 `name` 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 DeleteBookRevisionRequest { 31 // The `google.api.field_behavior` annotation should also be included. 32 string name = 1 [ 33 (google.api.resource_reference).type = "library.googleapis.com/Book" 34 ]; 35 } 36 ``` 37 38 **Correct** code for this rule: 39 40 ```proto 41 // Correct. 42 message DeleteBookRevisionRequest { 43 string name = 1 [ 44 (google.api.field_behavior) = REQUIRED, 45 (google.api.resource_reference).type = "library.googleapis.com/Book" 46 ]; 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 DeleteBookRevisionRequest { 57 // (-- api-linter: core::0162::delete-revision-request-name-behavior=disabled 58 // aip.dev/not-precedent: We need to do this because reasons. --) 59 string name = 1 [ 60 (google.api.resource_reference).type = "library.googleapis.com/Book" 61 ]; 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-162]: https://aip.dev/162 69 [aip.dev/not-precedent]: https://aip.dev/not-precedent