github.com/googleapis/api-linter@v1.65.2/docs/rules/0157/request-read-mask-field.md (about) 1 --- 2 rule: 3 aip: 157 4 name: [core, '0157', request-read-mask-field] 5 summary: Request read mask fields must have the correct type. 6 permalink: /157/request-read-mask-field 7 redirect_from: 8 - /0157/request-read-mask-field 9 --- 10 11 # Partial responses: Request read mask field 12 13 This rule enforces that all `read_mask` fields in requests have the correct 14 type, as mandated in [AIP-157][]. 15 16 ## Details 17 18 This rule looks at any message matching `*Request` that contains a `read_mask` 19 field, and complains if the field is not a singular `google.protobuf.FieldMask`. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 message GetBookRequest { 28 string name = 1 [ 29 (google.api.resource_reference).type = "library.googleapis.com/Book", 30 (google.api.field_behavior) = REQUIRED 31 ]; 32 33 // Field type should be `google.protobuf.FieldMask`. 34 string read_mask = 2; 35 } 36 ``` 37 38 **Correct** code for this rule: 39 40 ```proto 41 // Correct. 42 message GetBookRequest { 43 string name = 1 [ 44 (google.api.resource_reference).type = "library.googleapis.com/Book", 45 (google.api.field_behavior) = REQUIRED 46 ]; 47 48 google.protobuf.FieldMask read_mask = 2; 49 } 50 ``` 51 52 ## Disabling 53 54 If you need to violate this rule, use a leading comment above the field. 55 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 56 57 ```proto 58 message GetBookRequest { 59 string name = 1 [ 60 (google.api.resource_reference).type = "library.googleapis.com/Book", 61 (google.api.field_behavior) = REQUIRED 62 ]; 63 64 // (-- api-linter: core::0157::request-read-mask-field=disabled 65 // aip.dev/not-precedent: We need to do this because reasons. --) 66 string read_mask = 2; 67 } 68 ``` 69 70 If you need to violate this rule for an entire file, place the comment at the 71 top of the file. 72 73 [aip-157]: https://aip.dev/157 74 [aip.dev/not-precedent]: https://aip.dev/not-precedent