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