github.com/googleapis/api-linter@v1.65.2/docs/rules/0235/response-message-name.md (about) 1 --- 2 rule: 3 aip: 235 4 name: [core, '0235', response-message-name] 5 summary: Batch Delete methods must have standardized response message names. 6 permalink: /235/response-message-name 7 redirect_from: 8 - /0235/response-message-name 9 --- 10 11 # Batch Delete methods: Response message 12 13 This rule enforces that all `BatchDelete` RPCs have a response message name of 14 `google.protobuf.Empty` or `BatchDelete*Response`, as mandated in [AIP-235][]. 15 16 ## Details 17 18 This rule looks at any RPCs whose name starts with `BatchDelete`, and 19 complains if the name of the corresponding returned message does not match 20 `google.protobuf.Empty` or the name of the RPC with the suffix `Response` 21 appended, the latter of which is mandated in [AIP-235][] for soft-delete 22 operations. 23 24 It also permits a response of `google.longrunning.Operation`; in this case, it 25 checks the `response_type` in the `google.longrunning.operation_info` 26 annotation and ensures that _it_ is `google.protobuf.Empty` or corresponds to 27 the name of the RPC with the suffix `Response` appended, as mandated in 28 [AIP-151][]. 29 30 ## Examples 31 32 **Incorrect** code for this rule: 33 34 ```proto 35 // Incorrect. 36 // Should be `google.protobuf.Empty` or `BatchDeleteBooksResponse`. 37 rpc BatchDeleteBooks(BatchDeleteBooksRequest) returns (BooksResponse) { 38 option (google.api.http) = { 39 post: "/v1/{parent=publishers/*}/books:batchDelete" 40 body: "*" 41 }; 42 } 43 ``` 44 45 **Correct** code for this rule: 46 47 ```proto 48 // Correct. 49 rpc BatchDeleteBooks(BatchDeleteBooksRequest) returns (google.protobuf.Empty) { 50 option (google.api.http) = { 51 post: "/v1/{parent=publishers/*}/books:batchDelete" 52 body: "*" 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::0235::response-message-name=disabled 64 // aip.dev/not-precedent: We need to do this because reasons. --) 65 rpc BatchDeleteBooks(BatchDeleteBooksRequest) returns (BooksResponse) { 66 option (google.api.http) = { 67 post: "/v1/{parent=publishers/*}/books:batchDelete" 68 body: "*" 69 }; 70 } 71 ``` 72 73 If you need to violate this rule for an entire file, place the comment at the 74 top of the file. 75 76 [aip-151]: https://aip.dev/151 77 [aip-235]: https://aip.dev/235 78 [aip.dev/not-precedent]: https://aip.dev/not-precedent