github.com/googleapis/api-linter@v1.65.2/docs/rules/0152/request-message-name.md (about) 1 --- 2 rule: 3 aip: 152 4 name: [core, '0152', request-message-name] 5 summary: Run methods must have standardized request message names. 6 permalink: /152/request-message-name 7 redirect_from: 8 - /0152/request-message-name 9 --- 10 11 # Run methods: Request message 12 13 This rule enforces that all `Run` RPCs have a request message name 14 of `Run*JobRequest`, as mandated in [AIP-152][]. 15 16 ## Details 17 18 This rule looks at any message beginning with `Run`, and complains 19 if the name of the corresponding input message does not match the name of the 20 RPC with the suffix `Request` appended. 21 22 ## Examples 23 24 **Incorrect** code for this rule: 25 26 ```proto 27 // Incorrect. 28 // Should be `RunWriteBookJobRequest`. 29 rpc RunWriteBookJob(WriteBookJob) returns (google.longrunning.Operation) { 30 option (google.api.http) = { 31 post: "/v1/{name=publishers/*/writeBookJobs/*}:run" 32 body: "*" 33 }; 34 option (google.longrunning.operation_info) = { 35 response_type: "RunWriteBookJobResponse" 36 metadata_type: "RunWriteBookJobMetadata" 37 }; 38 } 39 ``` 40 41 **Correct** code for this rule: 42 43 ```proto 44 // Correct. 45 rpc RunWriteBookJob(RunWriteBookJobRequest) returns (google.longrunning.Operation) { 46 option (google.api.http) = { 47 post: "/v1/{name=publishers/*/writeBookJobs/*}:run" 48 body: "*" 49 }; 50 option (google.longrunning.operation_info) = { 51 response_type: "RunWriteBookJobResponse" 52 metadata_type: "RunWriteBookJobMetadata" 53 }; 54 } 55 ``` 56 57 ## Disabling 58 59 If you need to violate this rule, use a leading comment above the method. 60 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 61 62 ```proto 63 // (-- api-linter: core::0152::request-message-name=disabled 64 // aip.dev/not-precedent: We need to do this because reasons. --) 65 rpc RunWriteBookJob(WriteBookJob) returns (google.longrunning.Operation) { 66 option (google.api.http) = { 67 post: "/v1/{name=publishers/*/writeBookJobs/*}:run" 68 body: "*" 69 }; 70 option (google.longrunning.operation_info) = { 71 response_type: "RunWriteBookJobResponse" 72 metadata_type: "RunWriteBookJobMetadata" 73 }; 74 } 75 ``` 76 77 If you need to violate this rule for an entire file, place the comment at the 78 top of the file. 79 80 [aip-152]: https://aip.dev/152 81 [aip.dev/not-precedent]: https://aip.dev/not-precedent