github.com/googleapis/api-linter@v1.65.2/docs/rules/0121/resource-must-support-get.md (about) 1 --- 2 rule: 3 aip: 121 4 name: [core, '0121', resource-must-support-get] 5 summary: All resources must have a Standard Get method. 6 permalink: /121/resource-must-support-get 7 redirect_from: 8 - /0121/resource-must-support-get 9 --- 10 11 # Resource must support get 12 13 This rule enforces that all resources support the Get operation as mandated in 14 [AIP-121][]. 15 16 ## Details 17 18 This rule scans a service for Create, Update, and List methods for resources, 19 and ensures each one has a Get method. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 service Foo { 28 // Book has a create, but no Get method. 29 rpc CreateBook(CreateBookRequest) returns (Book) {}; 30 } 31 32 message Book { 33 option (google.api.resource) = { 34 type: "library.googleapis.com/Book" 35 pattern: "books/{book}" 36 }; 37 } 38 ``` 39 40 **Correct** code for this rule: 41 42 ```proto 43 // Correct. 44 service Foo { 45 rpc CreateBook(CreateBookRequest) returns (Book) {}; 46 rpc GetBook(GetBookRequest) returns (Book) {}; 47 } 48 49 message Book { 50 option (google.api.resource) = { 51 type: "library.googleapis.com/Book" 52 pattern: "books/{book}" 53 }; 54 } 55 ``` 56 57 ## Disabling 58 59 If you need to violate this rule, use a leading comment above the service. 60 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 61 62 ```proto 63 // (-- api-linter: core::0121::resource-must-support-get=disabled 64 // aip.dev/not-precedent: We need to do this because reasons. --) 65 service Foo { 66 // Book has a create, but no Get method. 67 rpc CreateBook(CreateBookRequest) returns (Book) {}; 68 } 69 70 message Book { 71 option (google.api.resource) = { 72 type: "library.googleapis.com/Book" 73 pattern: "books/{book}" 74 }; 75 } 76 ``` 77 78 If you need to violate this rule for an entire file, place the comment at the 79 top of the file. 80 81 [aip-121]: https://aip.dev/121 82 [aip.dev/not-precedent]: https://aip.dev/not-precedent