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