github.com/googleapis/api-linter@v1.65.2/docs/rules/0131/synonyms.md (about) 1 --- 2 rule: 3 aip: 131 4 name: [core, '0131', synonyms] 5 summary: Get methods must be named starting with "Get". 6 permalink: /131/synonyms 7 redirect_from: 8 - /0131/synonyms 9 --- 10 11 # Get methods: Synonym check 12 13 This rule enforces that single-resource lookup methods have names starting with 14 `Get`, as mandated in [AIP-131][]. 15 16 ## Details 17 18 This rule looks at any message with names similar to `Get`, and suggests using 19 `Get` instead. It complains if it sees the following synonyms: 20 21 - Acquire 22 - Fetch 23 - Lookup 24 - Read 25 - Retrieve 26 27 ## Examples 28 29 **Incorrect** code for this rule: 30 31 ```proto 32 // Incorrect. 33 rpc FetchBook(FetchBookRequest) returns (Book) { // Should be `GetBook`. 34 option (google.api.http) = { 35 get: "/v1/{name=publishers/*/books/*}" 36 }; 37 } 38 ``` 39 40 **Correct** code for this rule: 41 42 ```proto 43 // Correct. 44 rpc GetBook(GetBookRequest) returns (Book) { 45 option (google.api.http) = { 46 get: "/v1/{name=publishers/*/books/*}" 47 }; 48 } 49 ``` 50 51 ## Disabling 52 53 If you need to violate this rule, use a leading comment above the method. 54 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 55 56 ```proto 57 // (-- api-linter: core::0131::synonyms=disabled 58 // aip.dev/not-precedent: We need to do this because reasons. --) 59 rpc FetchBook(GetBookReq) returns (Book) { 60 option (google.api.http) = { 61 get: "/v1/{name=publishers/*/books/*}" 62 }; 63 } 64 ``` 65 66 If you need to violate this rule for an entire file, place the comment at the 67 top of the file. 68 69 [aip-131]: https://aip.dev/131 70 [aip.dev/not-precedent]: https://aip.dev/not-precedent