github.com/googleapis/api-linter@v1.65.2/docs/rules/0131/request-name-field.md (about) 1 --- 2 rule: 3 aip: 131 4 name: [core, '0131', request-name-field] 5 summary: Get RPCs must have a `string name` field in the request. 6 permalink: /131/request-name-field 7 redirect_from: 8 - /0131/request-name-field 9 --- 10 11 # Get methods: Name field 12 13 This rule enforces that all `Get` standard methods have a `string name` field 14 in the request message, as mandated in [AIP-131][]. 15 16 ## Details 17 18 This rule looks at any message matching `Get*Request` and complains if 19 the `name` field type is not `string`. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 message GetBookRequest { 28 bytes name = 1; // Field type should be `string`. 29 } 30 ``` 31 32 **Correct** code for this rule: 33 34 ```proto 35 // Correct. 36 message GetBookRequest { 37 string name = 1; 38 } 39 ``` 40 41 ## Disabling 42 43 If you need to violate this rule, use a leading comment above the field. 44 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 45 46 ```proto 47 48 message GetBookRequest { 49 // (-- api-linter: core::0131::request-name-field=disabled 50 // aip.dev/not-precedent: This uses `bytes` for historical reasons. --) 51 bytes name = 1; 52 } 53 ``` 54 55 If you need to violate this rule for an entire file, place the comment at the 56 top of the file. 57 58 [aip-131]: https://aip.dev/131 59 [aip.dev/not-precedent]: https://aip.dev/not-precedent