github.com/googleapis/api-linter@v1.65.2/docs/rules/0162/delete-revision-request-name-field.md (about) 1 --- 2 rule: 3 aip: 162 4 name: [core, '0162', delete-revision-request-name-field] 5 summary: Delete Revision RPCs must have a `name` field in the request. 6 permalink: /162/delete-revision-request-name-field 7 redirect_from: 8 - /0162/delete-revision-request-name-field 9 --- 10 11 # Delete Revision requests: Name field 12 13 This rule enforces that all Delete Revision methods have a `string name` 14 field in the request message, as mandated in [AIP-162][]. 15 16 ## Details 17 18 This rule looks at any message matching `Delete*RevisionRequest` and complains if 19 either the `name` field is missing or it has any type other than `string`. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 // Should include a `string name` field. 28 message DeleteBookRevisionRequest {} 29 ``` 30 31 ```proto 32 // Incorrect. 33 message DeleteBookRevisionRequest { 34 // Field type should be `string`. 35 bytes name = 1 [ 36 (google.api.field_behavior) = REQUIRED, 37 (google.api.resource_reference).type = "library.googleapis.com/Book" 38 ]; 39 } 40 ``` 41 42 **Correct** code for this rule: 43 44 ```proto 45 // Correct. 46 message DeleteBookRevisionRequest { 47 string name = 1 [ 48 (google.api.field_behavior) = REQUIRED, 49 (google.api.resource_reference).type = "library.googleapis.com/Book" 50 ]; 51 } 52 ``` 53 54 ## Disabling 55 56 If you need to violate this rule, use a leading comment above the message (if 57 the `name` field is missing) or above the field (if it is the wrong type). 58 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 59 60 ```proto 61 message DeleteBookRevisionRequest { 62 // (-- api-linter: core::0162::delete-revision-request-name-field=disabled 63 // aip.dev/not-precedent: We need to do this because reasons. --) 64 bytes name = 1 [ 65 (google.api.field_behavior) = REQUIRED, 66 (google.api.resource_reference).type = "library.googleapis.com/Book" 67 ]; 68 } 69 ``` 70 71 If you need to violate this rule for an entire file, place the comment at the 72 top of the file. 73 74 [aip-162]: https://aip.dev/162 75 [aip.dev/not-precedent]: https://aip.dev/not-precedent