github.com/googleapis/api-linter@v1.65.2/docs/rules/0133/request-id-field.md (about) 1 --- 2 rule: 3 aip: 133 4 name: [core, '0133', request-id-field] 5 summary: create methods should have a client-specified ID field. 6 permalink: /133/request-id-field 7 redirect_from: 8 - /0133/request-id-field 9 --- 10 11 # Client-specified IDs 12 13 This rule enforces that declarative-friendly create methods include a 14 client-specified ID field, as mandated in [AIP-133][]. 15 16 ## Details 17 18 This rule looks at any `Create` method connected to a resource and complains if 19 it lacks a client-specified ID (e.g. `string book_id`) field. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 message CreateBookRequest { 28 string parent = 1 [(google.api.resource_reference) = { 29 child_type: "library.googleapis.com/Book" 30 }]; 31 32 Book book = 2; 33 34 // A `string book_id` field should exist. 35 } 36 ``` 37 38 **Correct** code for this rule: 39 40 ```proto 41 // Correct. 42 message CreateBookRequest { 43 string parent = 1 [(google.api.resource_reference) = { 44 child_type: "library.googleapis.com/Book" 45 }]; 46 47 string book_id = 2; 48 49 Book book = 3; 50 51 } 52 ``` 53 54 ## Disabling 55 56 If you need to violate this rule, use a leading comment above the message. 57 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 58 59 ```proto 60 // (-- api-linter: core::0133::request-id-field=disabled 61 // aip.dev/not-precedent: We need to do this because reasons. --) 62 message CreateBookRequest { 63 string parent = 1 [(google.api.resource_reference) = { 64 child_type: "library.googleapis.com/Book" 65 }]; 66 67 Book book = 2; 68 } 69 ``` 70 71 If you need to violate this rule for an entire file, place the comment at the 72 top of the file. 73 74 [aip-133]: https://aip.dev/133 75 [aip.dev/not-precedent]: https://aip.dev/not-precedent