github.com/googleapis/api-linter@v1.65.2/docs/rules/0231/plural-method-name.md (about) 1 --- 2 rule: 3 aip: 231 4 name: [core, '0231', plural-method-name] 5 summary: Batch Get methods must have plural names. 6 permalink: /231/plural-method-name 7 redirect_from: 8 - /0231/plural-method-name 9 --- 10 11 # Batch Get methods: Plural method name 12 13 This rule enforces that all `BatchGet` RPCs have a plural resource in the 14 method name, as mandated in [AIP-231][]. 15 16 ## Details 17 18 This rule looks at any method whose name begins with `BatchGet`, and complains 19 if the name of the resource in the method name is singular. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 // Method name should be `BatchGetBooks` 28 rpc BatchGetBook(BatchGetBookRequest) returns (BatchGetBookResponse) { 29 option (google.api.http) = { 30 get: "/v1/{parent=publishers/*}/books:batchGet" 31 }; 32 } 33 ``` 34 35 **Correct** code for this rule: 36 37 ```proto 38 // Correct. 39 rpc BatchGetBooks(BatchGetBooksRequest) returns (BatchGetBooksResponse) { 40 option (google.api.http) = { 41 get: "/v1/{parent=publishers/*}/books:batchGet" 42 }; 43 } 44 ``` 45 46 ## Disabling 47 48 If you need to violate this rule, use a leading comment above the method. 49 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 50 51 ```proto 52 // (-- api-linter: core::0231::plural-method-name=disabled 53 // aip.dev/not-precedent: We need to do this because reasons. --) 54 rpc BatchGetBook(BatchGetBookRequest) returns (BatchGetBookResponse) { 55 option (google.api.http) = { 56 get: "/v1/{parent=publishers/*}/books:batchGet" 57 }; 58 } 59 ``` 60 61 If you need to violate this rule for an entire file, place the comment at the 62 top of the file. 63 64 [aip-231]: https://aip.dev/231 65 [aip.dev/not-precedent]: https://aip.dev/not-precedent