github.com/googleapis/api-linter@v1.65.2/docs/rules/0131/response-message-name.md (about) 1 --- 2 rule: 3 aip: 131 4 name: [core, '0131', response-message-name] 5 summary: Get methods must return the resource. 6 permalink: /131/response-message-name 7 redirect_from: 8 - /0131/response-message-name 9 --- 10 11 # Get methods: Response message 12 13 This rule enforces that all `Get` RPCs have a response message of the resource, 14 as mandated in [AIP-131][]. 15 16 ## Details 17 18 This rule looks at any message matching beginning with `Get`, and complains if 19 the name of the corresponding output message does not match the name of the RPC 20 with the prefix `Get` removed. 21 22 ## Examples 23 24 **Incorrect** code for this rule: 25 26 ```proto 27 // Incorrect. 28 rpc GetBook(GetBookRequest) returns (GetBookResponse) { // Should be `Book`. 29 option (google.api.http) = { 30 get: "/v1/{name=publishers/*/books/*}" 31 }; 32 } 33 ``` 34 35 **Correct** code for this rule: 36 37 ```proto 38 // Correct. 39 rpc GetBook(GetBookRequest) returns (Book) { 40 option (google.api.http) = { 41 get: "/v1/{name=publishers/*/books/*}" 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::0131::response-message-name=disabled 53 // aip.dev/not-precedent: We need to do this because reasons. --) 54 rpc GetBook(GetBookRequest) returns (GetBookResponse) { 55 option (google.api.http) = { 56 get: "/v1/{name=publishers/*/books/*}" 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-131]: https://aip.dev/131 65 [aip.dev/not-precedent]: https://aip.dev/not-precedent