github.com/googleapis/api-linter@v1.65.2/docs/rules/0123/resource-plural.md (about) 1 --- 2 rule: 3 aip: 123 4 name: [core, '0123', resource-plural] 5 summary: Resource plural is required 6 permalink: /123/resource-plural 7 redirect_from: 8 - /0123/resource-plural 9 --- 10 11 # Resource type name 12 13 This rule enforces that messages that have a `google.api.resource` annotation, 14 have a properly formatted `plural`, as described in [AIP-123][]. 15 16 ## Details 17 18 This rule scans messages with a `google.api.resource` annotation, and 19 verifies the `plural` field exists. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 message Book { 28 // no plural annotation 29 option (google.api.resource) = { 30 type: "library.googleapis.com/BookShelf" 31 pattern: "publishers/{publisher}/bookShelves/{book_shelf}" 32 }; 33 34 string name = 1; 35 } 36 ``` 37 38 **Correct** code for this rule: 39 40 ```proto 41 // Correct. 42 message Book { 43 option (google.api.resource) = { 44 type: "library.googleapis.com/BookShelf" 45 pattern: "publishers/{publisher}/bookShelves/{book_shelf}" 46 plural: "bookShelves", 47 }; 48 49 string name = 1; 50 } 51 ``` 52 53 ## Disabling 54 55 If you need to violate this rule, use a leading comment above the message. 56 57 ```proto 58 // (-- api-linter: core::0123::resource-plural=disabled 59 // aip.dev/not-precedent: We need to do this because reasons. --) 60 message Book { 61 option (google.api.resource) = { 62 type: "library.googleapis.com/Genre/Mystery/Book" 63 pattern: "publishers/{publisher}/books/{book}" 64 }; 65 66 string name = 1; 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-123]: http://aip.dev/123 74 [aip.dev/not-precedent]: https://aip.dev/not-precedent