github.com/googleapis/api-linter@v1.65.2/docs/rules/0165/request-message-name.md (about) 1 --- 2 rule: 3 aip: 165 4 name: [core, '0165', request-message-name] 5 summary: Purge methods must have standardized request message names. 6 permalink: /165/request-message-name 7 redirect_from: 8 - /0165/request-message-name 9 --- 10 11 # Purge methods: Request message 12 13 This rule enforces that all `Purge` RPCs have a request message name of 14 `Purge*Request`, as mandated in [AIP-165][]. 15 16 ## Details 17 18 This rule looks at any message beginning with `Purge`, 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 `PurgeBooksRequest`. 29 rpc PurgeBooks(DeleteBooksRequest) returns (google.longrunning.Operation) { 30 option (google.api.http) = { 31 post: "/v1/{parent=publishers/*}/books:purge" 32 body: "*" 33 }; 34 option (google.longrunning.operation_info) = { 35 response_type: "PurgeBooksResponse" 36 metadata_type: "PurgeBooksMetadata" 37 }; 38 } 39 ``` 40 41 **Correct** code for this rule: 42 43 ```proto 44 // Correct. 45 rpc PurgeBooks(PurgeBooksRequest) returns (google.longrunning.Operation) { 46 option (google.api.http) = { 47 post: "/v1/{parent=publishers/*}/books:purge" 48 body: "*" 49 }; 50 option (google.longrunning.operation_info) = { 51 response_type: "PurgeBooksResponse" 52 metadata_type: "PurgeBooksMetadata" 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::0165::request-message-name=disabled 64 // aip.dev/not-precedent: We need to do this because reasons. --) 65 rpc PurgeBooks(DeleteBooksRequest) returns (google.longrunning.Operation) { 66 option (google.api.http) = { 67 post: "/v1/{parent=publishers/*}/books:purge" 68 body: "*" 69 }; 70 option (google.longrunning.operation_info) = { 71 response_type: "PurgeBooksResponse" 72 metadata_type: "PurgeBooksMetadata" 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-165]: https://aip.dev/165 81 [aip.dev/not-precedent]: https://aip.dev/not-precedent