github.com/googleapis/api-linter@v1.65.2/docs/rules/0233/response-message-name.md (about) 1 --- 2 rule: 3 aip: 233 4 name: [core, '0233', response-message-name] 5 summary: Batch Create methods must have standardized response message names. 6 permalink: /233/response-message-name 7 redirect_from: 8 - /0233/response-message-name 9 --- 10 11 # Batch Create methods: Response message 12 13 This rule enforces that all `BatchCreate` RPCs have a response message name of 14 `BatchCreate*Response`, as mandated in [AIP-233][]. 15 16 ## Details 17 18 This rule looks at any RPCs whose name starts with `BatchCreate`, and 19 complains if the name of the corresponding returned message does not match the 20 name of the RPC with the suffix `Response` appended. 21 22 It also permits a response of `google.longrunning.Operation`; in this case, it 23 checks the `response_type` in the `google.longrunning.operation_info` 24 annotation and ensures that _it_ corresponds to the name of the RPC with the 25 suffix `Response` appended, as mandated in [AIP-151][]. 26 27 ## Examples 28 29 **Incorrect** code for this rule: 30 31 ```proto 32 // Incorrect. 33 // Should be `BatchCreateBooksResponse`. 34 rpc BatchCreateBooks(BatchCreateBooksRequest) returns (BooksResponse) { 35 option (google.api.http) = { 36 post: "/v1/{parent=publishers/*}/books:batchCreate" 37 body: "*" 38 }; 39 } 40 ``` 41 42 **Correct** code for this rule: 43 44 ```proto 45 // Correct. 46 rpc BatchCreateBooks(BatchCreateBooksRequest) returns (BatchCreateBooksResponse) { 47 option (google.api.http) = { 48 post: "/v1/{parent=publishers/*}/books:batchCreate" 49 body: "*" 50 }; 51 } 52 ``` 53 54 ## Disabling 55 56 If you need to violate this rule, use a leading comment above the method. 57 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 58 59 ```proto 60 // (-- api-linter: core::0233::response-message-name=disabled 61 // aip.dev/not-precedent: We need to do this because reasons. --) 62 rpc BatchCreateBooks(BatchCreateBooksRequest) returns (BooksResponse) { 63 option (google.api.http) = { 64 post: "/v1/{parent=publishers/*}/books:batchCreate" 65 body: "*" 66 }; 67 } 68 ``` 69 70 If you need to violate this rule for an entire file, place the comment at the 71 top of the file. 72 73 [aip-233]: https://aip.dev/233 74 [aip-151]: https://aip.dev/151 75 [aip.dev/not-precedent]: https://aip.dev/not-precedent