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