@@ -276,7 +276,7 @@ message PredefinedRules {
276276// Specifies how FieldRules.ignore behaves. See the documentation for
277277// FieldRules.required for definitions of "populated" and "nullable".
278278enum Ignore {
279- // Validation is only skipped if it's an unpopulated nullable fields .
279+ // Validation is only skipped if it's an unpopulated nullable field .
280280 //
281281 // ```proto
282282 // syntax="proto3";
@@ -3809,7 +3809,7 @@ message StringRules {
38093809 extensions 1000 to max;
38103810}
38113811
3812- // WellKnownRegex contain some well-known patterns.
3812+ // KnownRegex contains some well-known patterns.
38133813enum KnownRegex {
38143814 KNOWN_REGEX_UNSPECIFIED = 0 ;
38153815
@@ -4816,7 +4816,7 @@ message TimestampRules {
48164816}
48174817
48184818// `Violations` is a collection of `Violation` messages. This message type is returned by
4819- // protovalidate when a proto message fails to meet the requirements set by the `Rule` validation rules.
4819+ // Protovalidate when a proto message fails to meet the requirements set by the `Rule` validation rules.
48204820// Each individual violation is represented by a `Violation` message.
48214821message Violations {
48224822 // `violations` is a repeated field that contains all the `Violation` messages corresponding to the violations detected.
@@ -4828,11 +4828,41 @@ message Violations {
48284828// caused the violation, the specific rule that wasn't fulfilled, and a
48294829// human-readable error message.
48304830//
4831+ // For example, consider the following message:
4832+ //
4833+ // ```proto
4834+ // message User {
4835+ // int32 age = 1 [(buf.validate.field).cel = {
4836+ // id: "user.age",
4837+ // expression: "this < 18 ? 'User must be at least 18 years old' : ''",
4838+ // }];
4839+ // }
4840+ //
4841+ // It could produce the following violation:
4842+ //
48314843// ```json
48324844// {
4833- // "fieldPath": "bar",
4834- // "ruleId": "foo.bar",
4835- // "message": "bar must be greater than 0"
4845+ // "ruleId": "user.age",
4846+ // "message": "User must be at least 18 years old",
4847+ // "field": {
4848+ // "elements": [
4849+ // {
4850+ // "fieldNumber": 1,
4851+ // "fieldName": "age",
4852+ // "fieldType": "TYPE_INT32"
4853+ // }
4854+ // ]
4855+ // },
4856+ // "rule": {
4857+ // "elements": [
4858+ // {
4859+ // "fieldNumber": 23,
4860+ // "fieldName": "cel",
4861+ // "fieldType": "TYPE_MESSAGE",
4862+ // "index": "0"
4863+ // }
4864+ // ]
4865+ // }
48364866// }
48374867// ```
48384868message Violation {
@@ -4857,7 +4887,7 @@ message Violation {
48574887 // ```
48584888 optional FieldPath field = 5 ;
48594889
4860- // `rule` is a machine-readable path that points to the specific rule rule that failed validation.
4890+ // `rule` is a machine-readable path that points to the specific rule that failed validation.
48614891 // This will be a nested field starting from the FieldRules of the field that failed validation.
48624892 // For custom rules, this will provide the path of the rule, e.g. `cel[0]`.
48634893 //
0 commit comments