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