You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proto/protovalidate/buf/validate/validate.proto
+48Lines changed: 48 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -313,6 +313,7 @@ message FieldRules {
313
313
// Well-Known Field Types
314
314
AnyRulesany=20;
315
315
DurationRulesduration=21;
316
+
FieldMaskRulesfield_mask=28;
316
317
TimestampRulestimestamp=22;
317
318
}
318
319
@@ -4605,6 +4606,53 @@ message DurationRules {
4605
4606
extensions 1000 to max;
4606
4607
}
4607
4608
4609
+
// FieldMaskRules describe rules applied exclusively to the `google.protobuf.FieldMask` well-known type.
4610
+
messageFieldMaskRules {
4611
+
// Requires the FieldMask paths to be a subset of `valid`.
4612
+
// If any unknown path is included, an error message is generated.
4613
+
//
4614
+
// ```proto
4615
+
// message MyFieldMask {
4616
+
// // The `value` FieldMask must only contain paths listed in `valid`.
4617
+
// google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = {
4618
+
// valid: ["a", "b", "c.a"]
4619
+
// }];
4620
+
// }
4621
+
// ```
4622
+
repeatedstringvalid=1 [(predefined).cel = {
4623
+
id: "field_mask.valid"
4624
+
expression: "!this.paths.all(f, f in getField(rules, 'valid')) ? 'value must be a subset of %s'.format([getField(rules, 'valid')]) : ''"
4625
+
}];
4626
+
4627
+
// Requires the FieldMask paths to not include any subset of `invalid`.
4628
+
// If any invalid path is included, an error message is generated.
4629
+
//
4630
+
// ```proto
4631
+
// message MyFieldMask {
4632
+
// // The `value` FieldMask shall not contain paths listed in `invalid`.
4633
+
// google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = {
4634
+
// invalid: ["forbidden", "immutable", "c.a"]
4635
+
// }];
4636
+
// }
4637
+
// ```
4638
+
repeatedstringinvalid=2 [(predefined).cel = {
4639
+
id: "field_mask.invalid"
4640
+
expression: "!this.paths.all(f, !(f in getField(rules, 'invalid'))) ? 'value must not contain any subset of %s'.format([getField(rules, 'invalid')]) : ''"
4641
+
}];
4642
+
4643
+
// Extension fields in this range that have the (buf.validate.predefined)
4644
+
// option set will be treated as predefined field rules that can then be
4645
+
// set on the field options of other fields to apply field rules.
4646
+
// Extension numbers 1000 to 99999 are reserved for extension numbers that are
4647
+
// defined in the [Protobuf Global Extension Registry][1]. Extension numbers
4648
+
// above this range are reserved for extension numbers that are not explicitly
4649
+
// assigned. For rules defined in publicly-consumed schemas, use of extensions
4650
+
// above 99999 is discouraged due to the risk of conflicts.
// TimestampRules describe the rules applied exclusively to the `google.protobuf.Timestamp` well-known type.
4609
4657
messageTimestampRules {
4610
4658
// `const` dictates that this field, of the `google.protobuf.Timestamp` type, must exactly match the specified value. If the field value doesn't correspond to the specified timestamp, an error message will be generated.
0 commit comments