github.com/googleapis/api-linter@v1.65.2/docs/rules/0152/request-name-behavior.md (about) 1 --- 2 rule: 3 aip: 152 4 name: [core, '0152', request-name-behavior] 5 summary: | 6 Run requests should annotate the `name` field with `google.api.field_behavior`. 7 permalink: /152/request-name-behavior 8 redirect_from: 9 - /0152/request-name-behavior 10 --- 11 12 # Run requests: Field behavior 13 14 This rule enforces that all `Run` requests have 15 `google.api.field_behavior` set to `REQUIRED` on their `string name` field, as 16 mandated in [AIP-152][]. 17 18 ## Details 19 20 This rule looks at any message matching `Run*JobRequest` 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 RunWriteBookJobRequest { 31 // The `google.api.field_behavior` annotation should also be included. 32 string name = 1 [(google.api.resource_reference) = { 33 type: "library.googleapis.com/WriteBookJob" 34 }]; 35 } 36 ``` 37 38 **Correct** code for this rule: 39 40 ```proto 41 // Correct. 42 message RunWriteBookJobRequest { 43 // The `google.api.field_behavior` annotation should also be included. 44 string name = 1 [ 45 (google.api.field_behavior) = REQUIRED, 46 (google.api.resource_reference) = { 47 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-name-behavior=disabled 60 // aip.dev/not-precedent: We need to do this because reasons. --) 61 string name = 1 [(google.api.resource_reference) = { 62 type: "library.googleapis.com/WriteBookJob" 63 }]; 64 } 65 ``` 66 67 If you need to violate this rule for an entire file, place the comment at the 68 top of the file. 69 70 [aip-152]: https://aip.dev/152 71 [aip.dev/not-precedent]: https://aip.dev/not-precedent