From b137795fadc35cf5fd7ced9d8c9a7c6f23eec8a5 Mon Sep 17 00:00:00 2001 From: Sri Krishna Date: Mon, 20 Apr 2026 18:53:02 +0530 Subject: [PATCH] Update protovalidate to `v1.2.0` Signed-off-by: Sri Krishna --- gradle.properties | 2 +- .../resources/buf/validate/validate.proto | 1226 ++++++++--------- .../protovalidate/ValidationResultTest.java | 20 +- .../ValidatorConstructionTest.java | 4 +- .../ValidatorDifferentJavaPackagesTest.java | 2 +- .../ValidatorDynamicMessageTest.java | 4 +- 6 files changed, 590 insertions(+), 668 deletions(-) diff --git a/gradle.properties b/gradle.properties index 192a67eb0..441ca4eed 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Version of buf.build/bufbuild/protovalidate to use. -protovalidate.version = 895eefca6d1346f742fc18b9983d40478820906d +protovalidate.version = v1.2.0 # Arguments to the protovalidate-conformance CLI protovalidate.conformance.args = --strict_message --strict_error --expected_failures=expected-failures.yaml diff --git a/src/main/resources/buf/validate/validate.proto b/src/main/resources/buf/validate/validate.proto index 58e0840af..56117c88f 100644 --- a/src/main/resources/buf/validate/validate.proto +++ b/src/main/resources/buf/validate/validate.proto @@ -1,4 +1,4 @@ -// Copyright 2023-2025 Buf Technologies, Inc. +// Copyright 2023-2026 Buf Technologies, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ syntax = "proto2"; // // These rules are enforced at runtime by language-specific libraries. // See the [developer quickstart](https://protovalidate.com/quickstart/) to get started, or go directly to the runtime library for your language: -// [Go](https://github.com/bufbuild/protovalidate-go) +// [Go](https://github.com/bufbuild/protovalidate-go), // [JavaScript/TypeScript](https://github.com/bufbuild/protovalidate-es), // [Java](https://github.com/bufbuild/protovalidate-java), // [Python](https://github.com/bufbuild/protovalidate-python), @@ -90,7 +90,7 @@ extend google.protobuf.FieldOptions { // extend buf.validate.Int32Rules { // bool is_zero [(buf.validate.predefined).cel = { // id: "int32.is_zero", - // message: "value must be zero", + // message: "must be zero", // expression: "!rule || this == 0", // }]; // } @@ -167,7 +167,7 @@ message MessageRules { // // The field `foo` must be greater than 42. // option (buf.validate.message).cel = { // id: "my_message.value", - // message: "value must be greater than 42", + // message: "must be greater than 42", // expression: "this.foo > 42", // }; // optional int32 foo = 1; @@ -274,7 +274,7 @@ message FieldRules { // // The field `value` must be greater than 42. // optional int32 value = 1 [(buf.validate.field).cel = { // id: "my_message.value", - // message: "value must be greater than 42", + // message: "must be greater than 42", // expression: "this > 42", // }]; // } @@ -397,7 +397,7 @@ message PredefinedRules { // // The field `value` must be greater than 42. // optional int32 value = 1 [(buf.validate.predefined).cel = { // id: "my_message.value", - // message: "value must be greater than 42", + // message: "must be greater than 42", // expression: "this > 42", // }]; // } @@ -514,7 +514,7 @@ message FloatRules { // ``` optional float const = 1 [(predefined).cel = { id: "float.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { @@ -524,7 +524,7 @@ message FloatRules { // // ```proto // message MyFloat { - // // value must be less than 10.0 + // // must be less than 10.0 // float value = 1 [(buf.validate.field).float.lt = 10.0]; // } // ``` @@ -532,7 +532,7 @@ message FloatRules { id: "float.lt" expression: "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this >= rules.lt)" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -541,7 +541,7 @@ message FloatRules { // // ```proto // message MyFloat { - // // value must be less than or equal to 10.0 + // // must be less than or equal to 10.0 // float value = 1 [(buf.validate.field).float.lte = 10.0]; // } // ``` @@ -549,7 +549,7 @@ message FloatRules { id: "float.lte" expression: "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this > rules.lte)" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } @@ -562,13 +562,13 @@ message FloatRules { // // ```proto // message MyFloat { - // // value must be greater than 5.0 [float.gt] + // // must be greater than 5.0 [float.gt] // float value = 1 [(buf.validate.field).float.gt = 5.0]; // - // // value must be greater than 5 and less than 10.0 [float.gt_lt] + // // must be greater than 5 and less than 10.0 [float.gt_lt] // float other_value = 2 [(buf.validate.field).float = { gt: 5.0, lt: 10.0 }]; // - // // value must be greater than 10 or less than 5.0 [float.gt_lt_exclusive] + // // must be greater than 10 or less than 5.0 [float.gt_lt_exclusive] // float another_value = 3 [(buf.validate.field).float = { gt: 10.0, lt: 5.0 }]; // } // ``` @@ -577,31 +577,31 @@ message FloatRules { id: "float.gt" expression: "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this <= rules.gt)" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "float.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this.isNan() || this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "float.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (this.isNan() || (rules.lt <= this && this <= rules.gt))" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "float.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this.isNan() || this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "float.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (this.isNan() || (rules.lte < this && this <= rules.gt))" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -613,13 +613,13 @@ message FloatRules { // // ```proto // message MyFloat { - // // value must be greater than or equal to 5.0 [float.gte] + // // must be greater than or equal to 5.0 [float.gte] // float value = 1 [(buf.validate.field).float.gte = 5.0]; // - // // value must be greater than or equal to 5.0 and less than 10.0 [float.gte_lt] + // // must be greater than or equal to 5.0 and less than 10.0 [float.gte_lt] // float other_value = 2 [(buf.validate.field).float = { gte: 5.0, lt: 10.0 }]; // - // // value must be greater than or equal to 10.0 or less than 5.0 [float.gte_lt_exclusive] + // // must be greater than or equal to 10.0 or less than 5.0 [float.gte_lt_exclusive] // float another_value = 3 [(buf.validate.field).float = { gte: 10.0, lt: 5.0 }]; // } // ``` @@ -628,31 +628,31 @@ message FloatRules { id: "float.gte" expression: "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this < rules.gte)" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "float.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this.isNan() || this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "float.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (this.isNan() || (rules.lt <= this && this < rules.gte))" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "float.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this.isNan() || this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "float.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (this.isNan() || (rules.lte < this && this < rules.gte))" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -663,16 +663,16 @@ message FloatRules { // // ```proto // message MyFloat { - // // value must be in list [1.0, 2.0, 3.0] + // // must be in list [1.0, 2.0, 3.0] // float value = 1 [(buf.validate.field).float = { in: [1.0, 2.0, 3.0] }]; // } // ``` repeated float in = 6 [(predefined).cel = { id: "float.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; - // `in` requires the field value to not be equal to any of the specified + // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // @@ -684,14 +684,14 @@ message FloatRules { // ``` repeated float not_in = 7 [(predefined).cel = { id: "float.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `finite` requires the field value to be finite. If the field value is // infinite or NaN, an error message is generated. optional bool finite = 8 [(predefined).cel = { id: "float.finite" - expression: "rules.finite ? (this.isNan() || this.isInf() ? 'value must be finite' : '') : ''" + expression: "rules.finite ? (this.isNan() || this.isInf() ? 'must be finite' : '') : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -711,16 +711,9 @@ message FloatRules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -738,7 +731,7 @@ message DoubleRules { // ``` optional double const = 1 [(predefined).cel = { id: "double.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field < @@ -747,7 +740,7 @@ message DoubleRules { // // ```proto // message MyDouble { - // // value must be less than 10.0 + // // must be less than 10.0 // double value = 1 [(buf.validate.field).double.lt = 10.0]; // } // ``` @@ -755,7 +748,7 @@ message DoubleRules { id: "double.lt" expression: "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this >= rules.lt)" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified value @@ -764,7 +757,7 @@ message DoubleRules { // // ```proto // message MyDouble { - // // value must be less than or equal to 10.0 + // // must be less than or equal to 10.0 // double value = 1 [(buf.validate.field).double.lte = 10.0]; // } // ``` @@ -772,7 +765,7 @@ message DoubleRules { id: "double.lte" expression: "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this > rules.lte)" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -784,13 +777,13 @@ message DoubleRules { // // ```proto // message MyDouble { - // // value must be greater than 5.0 [double.gt] + // // must be greater than 5.0 [double.gt] // double value = 1 [(buf.validate.field).double.gt = 5.0]; // - // // value must be greater than 5 and less than 10.0 [double.gt_lt] + // // must be greater than 5 and less than 10.0 [double.gt_lt] // double other_value = 2 [(buf.validate.field).double = { gt: 5.0, lt: 10.0 }]; // - // // value must be greater than 10 or less than 5.0 [double.gt_lt_exclusive] + // // must be greater than 10 or less than 5.0 [double.gt_lt_exclusive] // double another_value = 3 [(buf.validate.field).double = { gt: 10.0, lt: 5.0 }]; // } // ``` @@ -799,31 +792,31 @@ message DoubleRules { id: "double.gt" expression: "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this <= rules.gt)" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "double.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this.isNan() || this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "double.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (this.isNan() || (rules.lt <= this && this <= rules.gt))" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "double.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this.isNan() || this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "double.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (this.isNan() || (rules.lte < this && this <= rules.gt))" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -835,13 +828,13 @@ message DoubleRules { // // ```proto // message MyDouble { - // // value must be greater than or equal to 5.0 [double.gte] + // // must be greater than or equal to 5.0 [double.gte] // double value = 1 [(buf.validate.field).double.gte = 5.0]; // - // // value must be greater than or equal to 5.0 and less than 10.0 [double.gte_lt] + // // must be greater than or equal to 5.0 and less than 10.0 [double.gte_lt] // double other_value = 2 [(buf.validate.field).double = { gte: 5.0, lt: 10.0 }]; // - // // value must be greater than or equal to 10.0 or less than 5.0 [double.gte_lt_exclusive] + // // must be greater than or equal to 10.0 or less than 5.0 [double.gte_lt_exclusive] // double another_value = 3 [(buf.validate.field).double = { gte: 10.0, lt: 5.0 }]; // } // ``` @@ -850,31 +843,31 @@ message DoubleRules { id: "double.gte" expression: "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this < rules.gte)" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "double.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this.isNan() || this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "double.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (this.isNan() || (rules.lt <= this && this < rules.gte))" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "double.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this.isNan() || this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "double.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (this.isNan() || (rules.lte < this && this < rules.gte))" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -884,13 +877,13 @@ message DoubleRules { // // ```proto // message MyDouble { - // // value must be in list [1.0, 2.0, 3.0] + // // must be in list [1.0, 2.0, 3.0] // double value = 1 [(buf.validate.field).double = { in: [1.0, 2.0, 3.0] }]; // } // ``` repeated double in = 6 [(predefined).cel = { id: "double.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -905,14 +898,14 @@ message DoubleRules { // ``` repeated double not_in = 7 [(predefined).cel = { id: "double.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `finite` requires the field value to be finite. If the field value is // infinite or NaN, an error message is generated. optional bool finite = 8 [(predefined).cel = { id: "double.finite" - expression: "rules.finite ? (this.isNan() || this.isInf() ? 'value must be finite' : '') : ''" + expression: "rules.finite ? (this.isNan() || this.isInf() ? 'must be finite' : '') : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -932,16 +925,9 @@ message DoubleRules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -959,7 +945,7 @@ message Int32Rules { // ``` optional int32 const = 1 [(predefined).cel = { id: "int32.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field @@ -968,7 +954,7 @@ message Int32Rules { // // ```proto // message MyInt32 { - // // value must be less than 10 + // // must be less than 10 // int32 value = 1 [(buf.validate.field).int32.lt = 10]; // } // ``` @@ -976,7 +962,7 @@ message Int32Rules { id: "int32.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -985,7 +971,7 @@ message Int32Rules { // // ```proto // message MyInt32 { - // // value must be less than or equal to 10 + // // must be less than or equal to 10 // int32 value = 1 [(buf.validate.field).int32.lte = 10]; // } // ``` @@ -993,7 +979,7 @@ message Int32Rules { id: "int32.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -1005,13 +991,13 @@ message Int32Rules { // // ```proto // message MyInt32 { - // // value must be greater than 5 [int32.gt] + // // must be greater than 5 [int32.gt] // int32 value = 1 [(buf.validate.field).int32.gt = 5]; // - // // value must be greater than 5 and less than 10 [int32.gt_lt] + // // must be greater than 5 and less than 10 [int32.gt_lt] // int32 other_value = 2 [(buf.validate.field).int32 = { gt: 5, lt: 10 }]; // - // // value must be greater than 10 or less than 5 [int32.gt_lt_exclusive] + // // must be greater than 10 or less than 5 [int32.gt_lt_exclusive] // int32 another_value = 3 [(buf.validate.field).int32 = { gt: 10, lt: 5 }]; // } // ``` @@ -1020,31 +1006,31 @@ message Int32Rules { id: "int32.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "int32.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "int32.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "int32.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "int32.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -1056,13 +1042,13 @@ message Int32Rules { // // ```proto // message MyInt32 { - // // value must be greater than or equal to 5 [int32.gte] + // // must be greater than or equal to 5 [int32.gte] // int32 value = 1 [(buf.validate.field).int32.gte = 5]; // - // // value must be greater than or equal to 5 and less than 10 [int32.gte_lt] + // // must be greater than or equal to 5 and less than 10 [int32.gte_lt] // int32 other_value = 2 [(buf.validate.field).int32 = { gte: 5, lt: 10 }]; // - // // value must be greater than or equal to 10 or less than 5 [int32.gte_lt_exclusive] + // // must be greater than or equal to 10 or less than 5 [int32.gte_lt_exclusive] // int32 another_value = 3 [(buf.validate.field).int32 = { gte: 10, lt: 5 }]; // } // ``` @@ -1071,31 +1057,31 @@ message Int32Rules { id: "int32.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "int32.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "int32.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "int32.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "int32.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -1106,13 +1092,13 @@ message Int32Rules { // // ```proto // message MyInt32 { - // // value must be in list [1, 2, 3] + // // must be in list [1, 2, 3] // int32 value = 1 [(buf.validate.field).int32 = { in: [1, 2, 3] }]; // } // ``` repeated int32 in = 6 [(predefined).cel = { id: "int32.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -1127,7 +1113,7 @@ message Int32Rules { // ``` repeated int32 not_in = 7 [(predefined).cel = { id: "int32.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -1147,16 +1133,9 @@ message Int32Rules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -1174,7 +1153,7 @@ message Int64Rules { // ``` optional int64 const = 1 [(predefined).cel = { id: "int64.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field < @@ -1183,7 +1162,7 @@ message Int64Rules { // // ```proto // message MyInt64 { - // // value must be less than 10 + // // must be less than 10 // int64 value = 1 [(buf.validate.field).int64.lt = 10]; // } // ``` @@ -1191,7 +1170,7 @@ message Int64Rules { id: "int64.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -1200,7 +1179,7 @@ message Int64Rules { // // ```proto // message MyInt64 { - // // value must be less than or equal to 10 + // // must be less than or equal to 10 // int64 value = 1 [(buf.validate.field).int64.lte = 10]; // } // ``` @@ -1208,7 +1187,7 @@ message Int64Rules { id: "int64.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -1220,13 +1199,13 @@ message Int64Rules { // // ```proto // message MyInt64 { - // // value must be greater than 5 [int64.gt] + // // must be greater than 5 [int64.gt] // int64 value = 1 [(buf.validate.field).int64.gt = 5]; // - // // value must be greater than 5 and less than 10 [int64.gt_lt] + // // must be greater than 5 and less than 10 [int64.gt_lt] // int64 other_value = 2 [(buf.validate.field).int64 = { gt: 5, lt: 10 }]; // - // // value must be greater than 10 or less than 5 [int64.gt_lt_exclusive] + // // must be greater than 10 or less than 5 [int64.gt_lt_exclusive] // int64 another_value = 3 [(buf.validate.field).int64 = { gt: 10, lt: 5 }]; // } // ``` @@ -1235,31 +1214,31 @@ message Int64Rules { id: "int64.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "int64.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "int64.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "int64.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "int64.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -1271,13 +1250,13 @@ message Int64Rules { // // ```proto // message MyInt64 { - // // value must be greater than or equal to 5 [int64.gte] + // // must be greater than or equal to 5 [int64.gte] // int64 value = 1 [(buf.validate.field).int64.gte = 5]; // - // // value must be greater than or equal to 5 and less than 10 [int64.gte_lt] + // // must be greater than or equal to 5 and less than 10 [int64.gte_lt] // int64 other_value = 2 [(buf.validate.field).int64 = { gte: 5, lt: 10 }]; // - // // value must be greater than or equal to 10 or less than 5 [int64.gte_lt_exclusive] + // // must be greater than or equal to 10 or less than 5 [int64.gte_lt_exclusive] // int64 another_value = 3 [(buf.validate.field).int64 = { gte: 10, lt: 5 }]; // } // ``` @@ -1286,31 +1265,31 @@ message Int64Rules { id: "int64.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "int64.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "int64.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "int64.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "int64.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -1321,13 +1300,13 @@ message Int64Rules { // // ```proto // message MyInt64 { - // // value must be in list [1, 2, 3] + // // must be in list [1, 2, 3] // int64 value = 1 [(buf.validate.field).int64 = { in: [1, 2, 3] }]; // } // ``` repeated int64 in = 6 [(predefined).cel = { id: "int64.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -1342,7 +1321,7 @@ message Int64Rules { // ``` repeated int64 not_in = 7 [(predefined).cel = { id: "int64.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -1362,16 +1341,9 @@ message Int64Rules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -1389,7 +1361,7 @@ message UInt32Rules { // ``` optional uint32 const = 1 [(predefined).cel = { id: "uint32.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field < @@ -1398,7 +1370,7 @@ message UInt32Rules { // // ```proto // message MyUInt32 { - // // value must be less than 10 + // // must be less than 10 // uint32 value = 1 [(buf.validate.field).uint32.lt = 10]; // } // ``` @@ -1406,7 +1378,7 @@ message UInt32Rules { id: "uint32.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -1415,7 +1387,7 @@ message UInt32Rules { // // ```proto // message MyUInt32 { - // // value must be less than or equal to 10 + // // must be less than or equal to 10 // uint32 value = 1 [(buf.validate.field).uint32.lte = 10]; // } // ``` @@ -1423,7 +1395,7 @@ message UInt32Rules { id: "uint32.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -1435,13 +1407,13 @@ message UInt32Rules { // // ```proto // message MyUInt32 { - // // value must be greater than 5 [uint32.gt] + // // must be greater than 5 [uint32.gt] // uint32 value = 1 [(buf.validate.field).uint32.gt = 5]; // - // // value must be greater than 5 and less than 10 [uint32.gt_lt] + // // must be greater than 5 and less than 10 [uint32.gt_lt] // uint32 other_value = 2 [(buf.validate.field).uint32 = { gt: 5, lt: 10 }]; // - // // value must be greater than 10 or less than 5 [uint32.gt_lt_exclusive] + // // must be greater than 10 or less than 5 [uint32.gt_lt_exclusive] // uint32 another_value = 3 [(buf.validate.field).uint32 = { gt: 10, lt: 5 }]; // } // ``` @@ -1450,31 +1422,31 @@ message UInt32Rules { id: "uint32.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "uint32.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "uint32.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "uint32.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "uint32.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -1486,13 +1458,13 @@ message UInt32Rules { // // ```proto // message MyUInt32 { - // // value must be greater than or equal to 5 [uint32.gte] + // // must be greater than or equal to 5 [uint32.gte] // uint32 value = 1 [(buf.validate.field).uint32.gte = 5]; // - // // value must be greater than or equal to 5 and less than 10 [uint32.gte_lt] + // // must be greater than or equal to 5 and less than 10 [uint32.gte_lt] // uint32 other_value = 2 [(buf.validate.field).uint32 = { gte: 5, lt: 10 }]; // - // // value must be greater than or equal to 10 or less than 5 [uint32.gte_lt_exclusive] + // // must be greater than or equal to 10 or less than 5 [uint32.gte_lt_exclusive] // uint32 another_value = 3 [(buf.validate.field).uint32 = { gte: 10, lt: 5 }]; // } // ``` @@ -1501,31 +1473,31 @@ message UInt32Rules { id: "uint32.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "uint32.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "uint32.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "uint32.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "uint32.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -1536,13 +1508,13 @@ message UInt32Rules { // // ```proto // message MyUInt32 { - // // value must be in list [1, 2, 3] + // // must be in list [1, 2, 3] // uint32 value = 1 [(buf.validate.field).uint32 = { in: [1, 2, 3] }]; // } // ``` repeated uint32 in = 6 [(predefined).cel = { id: "uint32.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -1557,7 +1529,7 @@ message UInt32Rules { // ``` repeated uint32 not_in = 7 [(predefined).cel = { id: "uint32.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -1577,16 +1549,9 @@ message UInt32Rules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -1604,7 +1569,7 @@ message UInt64Rules { // ``` optional uint64 const = 1 [(predefined).cel = { id: "uint64.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field < @@ -1613,7 +1578,7 @@ message UInt64Rules { // // ```proto // message MyUInt64 { - // // value must be less than 10 + // // must be less than 10 // uint64 value = 1 [(buf.validate.field).uint64.lt = 10]; // } // ``` @@ -1621,7 +1586,7 @@ message UInt64Rules { id: "uint64.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -1630,7 +1595,7 @@ message UInt64Rules { // // ```proto // message MyUInt64 { - // // value must be less than or equal to 10 + // // must be less than or equal to 10 // uint64 value = 1 [(buf.validate.field).uint64.lte = 10]; // } // ``` @@ -1638,7 +1603,7 @@ message UInt64Rules { id: "uint64.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -1650,13 +1615,13 @@ message UInt64Rules { // // ```proto // message MyUInt64 { - // // value must be greater than 5 [uint64.gt] + // // must be greater than 5 [uint64.gt] // uint64 value = 1 [(buf.validate.field).uint64.gt = 5]; // - // // value must be greater than 5 and less than 10 [uint64.gt_lt] + // // must be greater than 5 and less than 10 [uint64.gt_lt] // uint64 other_value = 2 [(buf.validate.field).uint64 = { gt: 5, lt: 10 }]; // - // // value must be greater than 10 or less than 5 [uint64.gt_lt_exclusive] + // // must be greater than 10 or less than 5 [uint64.gt_lt_exclusive] // uint64 another_value = 3 [(buf.validate.field).uint64 = { gt: 10, lt: 5 }]; // } // ``` @@ -1665,31 +1630,31 @@ message UInt64Rules { id: "uint64.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "uint64.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "uint64.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "uint64.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "uint64.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -1701,13 +1666,13 @@ message UInt64Rules { // // ```proto // message MyUInt64 { - // // value must be greater than or equal to 5 [uint64.gte] + // // must be greater than or equal to 5 [uint64.gte] // uint64 value = 1 [(buf.validate.field).uint64.gte = 5]; // - // // value must be greater than or equal to 5 and less than 10 [uint64.gte_lt] + // // must be greater than or equal to 5 and less than 10 [uint64.gte_lt] // uint64 other_value = 2 [(buf.validate.field).uint64 = { gte: 5, lt: 10 }]; // - // // value must be greater than or equal to 10 or less than 5 [uint64.gte_lt_exclusive] + // // must be greater than or equal to 10 or less than 5 [uint64.gte_lt_exclusive] // uint64 another_value = 3 [(buf.validate.field).uint64 = { gte: 10, lt: 5 }]; // } // ``` @@ -1716,31 +1681,31 @@ message UInt64Rules { id: "uint64.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "uint64.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "uint64.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "uint64.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "uint64.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -1750,13 +1715,13 @@ message UInt64Rules { // // ```proto // message MyUInt64 { - // // value must be in list [1, 2, 3] + // // must be in list [1, 2, 3] // uint64 value = 1 [(buf.validate.field).uint64 = { in: [1, 2, 3] }]; // } // ``` repeated uint64 in = 6 [(predefined).cel = { id: "uint64.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -1771,7 +1736,7 @@ message UInt64Rules { // ``` repeated uint64 not_in = 7 [(predefined).cel = { id: "uint64.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -1791,16 +1756,9 @@ message UInt64Rules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -1817,7 +1775,7 @@ message SInt32Rules { // ``` optional sint32 const = 1 [(predefined).cel = { id: "sint32.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field @@ -1826,7 +1784,7 @@ message SInt32Rules { // // ```proto // message MySInt32 { - // // value must be less than 10 + // // must be less than 10 // sint32 value = 1 [(buf.validate.field).sint32.lt = 10]; // } // ``` @@ -1834,7 +1792,7 @@ message SInt32Rules { id: "sint32.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -1843,7 +1801,7 @@ message SInt32Rules { // // ```proto // message MySInt32 { - // // value must be less than or equal to 10 + // // must be less than or equal to 10 // sint32 value = 1 [(buf.validate.field).sint32.lte = 10]; // } // ``` @@ -1851,7 +1809,7 @@ message SInt32Rules { id: "sint32.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -1863,13 +1821,13 @@ message SInt32Rules { // // ```proto // message MySInt32 { - // // value must be greater than 5 [sint32.gt] + // // must be greater than 5 [sint32.gt] // sint32 value = 1 [(buf.validate.field).sint32.gt = 5]; // - // // value must be greater than 5 and less than 10 [sint32.gt_lt] + // // must be greater than 5 and less than 10 [sint32.gt_lt] // sint32 other_value = 2 [(buf.validate.field).sint32 = { gt: 5, lt: 10 }]; // - // // value must be greater than 10 or less than 5 [sint32.gt_lt_exclusive] + // // must be greater than 10 or less than 5 [sint32.gt_lt_exclusive] // sint32 another_value = 3 [(buf.validate.field).sint32 = { gt: 10, lt: 5 }]; // } // ``` @@ -1878,31 +1836,31 @@ message SInt32Rules { id: "sint32.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "sint32.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "sint32.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "sint32.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "sint32.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -1914,13 +1872,13 @@ message SInt32Rules { // // ```proto // message MySInt32 { - // // value must be greater than or equal to 5 [sint32.gte] + // // must be greater than or equal to 5 [sint32.gte] // sint32 value = 1 [(buf.validate.field).sint32.gte = 5]; // - // // value must be greater than or equal to 5 and less than 10 [sint32.gte_lt] + // // must be greater than or equal to 5 and less than 10 [sint32.gte_lt] // sint32 other_value = 2 [(buf.validate.field).sint32 = { gte: 5, lt: 10 }]; // - // // value must be greater than or equal to 10 or less than 5 [sint32.gte_lt_exclusive] + // // must be greater than or equal to 10 or less than 5 [sint32.gte_lt_exclusive] // sint32 another_value = 3 [(buf.validate.field).sint32 = { gte: 10, lt: 5 }]; // } // ``` @@ -1929,31 +1887,31 @@ message SInt32Rules { id: "sint32.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "sint32.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "sint32.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "sint32.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "sint32.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -1964,13 +1922,13 @@ message SInt32Rules { // // ```proto // message MySInt32 { - // // value must be in list [1, 2, 3] + // // must be in list [1, 2, 3] // sint32 value = 1 [(buf.validate.field).sint32 = { in: [1, 2, 3] }]; // } // ``` repeated sint32 in = 6 [(predefined).cel = { id: "sint32.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -1985,7 +1943,7 @@ message SInt32Rules { // ``` repeated sint32 not_in = 7 [(predefined).cel = { id: "sint32.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -2005,16 +1963,9 @@ message SInt32Rules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -2031,7 +1982,7 @@ message SInt64Rules { // ``` optional sint64 const = 1 [(predefined).cel = { id: "sint64.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field @@ -2040,7 +1991,7 @@ message SInt64Rules { // // ```proto // message MySInt64 { - // // value must be less than 10 + // // must be less than 10 // sint64 value = 1 [(buf.validate.field).sint64.lt = 10]; // } // ``` @@ -2048,7 +1999,7 @@ message SInt64Rules { id: "sint64.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -2057,7 +2008,7 @@ message SInt64Rules { // // ```proto // message MySInt64 { - // // value must be less than or equal to 10 + // // must be less than or equal to 10 // sint64 value = 1 [(buf.validate.field).sint64.lte = 10]; // } // ``` @@ -2065,7 +2016,7 @@ message SInt64Rules { id: "sint64.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -2077,13 +2028,13 @@ message SInt64Rules { // // ```proto // message MySInt64 { - // // value must be greater than 5 [sint64.gt] + // // must be greater than 5 [sint64.gt] // sint64 value = 1 [(buf.validate.field).sint64.gt = 5]; // - // // value must be greater than 5 and less than 10 [sint64.gt_lt] + // // must be greater than 5 and less than 10 [sint64.gt_lt] // sint64 other_value = 2 [(buf.validate.field).sint64 = { gt: 5, lt: 10 }]; // - // // value must be greater than 10 or less than 5 [sint64.gt_lt_exclusive] + // // must be greater than 10 or less than 5 [sint64.gt_lt_exclusive] // sint64 another_value = 3 [(buf.validate.field).sint64 = { gt: 10, lt: 5 }]; // } // ``` @@ -2092,31 +2043,31 @@ message SInt64Rules { id: "sint64.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "sint64.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "sint64.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "sint64.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "sint64.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -2128,13 +2079,13 @@ message SInt64Rules { // // ```proto // message MySInt64 { - // // value must be greater than or equal to 5 [sint64.gte] + // // must be greater than or equal to 5 [sint64.gte] // sint64 value = 1 [(buf.validate.field).sint64.gte = 5]; // - // // value must be greater than or equal to 5 and less than 10 [sint64.gte_lt] + // // must be greater than or equal to 5 and less than 10 [sint64.gte_lt] // sint64 other_value = 2 [(buf.validate.field).sint64 = { gte: 5, lt: 10 }]; // - // // value must be greater than or equal to 10 or less than 5 [sint64.gte_lt_exclusive] + // // must be greater than or equal to 10 or less than 5 [sint64.gte_lt_exclusive] // sint64 another_value = 3 [(buf.validate.field).sint64 = { gte: 10, lt: 5 }]; // } // ``` @@ -2143,31 +2094,31 @@ message SInt64Rules { id: "sint64.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "sint64.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "sint64.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "sint64.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "sint64.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -2178,13 +2129,13 @@ message SInt64Rules { // // ```proto // message MySInt64 { - // // value must be in list [1, 2, 3] + // // must be in list [1, 2, 3] // sint64 value = 1 [(buf.validate.field).sint64 = { in: [1, 2, 3] }]; // } // ``` repeated sint64 in = 6 [(predefined).cel = { id: "sint64.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -2199,7 +2150,7 @@ message SInt64Rules { // ``` repeated sint64 not_in = 7 [(predefined).cel = { id: "sint64.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -2219,16 +2170,9 @@ message SInt64Rules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -2245,7 +2189,7 @@ message Fixed32Rules { // ``` optional fixed32 const = 1 [(predefined).cel = { id: "fixed32.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field < @@ -2254,7 +2198,7 @@ message Fixed32Rules { // // ```proto // message MyFixed32 { - // // value must be less than 10 + // // must be less than 10 // fixed32 value = 1 [(buf.validate.field).fixed32.lt = 10]; // } // ``` @@ -2262,7 +2206,7 @@ message Fixed32Rules { id: "fixed32.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -2271,7 +2215,7 @@ message Fixed32Rules { // // ```proto // message MyFixed32 { - // // value must be less than or equal to 10 + // // must be less than or equal to 10 // fixed32 value = 1 [(buf.validate.field).fixed32.lte = 10]; // } // ``` @@ -2279,7 +2223,7 @@ message Fixed32Rules { id: "fixed32.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -2291,13 +2235,13 @@ message Fixed32Rules { // // ```proto // message MyFixed32 { - // // value must be greater than 5 [fixed32.gt] + // // must be greater than 5 [fixed32.gt] // fixed32 value = 1 [(buf.validate.field).fixed32.gt = 5]; // - // // value must be greater than 5 and less than 10 [fixed32.gt_lt] + // // must be greater than 5 and less than 10 [fixed32.gt_lt] // fixed32 other_value = 2 [(buf.validate.field).fixed32 = { gt: 5, lt: 10 }]; // - // // value must be greater than 10 or less than 5 [fixed32.gt_lt_exclusive] + // // must be greater than 10 or less than 5 [fixed32.gt_lt_exclusive] // fixed32 another_value = 3 [(buf.validate.field).fixed32 = { gt: 10, lt: 5 }]; // } // ``` @@ -2306,31 +2250,31 @@ message Fixed32Rules { id: "fixed32.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "fixed32.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "fixed32.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "fixed32.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "fixed32.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -2342,13 +2286,13 @@ message Fixed32Rules { // // ```proto // message MyFixed32 { - // // value must be greater than or equal to 5 [fixed32.gte] + // // must be greater than or equal to 5 [fixed32.gte] // fixed32 value = 1 [(buf.validate.field).fixed32.gte = 5]; // - // // value must be greater than or equal to 5 and less than 10 [fixed32.gte_lt] + // // must be greater than or equal to 5 and less than 10 [fixed32.gte_lt] // fixed32 other_value = 2 [(buf.validate.field).fixed32 = { gte: 5, lt: 10 }]; // - // // value must be greater than or equal to 10 or less than 5 [fixed32.gte_lt_exclusive] + // // must be greater than or equal to 10 or less than 5 [fixed32.gte_lt_exclusive] // fixed32 another_value = 3 [(buf.validate.field).fixed32 = { gte: 10, lt: 5 }]; // } // ``` @@ -2357,31 +2301,31 @@ message Fixed32Rules { id: "fixed32.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "fixed32.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "fixed32.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "fixed32.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "fixed32.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -2392,13 +2336,13 @@ message Fixed32Rules { // // ```proto // message MyFixed32 { - // // value must be in list [1, 2, 3] + // // must be in list [1, 2, 3] // fixed32 value = 1 [(buf.validate.field).fixed32 = { in: [1, 2, 3] }]; // } // ``` repeated fixed32 in = 6 [(predefined).cel = { id: "fixed32.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -2413,7 +2357,7 @@ message Fixed32Rules { // ``` repeated fixed32 not_in = 7 [(predefined).cel = { id: "fixed32.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -2433,16 +2377,9 @@ message Fixed32Rules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -2459,7 +2396,7 @@ message Fixed64Rules { // ``` optional fixed64 const = 1 [(predefined).cel = { id: "fixed64.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field < @@ -2468,7 +2405,7 @@ message Fixed64Rules { // // ```proto // message MyFixed64 { - // // value must be less than 10 + // // must be less than 10 // fixed64 value = 1 [(buf.validate.field).fixed64.lt = 10]; // } // ``` @@ -2476,7 +2413,7 @@ message Fixed64Rules { id: "fixed64.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -2485,7 +2422,7 @@ message Fixed64Rules { // // ```proto // message MyFixed64 { - // // value must be less than or equal to 10 + // // must be less than or equal to 10 // fixed64 value = 1 [(buf.validate.field).fixed64.lte = 10]; // } // ``` @@ -2493,7 +2430,7 @@ message Fixed64Rules { id: "fixed64.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -2505,13 +2442,13 @@ message Fixed64Rules { // // ```proto // message MyFixed64 { - // // value must be greater than 5 [fixed64.gt] + // // must be greater than 5 [fixed64.gt] // fixed64 value = 1 [(buf.validate.field).fixed64.gt = 5]; // - // // value must be greater than 5 and less than 10 [fixed64.gt_lt] + // // must be greater than 5 and less than 10 [fixed64.gt_lt] // fixed64 other_value = 2 [(buf.validate.field).fixed64 = { gt: 5, lt: 10 }]; // - // // value must be greater than 10 or less than 5 [fixed64.gt_lt_exclusive] + // // must be greater than 10 or less than 5 [fixed64.gt_lt_exclusive] // fixed64 another_value = 3 [(buf.validate.field).fixed64 = { gt: 10, lt: 5 }]; // } // ``` @@ -2520,31 +2457,31 @@ message Fixed64Rules { id: "fixed64.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "fixed64.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "fixed64.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "fixed64.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "fixed64.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -2556,13 +2493,13 @@ message Fixed64Rules { // // ```proto // message MyFixed64 { - // // value must be greater than or equal to 5 [fixed64.gte] + // // must be greater than or equal to 5 [fixed64.gte] // fixed64 value = 1 [(buf.validate.field).fixed64.gte = 5]; // - // // value must be greater than or equal to 5 and less than 10 [fixed64.gte_lt] + // // must be greater than or equal to 5 and less than 10 [fixed64.gte_lt] // fixed64 other_value = 2 [(buf.validate.field).fixed64 = { gte: 5, lt: 10 }]; // - // // value must be greater than or equal to 10 or less than 5 [fixed64.gte_lt_exclusive] + // // must be greater than or equal to 10 or less than 5 [fixed64.gte_lt_exclusive] // fixed64 another_value = 3 [(buf.validate.field).fixed64 = { gte: 10, lt: 5 }]; // } // ``` @@ -2571,31 +2508,31 @@ message Fixed64Rules { id: "fixed64.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "fixed64.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "fixed64.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "fixed64.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "fixed64.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -2606,13 +2543,13 @@ message Fixed64Rules { // // ```proto // message MyFixed64 { - // // value must be in list [1, 2, 3] + // // must be in list [1, 2, 3] // fixed64 value = 1 [(buf.validate.field).fixed64 = { in: [1, 2, 3] }]; // } // ``` repeated fixed64 in = 6 [(predefined).cel = { id: "fixed64.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -2627,7 +2564,7 @@ message Fixed64Rules { // ``` repeated fixed64 not_in = 7 [(predefined).cel = { id: "fixed64.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -2647,16 +2584,9 @@ message Fixed64Rules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -2673,7 +2603,7 @@ message SFixed32Rules { // ``` optional sfixed32 const = 1 [(predefined).cel = { id: "sfixed32.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field < @@ -2682,7 +2612,7 @@ message SFixed32Rules { // // ```proto // message MySFixed32 { - // // value must be less than 10 + // // must be less than 10 // sfixed32 value = 1 [(buf.validate.field).sfixed32.lt = 10]; // } // ``` @@ -2690,7 +2620,7 @@ message SFixed32Rules { id: "sfixed32.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -2699,7 +2629,7 @@ message SFixed32Rules { // // ```proto // message MySFixed32 { - // // value must be less than or equal to 10 + // // must be less than or equal to 10 // sfixed32 value = 1 [(buf.validate.field).sfixed32.lte = 10]; // } // ``` @@ -2707,7 +2637,7 @@ message SFixed32Rules { id: "sfixed32.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -2719,13 +2649,13 @@ message SFixed32Rules { // // ```proto // message MySFixed32 { - // // value must be greater than 5 [sfixed32.gt] + // // must be greater than 5 [sfixed32.gt] // sfixed32 value = 1 [(buf.validate.field).sfixed32.gt = 5]; // - // // value must be greater than 5 and less than 10 [sfixed32.gt_lt] + // // must be greater than 5 and less than 10 [sfixed32.gt_lt] // sfixed32 other_value = 2 [(buf.validate.field).sfixed32 = { gt: 5, lt: 10 }]; // - // // value must be greater than 10 or less than 5 [sfixed32.gt_lt_exclusive] + // // must be greater than 10 or less than 5 [sfixed32.gt_lt_exclusive] // sfixed32 another_value = 3 [(buf.validate.field).sfixed32 = { gt: 10, lt: 5 }]; // } // ``` @@ -2734,31 +2664,31 @@ message SFixed32Rules { id: "sfixed32.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "sfixed32.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "sfixed32.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "sfixed32.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "sfixed32.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -2770,13 +2700,13 @@ message SFixed32Rules { // // ```proto // message MySFixed32 { - // // value must be greater than or equal to 5 [sfixed32.gte] + // // must be greater than or equal to 5 [sfixed32.gte] // sfixed32 value = 1 [(buf.validate.field).sfixed32.gte = 5]; // - // // value must be greater than or equal to 5 and less than 10 [sfixed32.gte_lt] + // // must be greater than or equal to 5 and less than 10 [sfixed32.gte_lt] // sfixed32 other_value = 2 [(buf.validate.field).sfixed32 = { gte: 5, lt: 10 }]; // - // // value must be greater than or equal to 10 or less than 5 [sfixed32.gte_lt_exclusive] + // // must be greater than or equal to 10 or less than 5 [sfixed32.gte_lt_exclusive] // sfixed32 another_value = 3 [(buf.validate.field).sfixed32 = { gte: 10, lt: 5 }]; // } // ``` @@ -2785,31 +2715,31 @@ message SFixed32Rules { id: "sfixed32.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "sfixed32.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "sfixed32.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "sfixed32.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "sfixed32.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -2820,13 +2750,13 @@ message SFixed32Rules { // // ```proto // message MySFixed32 { - // // value must be in list [1, 2, 3] + // // must be in list [1, 2, 3] // sfixed32 value = 1 [(buf.validate.field).sfixed32 = { in: [1, 2, 3] }]; // } // ``` repeated sfixed32 in = 6 [(predefined).cel = { id: "sfixed32.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -2841,7 +2771,7 @@ message SFixed32Rules { // ``` repeated sfixed32 not_in = 7 [(predefined).cel = { id: "sfixed32.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -2861,16 +2791,9 @@ message SFixed32Rules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -2887,7 +2810,7 @@ message SFixed64Rules { // ``` optional sfixed64 const = 1 [(predefined).cel = { id: "sfixed64.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` requires the field value to be less than the specified value (field < @@ -2896,7 +2819,7 @@ message SFixed64Rules { // // ```proto // message MySFixed64 { - // // value must be less than 10 + // // must be less than 10 // sfixed64 value = 1 [(buf.validate.field).sfixed64.lt = 10]; // } // ``` @@ -2904,7 +2827,7 @@ message SFixed64Rules { id: "sfixed64.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` requires the field value to be less than or equal to the specified @@ -2913,7 +2836,7 @@ message SFixed64Rules { // // ```proto // message MySFixed64 { - // // value must be less than or equal to 10 + // // must be less than or equal to 10 // sfixed64 value = 1 [(buf.validate.field).sfixed64.lte = 10]; // } // ``` @@ -2921,7 +2844,7 @@ message SFixed64Rules { id: "sfixed64.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -2933,13 +2856,13 @@ message SFixed64Rules { // // ```proto // message MySFixed64 { - // // value must be greater than 5 [sfixed64.gt] + // // must be greater than 5 [sfixed64.gt] // sfixed64 value = 1 [(buf.validate.field).sfixed64.gt = 5]; // - // // value must be greater than 5 and less than 10 [sfixed64.gt_lt] + // // must be greater than 5 and less than 10 [sfixed64.gt_lt] // sfixed64 other_value = 2 [(buf.validate.field).sfixed64 = { gt: 5, lt: 10 }]; // - // // value must be greater than 10 or less than 5 [sfixed64.gt_lt_exclusive] + // // must be greater than 10 or less than 5 [sfixed64.gt_lt_exclusive] // sfixed64 another_value = 3 [(buf.validate.field).sfixed64 = { gt: 10, lt: 5 }]; // } // ``` @@ -2948,31 +2871,31 @@ message SFixed64Rules { id: "sfixed64.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "sfixed64.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "sfixed64.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "sfixed64.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "sfixed64.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -2984,13 +2907,13 @@ message SFixed64Rules { // // ```proto // message MySFixed64 { - // // value must be greater than or equal to 5 [sfixed64.gte] + // // must be greater than or equal to 5 [sfixed64.gte] // sfixed64 value = 1 [(buf.validate.field).sfixed64.gte = 5]; // - // // value must be greater than or equal to 5 and less than 10 [sfixed64.gte_lt] + // // must be greater than or equal to 5 and less than 10 [sfixed64.gte_lt] // sfixed64 other_value = 2 [(buf.validate.field).sfixed64 = { gte: 5, lt: 10 }]; // - // // value must be greater than or equal to 10 or less than 5 [sfixed64.gte_lt_exclusive] + // // must be greater than or equal to 10 or less than 5 [sfixed64.gte_lt_exclusive] // sfixed64 another_value = 3 [(buf.validate.field).sfixed64 = { gte: 10, lt: 5 }]; // } // ``` @@ -2999,31 +2922,31 @@ message SFixed64Rules { id: "sfixed64.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "sfixed64.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "sfixed64.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "sfixed64.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "sfixed64.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -3034,13 +2957,13 @@ message SFixed64Rules { // // ```proto // message MySFixed64 { - // // value must be in list [1, 2, 3] + // // must be in list [1, 2, 3] // sfixed64 value = 1 [(buf.validate.field).sfixed64 = { in: [1, 2, 3] }]; // } // ``` repeated sfixed64 in = 6 [(predefined).cel = { id: "sfixed64.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not be equal to any of the specified @@ -3055,7 +2978,7 @@ message SFixed64Rules { // ``` repeated sfixed64 not_in = 7 [(predefined).cel = { id: "sfixed64.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -3075,16 +2998,9 @@ message SFixed64Rules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -3102,7 +3018,7 @@ message BoolRules { // ``` optional bool const = 1 [(predefined).cel = { id: "bool.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -3122,16 +3038,9 @@ message BoolRules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -3149,7 +3058,7 @@ message StringRules { // ``` optional string const = 1 [(predefined).cel = { id: "string.const" - expression: "this != getField(rules, 'const') ? 'value must equal `%s`'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal `%s`'.format([getField(rules, 'const')]) : ''" }]; // `len` dictates that the field value must have the specified @@ -3165,7 +3074,7 @@ message StringRules { // ``` optional uint64 len = 19 [(predefined).cel = { id: "string.len" - expression: "uint(this.size()) != rules.len ? 'value length must be %s characters'.format([rules.len]) : ''" + expression: "uint(this.size()) != rules.len ? 'must be %s characters'.format([rules.len]) : ''" }]; // `min_len` specifies that the field value must have at least the specified @@ -3181,7 +3090,7 @@ message StringRules { // ``` optional uint64 min_len = 2 [(predefined).cel = { id: "string.min_len" - expression: "uint(this.size()) < rules.min_len ? 'value length must be at least %s characters'.format([rules.min_len]) : ''" + expression: "uint(this.size()) < rules.min_len ? 'must be at least %s characters'.format([rules.min_len]) : ''" }]; // `max_len` specifies that the field value must have no more than the specified @@ -3197,7 +3106,7 @@ message StringRules { // ``` optional uint64 max_len = 3 [(predefined).cel = { id: "string.max_len" - expression: "uint(this.size()) > rules.max_len ? 'value length must be at most %s characters'.format([rules.max_len]) : ''" + expression: "uint(this.size()) > rules.max_len ? 'must be at most %s characters'.format([rules.max_len]) : ''" }]; // `len_bytes` dictates that the field value must have the specified number of @@ -3212,7 +3121,7 @@ message StringRules { // ``` optional uint64 len_bytes = 20 [(predefined).cel = { id: "string.len_bytes" - expression: "uint(bytes(this).size()) != rules.len_bytes ? 'value length must be %s bytes'.format([rules.len_bytes]) : ''" + expression: "uint(bytes(this).size()) != rules.len_bytes ? 'must be %s bytes'.format([rules.len_bytes]) : ''" }]; // `min_bytes` specifies that the field value must have at least the specified @@ -3228,11 +3137,11 @@ message StringRules { // ``` optional uint64 min_bytes = 4 [(predefined).cel = { id: "string.min_bytes" - expression: "uint(bytes(this).size()) < rules.min_bytes ? 'value length must be at least %s bytes'.format([rules.min_bytes]) : ''" + expression: "uint(bytes(this).size()) < rules.min_bytes ? 'must be at least %s bytes'.format([rules.min_bytes]) : ''" }]; // `max_bytes` specifies that the field value must have no more than the - //specified number of bytes. If the field value contains more bytes, an + // specified number of bytes. If the field value contains more bytes, an // error message will be generated. // // ```proto @@ -3243,7 +3152,7 @@ message StringRules { // ``` optional uint64 max_bytes = 5 [(predefined).cel = { id: "string.max_bytes" - expression: "uint(bytes(this).size()) > rules.max_bytes ? 'value length must be at most %s bytes'.format([rules.max_bytes]) : ''" + expression: "uint(bytes(this).size()) > rules.max_bytes ? 'must be at most %s bytes'.format([rules.max_bytes]) : ''" }]; // `pattern` specifies that the field value must match the specified @@ -3259,11 +3168,11 @@ message StringRules { // ``` optional string pattern = 6 [(predefined).cel = { id: "string.pattern" - expression: "!this.matches(rules.pattern) ? 'value does not match regex pattern `%s`'.format([rules.pattern]) : ''" + expression: "!this.matches(rules.pattern) ? 'does not match regex pattern `%s`'.format([rules.pattern]) : ''" }]; // `prefix` specifies that the field value must have the - //specified substring at the beginning of the string. If the field value + // specified substring at the beginning of the string. If the field value // doesn't start with the specified prefix, an error message will be // generated. // @@ -3275,11 +3184,11 @@ message StringRules { // ``` optional string prefix = 7 [(predefined).cel = { id: "string.prefix" - expression: "!this.startsWith(rules.prefix) ? 'value does not have prefix `%s`'.format([rules.prefix]) : ''" + expression: "!this.startsWith(rules.prefix) ? 'does not have prefix `%s`'.format([rules.prefix]) : ''" }]; // `suffix` specifies that the field value must have the - //specified substring at the end of the string. If the field value doesn't + // specified substring at the end of the string. If the field value doesn't // end with the specified suffix, an error message will be generated. // // ```proto @@ -3290,11 +3199,11 @@ message StringRules { // ``` optional string suffix = 8 [(predefined).cel = { id: "string.suffix" - expression: "!this.endsWith(rules.suffix) ? 'value does not have suffix `%s`'.format([rules.suffix]) : ''" + expression: "!this.endsWith(rules.suffix) ? 'does not have suffix `%s`'.format([rules.suffix]) : ''" }]; // `contains` specifies that the field value must have the - //specified substring anywhere in the string. If the field value doesn't + // specified substring anywhere in the string. If the field value doesn't // contain the specified substring, an error message will be generated. // // ```proto @@ -3305,11 +3214,11 @@ message StringRules { // ``` optional string contains = 9 [(predefined).cel = { id: "string.contains" - expression: "!this.contains(rules.contains) ? 'value does not contain substring `%s`'.format([rules.contains]) : ''" + expression: "!this.contains(rules.contains) ? 'does not contain substring `%s`'.format([rules.contains]) : ''" }]; // `not_contains` specifies that the field value must not have the - //specified substring anywhere in the string. If the field value contains + // specified substring anywhere in the string. If the field value contains // the specified substring, an error message will be generated. // // ```proto @@ -3320,7 +3229,7 @@ message StringRules { // ``` optional string not_contains = 23 [(predefined).cel = { id: "string.not_contains" - expression: "this.contains(rules.not_contains) ? 'value contains substring `%s`'.format([rules.not_contains]) : ''" + expression: "this.contains(rules.not_contains) ? 'contains substring `%s`'.format([rules.not_contains]) : ''" }]; // `in` specifies that the field value must be equal to one of the specified @@ -3329,13 +3238,13 @@ message StringRules { // // ```proto // message MyString { - // // value must be in list ["apple", "banana"] + // // must be in list ["apple", "banana"] // string value = 1 [(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"]; // } // ``` repeated string in = 10 [(predefined).cel = { id: "string.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` specifies that the field value cannot be equal to any @@ -3349,7 +3258,7 @@ message StringRules { // ``` repeated string not_in = 11 [(predefined).cel = { id: "string.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `WellKnown` rules provide advanced rules against common string @@ -3367,14 +3276,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid email address + // // must be a valid email address // string value = 1 [(buf.validate.field).string.email = true]; // } // ``` bool email = 12 [ (predefined).cel = { id: "string.email" - message: "value must be a valid email address" + message: "must be a valid email address" expression: "!rules.email || this == '' || this.isEmail()" }, (predefined).cel = { @@ -3399,14 +3308,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid hostname + // // must be a valid hostname // string value = 1 [(buf.validate.field).string.hostname = true]; // } // ``` bool hostname = 13 [ (predefined).cel = { id: "string.hostname" - message: "value must be a valid hostname" + message: "must be a valid hostname" expression: "!rules.hostname || this == '' || this.isHostname()" }, (predefined).cel = { @@ -3430,14 +3339,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid IP address + // // must be a valid IP address // string value = 1 [(buf.validate.field).string.ip = true]; // } // ``` bool ip = 14 [ (predefined).cel = { id: "string.ip" - message: "value must be a valid IP address" + message: "must be a valid IP address" expression: "!rules.ip || this == '' || this.isIp()" }, (predefined).cel = { @@ -3453,14 +3362,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid IPv4 address + // // must be a valid IPv4 address // string value = 1 [(buf.validate.field).string.ipv4 = true]; // } // ``` bool ipv4 = 15 [ (predefined).cel = { id: "string.ipv4" - message: "value must be a valid IPv4 address" + message: "must be a valid IPv4 address" expression: "!rules.ipv4 || this == '' || this.isIp(4)" }, (predefined).cel = { @@ -3476,14 +3385,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid IPv6 address + // // must be a valid IPv6 address // string value = 1 [(buf.validate.field).string.ipv6 = true]; // } // ``` bool ipv6 = 16 [ (predefined).cel = { id: "string.ipv6" - message: "value must be a valid IPv6 address" + message: "must be a valid IPv6 address" expression: "!rules.ipv6 || this == '' || this.isIp(6)" }, (predefined).cel = { @@ -3503,14 +3412,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid URI + // // must be a valid URI // string value = 1 [(buf.validate.field).string.uri = true]; // } // ``` bool uri = 17 [ (predefined).cel = { id: "string.uri" - message: "value must be a valid URI" + message: "must be a valid URI" expression: "!rules.uri || this == '' || this.isUri()" }, (predefined).cel = { @@ -3533,13 +3442,13 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid URI Reference + // // must be a valid URI Reference // string value = 1 [(buf.validate.field).string.uri_ref = true]; // } // ``` bool uri_ref = 18 [(predefined).cel = { id: "string.uri_ref" - message: "value must be a valid URI Reference" + message: "must be a valid URI Reference" expression: "!rules.uri_ref || this.isUriRef()" }]; @@ -3550,14 +3459,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid hostname, or ip address + // // must be a valid hostname, or ip address // string value = 1 [(buf.validate.field).string.address = true]; // } // ``` bool address = 21 [ (predefined).cel = { id: "string.address" - message: "value must be a valid hostname, or ip address" + message: "must be a valid hostname, or ip address" expression: "!rules.address || this == '' || this.isHostname() || this.isIp()" }, (predefined).cel = { @@ -3573,14 +3482,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid UUID + // // must be a valid UUID // string value = 1 [(buf.validate.field).string.uuid = true]; // } // ``` bool uuid = 22 [ (predefined).cel = { id: "string.uuid" - message: "value must be a valid UUID" + message: "must be a valid UUID" expression: "!rules.uuid || this == '' || this.matches('^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$')" }, (predefined).cel = { @@ -3597,14 +3506,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid trimmed UUID + // // must be a valid trimmed UUID // string value = 1 [(buf.validate.field).string.tuuid = true]; // } // ``` bool tuuid = 33 [ (predefined).cel = { id: "string.tuuid" - message: "value must be a valid trimmed UUID" + message: "must be a valid trimmed UUID" expression: "!rules.tuuid || this == '' || this.matches('^[0-9a-fA-F]{32}$')" }, (predefined).cel = { @@ -3621,14 +3530,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid IP with prefix length + // // must be a valid IP with prefix length // string value = 1 [(buf.validate.field).string.ip_with_prefixlen = true]; // } // ``` bool ip_with_prefixlen = 26 [ (predefined).cel = { id: "string.ip_with_prefixlen" - message: "value must be a valid IP prefix" + message: "must be a valid IP prefix" expression: "!rules.ip_with_prefixlen || this == '' || this.isIpPrefix()" }, (predefined).cel = { @@ -3645,14 +3554,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid IPv4 address with prefix length + // // must be a valid IPv4 address with prefix length // string value = 1 [(buf.validate.field).string.ipv4_with_prefixlen = true]; // } // ``` bool ipv4_with_prefixlen = 27 [ (predefined).cel = { id: "string.ipv4_with_prefixlen" - message: "value must be a valid IPv4 address with prefix length" + message: "must be a valid IPv4 address with prefix length" expression: "!rules.ipv4_with_prefixlen || this == '' || this.isIpPrefix(4)" }, (predefined).cel = { @@ -3669,14 +3578,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid IPv6 address prefix length + // // must be a valid IPv6 address prefix length // string value = 1 [(buf.validate.field).string.ipv6_with_prefixlen = true]; // } // ``` bool ipv6_with_prefixlen = 28 [ (predefined).cel = { id: "string.ipv6_with_prefixlen" - message: "value must be a valid IPv6 address with prefix length" + message: "must be a valid IPv6 address with prefix length" expression: "!rules.ipv6_with_prefixlen || this == '' || this.isIpPrefix(6)" }, (predefined).cel = { @@ -3698,14 +3607,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid IP prefix + // // must be a valid IP prefix // string value = 1 [(buf.validate.field).string.ip_prefix = true]; // } // ``` bool ip_prefix = 29 [ (predefined).cel = { id: "string.ip_prefix" - message: "value must be a valid IP prefix" + message: "must be a valid IP prefix" expression: "!rules.ip_prefix || this == '' || this.isIpPrefix(true)" }, (predefined).cel = { @@ -3727,14 +3636,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid IPv4 prefix + // // must be a valid IPv4 prefix // string value = 1 [(buf.validate.field).string.ipv4_prefix = true]; // } // ``` bool ipv4_prefix = 30 [ (predefined).cel = { id: "string.ipv4_prefix" - message: "value must be a valid IPv4 prefix" + message: "must be a valid IPv4 prefix" expression: "!rules.ipv4_prefix || this == '' || this.isIpPrefix(4, true)" }, (predefined).cel = { @@ -3756,14 +3665,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid IPv6 prefix + // // must be a valid IPv6 prefix // string value = 1 [(buf.validate.field).string.ipv6_prefix = true]; // } // ``` bool ipv6_prefix = 31 [ (predefined).cel = { id: "string.ipv6_prefix" - message: "value must be a valid IPv6 prefix" + message: "must be a valid IPv6 prefix" expression: "!rules.ipv6_prefix || this == '' || this.isIpPrefix(6, true)" }, (predefined).cel = { @@ -3773,20 +3682,20 @@ message StringRules { } ]; - // `host_and_port` specifies that the field value must be valid host/port + // `host_and_port` specifies that the field value must be a valid host/port // pair—for example, "example.com:8080". // // The host can be one of: - //- An IPv4 address in dotted decimal format—for example, "192.168.5.21". - //- An IPv6 address enclosed in square brackets—for example, "[2001:0DB8:ABCD:0012::F1]". - //- A hostname—for example, "example.com". + // - An IPv4 address in dotted decimal format—for example, "192.168.5.21". + // - An IPv6 address enclosed in square brackets—for example, "[2001:0DB8:ABCD:0012::F1]". + // - A hostname—for example, "example.com". // // The port is separated by a colon. It must be non-empty, with a decimal number // in the range of 0-65535, inclusive. bool host_and_port = 32 [ (predefined).cel = { id: "string.host_and_port" - message: "value must be a valid host (hostname or IP address) and port pair" + message: "must be a valid host (hostname or IP address) and port pair" expression: "!rules.host_and_port || this == '' || this.isHostAndPort(true)" }, (predefined).cel = { @@ -3802,14 +3711,14 @@ message StringRules { // // ```proto // message MyString { - // // value must be a valid ULID + // // must be a valid ULID // string value = 1 [(buf.validate.field).string.ulid = true]; // } // ``` bool ulid = 35 [ (predefined).cel = { id: "string.ulid" - message: "value must be a valid ULID" + message: "must be a valid ULID" expression: "!rules.ulid || this == '' || this.matches('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$')" }, (predefined).cel = { @@ -3819,13 +3728,87 @@ message StringRules { } ]; + // `protobuf_fqn` specifies that the field value must be a valid fully-qualified + // Protobuf name as defined by the [Protobuf Language Specification](https://protobuf.com/docs/language-spec). + // + // A fully-qualified Protobuf name is a dot-separated list of Protobuf identifiers, + // where each identifier starts with a letter or underscore and is followed by zero or + // more letters, underscores, or digits. + // + // Examples: "buf.validate", "google.protobuf.Timestamp", "my_package.MyMessage". + // + // Note: historically, fully-qualified Protobuf names were represented with a leading + // dot (for example, ".buf.validate.StringRules"). Modern Protobuf does not use the + // leading dot, and most fully-qualified names are represented without it. Use + // `protobuf_dot_fqn` if a leading dot is required. + // + // If the field value isn't a valid fully-qualified Protobuf name, an error message + // will be generated. + // + // ```proto + // message MyString { + // // value must be a valid fully-qualified Protobuf name + // string value = 1 [(buf.validate.field).string.protobuf_fqn = true]; + // } + // ``` + bool protobuf_fqn = 37 [ + (predefined).cel = { + id: "string.protobuf_fqn" + message: "must be a valid fully-qualified Protobuf name" + expression: "!rules.protobuf_fqn || this == '' || this.matches('^[A-Za-z_][A-Za-z_0-9]*(\\\\.[A-Za-z_][A-Za-z_0-9]*)*$')" + }, + (predefined).cel = { + id: "string.protobuf_fqn_empty" + message: "value is empty, which is not a valid fully-qualified Protobuf name" + expression: "!rules.protobuf_fqn || this != ''" + } + ]; + + // `protobuf_dot_fqn` specifies that the field value must be a valid fully-qualified + // Protobuf name with a leading dot, as defined by the + // [Protobuf Language Specification](https://protobuf.com/docs/language-spec). + // + // A fully-qualified Protobuf name with a leading dot is a dot followed by a + // dot-separated list of Protobuf identifiers, where each identifier starts with a + // letter or underscore and is followed by zero or more letters, underscores, or + // digits. + // + // Examples: ".buf.validate", ".google.protobuf.Timestamp", ".my_package.MyMessage". + // + // Note: this is the historical representation of fully-qualified Protobuf names, + // where a leading dot denotes an absolute reference. Modern Protobuf does not use + // the leading dot, and most fully-qualified names are represented without it. Most + // users will want to use `protobuf_fqn` instead. + // + // If the field value isn't a valid fully-qualified Protobuf name with a leading dot, + // an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid fully-qualified Protobuf name with a leading dot + // string value = 1 [(buf.validate.field).string.protobuf_dot_fqn = true]; + // } + // ``` + bool protobuf_dot_fqn = 38 [ + (predefined).cel = { + id: "string.protobuf_dot_fqn" + message: "must be a valid fully-qualified Protobuf name with a leading dot" + expression: "!rules.protobuf_dot_fqn || this == '' || this.matches('^\\\\.[A-Za-z_][A-Za-z_0-9]*(\\\\.[A-Za-z_][A-Za-z_0-9]*)*$')" + }, + (predefined).cel = { + id: "string.protobuf_dot_fqn_empty" + message: "value is empty, which is not a valid fully-qualified Protobuf name with a leading dot" + expression: "!rules.protobuf_dot_fqn || this != ''" + } + ]; + // `well_known_regex` specifies a common well-known pattern // defined as a regex. If the field value doesn't match the well-known // regex, an error message will be generated. // // ```proto // message MyString { - // // value must be a valid HTTP header value + // // must be a valid HTTP header value // string value = 1 [(buf.validate.field).string.well_known_regex = KNOWN_REGEX_HTTP_HEADER_VALUE]; // } // ``` @@ -3842,7 +3825,7 @@ message StringRules { KnownRegex well_known_regex = 24 [ (predefined).cel = { id: "string.well_known_regex.header_name" - message: "value must be a valid HTTP header name" + message: "must be a valid HTTP header name" expression: "rules.well_known_regex != 1 || this == '' || this.matches(!has(rules.strict) || rules.strict ?" "'^:?[0-9a-zA-Z!#$%&\\'*+-.^_|~\\x60]+$' :" @@ -3855,7 +3838,7 @@ message StringRules { }, (predefined).cel = { id: "string.well_known_regex.header_value" - message: "value must be a valid HTTP header value" + message: "must be a valid HTTP header value" expression: "rules.well_known_regex != 2 || this.matches(!has(rules.strict) || rules.strict ?" "'^[^\\u0000-\\u0008\\u000A-\\u001F\\u007F]*$' :" @@ -3895,16 +3878,9 @@ message StringRules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -3927,13 +3903,13 @@ message BytesRules { // // ```proto // message MyBytes { - // // value must be "\x01\x02\x03\x04" + // // must be "\x01\x02\x03\x04" // bytes value = 1 [(buf.validate.field).bytes.const = "\x01\x02\x03\x04"]; // } // ``` optional bytes const = 1 [(predefined).cel = { id: "bytes.const" - expression: "this != getField(rules, 'const') ? 'value must be %x'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must be %x'.format([getField(rules, 'const')]) : ''" }]; // `len` requires the field value to have the specified length in bytes. @@ -3947,7 +3923,7 @@ message BytesRules { // ``` optional uint64 len = 13 [(predefined).cel = { id: "bytes.len" - expression: "uint(this.size()) != rules.len ? 'value length must be %s bytes'.format([rules.len]) : ''" + expression: "uint(this.size()) != rules.len ? 'must be %s bytes'.format([rules.len]) : ''" }]; // `min_len` requires the field value to have at least the specified minimum @@ -3962,7 +3938,7 @@ message BytesRules { // ``` optional uint64 min_len = 2 [(predefined).cel = { id: "bytes.min_len" - expression: "uint(this.size()) < rules.min_len ? 'value length must be at least %s bytes'.format([rules.min_len]) : ''" + expression: "uint(this.size()) < rules.min_len ? 'must be at least %s bytes'.format([rules.min_len]) : ''" }]; // `max_len` requires the field value to have at most the specified maximum @@ -3971,13 +3947,13 @@ message BytesRules { // // ```proto // message MyBytes { - // // value must be at most 6 bytes. + // // must be at most 6 bytes. // optional bytes value = 1 [(buf.validate.field).bytes.max_len = 6]; // } // ``` optional uint64 max_len = 3 [(predefined).cel = { id: "bytes.max_len" - expression: "uint(this.size()) > rules.max_len ? 'value must be at most %s bytes'.format([rules.max_len]) : ''" + expression: "uint(this.size()) > rules.max_len ? 'must be at most %s bytes'.format([rules.max_len]) : ''" }]; // `pattern` requires the field value to match the specified regular @@ -3994,7 +3970,7 @@ message BytesRules { // ``` optional string pattern = 4 [(predefined).cel = { id: "bytes.pattern" - expression: "!string(this).matches(rules.pattern) ? 'value must match regex pattern `%s`'.format([rules.pattern]) : ''" + expression: "!string(this).matches(rules.pattern) ? 'must match regex pattern `%s`'.format([rules.pattern]) : ''" }]; // `prefix` requires the field value to have the specified bytes at the @@ -4009,7 +3985,7 @@ message BytesRules { // ``` optional bytes prefix = 5 [(predefined).cel = { id: "bytes.prefix" - expression: "!this.startsWith(rules.prefix) ? 'value does not have prefix %x'.format([rules.prefix]) : ''" + expression: "!this.startsWith(rules.prefix) ? 'does not have prefix %x'.format([rules.prefix]) : ''" }]; // `suffix` requires the field value to have the specified bytes at the end @@ -4024,7 +4000,7 @@ message BytesRules { // ``` optional bytes suffix = 6 [(predefined).cel = { id: "bytes.suffix" - expression: "!this.endsWith(rules.suffix) ? 'value does not have suffix %x'.format([rules.suffix]) : ''" + expression: "!this.endsWith(rules.suffix) ? 'does not have suffix %x'.format([rules.suffix]) : ''" }]; // `contains` requires the field value to have the specified bytes anywhere in @@ -4039,7 +4015,7 @@ message BytesRules { // ``` optional bytes contains = 7 [(predefined).cel = { id: "bytes.contains" - expression: "!this.contains(rules.contains) ? 'value does not contain %x'.format([rules.contains]) : ''" + expression: "!this.contains(rules.contains) ? 'does not contain %x'.format([rules.contains]) : ''" }]; // `in` requires the field value to be equal to one of the specified @@ -4054,7 +4030,7 @@ message BytesRules { // ``` repeated bytes in = 8 [(predefined).cel = { id: "bytes.in" - expression: "getField(rules, 'in').size() > 0 && !(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "getField(rules, 'in').size() > 0 && !(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to be not equal to any of the specified @@ -4070,7 +4046,7 @@ message BytesRules { // ``` repeated bytes not_in = 9 [(predefined).cel = { id: "bytes.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // WellKnown rules provide advanced rules against common byte @@ -4081,14 +4057,14 @@ message BytesRules { // // ```proto // message MyBytes { - // // value must be a valid IP address + // // must be a valid IP address // optional bytes value = 1 [(buf.validate.field).bytes.ip = true]; // } // ``` bool ip = 10 [ (predefined).cel = { id: "bytes.ip" - message: "value must be a valid IP address" + message: "must be a valid IP address" expression: "!rules.ip || this.size() == 0 || this.size() == 4 || this.size() == 16" }, (predefined).cel = { @@ -4103,14 +4079,14 @@ message BytesRules { // // ```proto // message MyBytes { - // // value must be a valid IPv4 address + // // must be a valid IPv4 address // optional bytes value = 1 [(buf.validate.field).bytes.ipv4 = true]; // } // ``` bool ipv4 = 11 [ (predefined).cel = { id: "bytes.ipv4" - message: "value must be a valid IPv4 address" + message: "must be a valid IPv4 address" expression: "!rules.ipv4 || this.size() == 0 || this.size() == 4" }, (predefined).cel = { @@ -4124,14 +4100,14 @@ message BytesRules { // If the field value doesn't meet this rule, an error message is generated. // ```proto // message MyBytes { - // // value must be a valid IPv6 address + // // must be a valid IPv6 address // optional bytes value = 1 [(buf.validate.field).bytes.ipv6 = true]; // } // ``` bool ipv6 = 12 [ (predefined).cel = { id: "bytes.ipv6" - message: "value must be a valid IPv6 address" + message: "must be a valid IPv6 address" expression: "!rules.ipv6 || this.size() == 0 || this.size() == 16" }, (predefined).cel = { @@ -4141,22 +4117,21 @@ message BytesRules { } ]; - // `uuid` ensures that the field `value` encodes the 128-bit UUID data as - // defined by [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2). - // The field must contain exactly 16 bytes - // representing the UUID. If the field value isn't a valid UUID, an error - // message will be generated. + // `uuid` ensures that the field value encodes 128-bit UUID data as defined + // by [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2). + // The field must contain exactly 16 bytes representing the UUID. If the + // field value isn't a valid UUID, an error message will be generated. // // ```proto // message MyBytes { - // // value must be a valid UUID + // // must be a valid UUID // optional bytes value = 1 [(buf.validate.field).bytes.uuid = true]; // } // ``` bool uuid = 15 [ (predefined).cel = { id: "bytes.uuid" - message: "value must be a valid UUID" + message: "must be a valid UUID" expression: "!rules.uuid || this.size() == 0 || this.size() == 16" }, (predefined).cel = { @@ -4184,16 +4159,9 @@ message BytesRules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -4216,7 +4184,7 @@ message EnumRules { // ``` optional int32 const = 1 [(predefined).cel = { id: "enum.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; // `defined_only` requires the field value to be one of the defined values for @@ -4237,8 +4205,8 @@ message EnumRules { optional bool defined_only = 2; // `in` requires the field value to be equal to one of the - //specified enum values. If the field value doesn't match any of the - //specified values, an error message is generated. + // specified enum values. If the field value doesn't match any of the + // specified values, an error message is generated. // // ```proto // enum MyEnum { @@ -4254,11 +4222,11 @@ message EnumRules { // ``` repeated int32 in = 3 [(predefined).cel = { id: "enum.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to be not equal to any of the - //specified enum values. If the field value matches one of the specified + // specified enum values. If the field value matches one of the specified // values, an error message is generated. // // ```proto @@ -4275,7 +4243,7 @@ message EnumRules { // ``` repeated int32 not_in = 4 [(predefined).cel = { id: "enum.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -4299,16 +4267,9 @@ message EnumRules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -4327,7 +4288,7 @@ message RepeatedRules { // ``` optional uint64 min_items = 1 [(predefined).cel = { id: "repeated.min_items" - expression: "uint(this.size()) < rules.min_items ? 'value must contain at least %d item(s)'.format([rules.min_items]) : ''" + expression: "uint(this.size()) < rules.min_items ? 'must contain at least %d item(s)'.format([rules.min_items]) : ''" }]; // `max_items` denotes that this field must not exceed a @@ -4343,7 +4304,7 @@ message RepeatedRules { // ``` optional uint64 max_items = 2 [(predefined).cel = { id: "repeated.max_items" - expression: "uint(this.size()) > rules.max_items ? 'value must contain no more than %s item(s)'.format([rules.max_items]) : ''" + expression: "uint(this.size()) > rules.max_items ? 'must contain no more than %s item(s)'.format([rules.max_items]) : ''" }]; // `unique` indicates that all elements in this field must @@ -4382,16 +4343,9 @@ message RepeatedRules { // cannot be unset. optional FieldRules items = 4; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -4460,23 +4414,16 @@ message MapRules { // Note that the `required` rule does not apply. Map values cannot be unset. optional FieldRules values = 5; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } // AnyRules describe rules applied exclusively to the `google.protobuf.Any` well-known type. message AnyRules { // `in` requires the field's `type_url` to be equal to one of the - //specified values. If it doesn't match any of the specified values, an error + // specified values. If it doesn't match any of the specified values, an error // message is generated. // // ```proto @@ -4489,7 +4436,7 @@ message AnyRules { // ``` repeated string in = 2; - // requires the field's type_url to be not equal to any of the specified values. If it matches any of the specified values, an error message is generated. + // `not_in` requires the field's type_url to be not equal to any of the specified values. If it matches any of the specified values, an error message is generated. // // ```proto // message MyAny { @@ -4516,7 +4463,7 @@ message DurationRules { // ``` optional google.protobuf.Duration const = 2 [(predefined).cel = { id: "duration.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { // `lt` stipulates that the field must be less than the specified value of the `google.protobuf.Duration` type, @@ -4525,7 +4472,7 @@ message DurationRules { // // ```proto // message MyDuration { - // // value must be less than 5s + // // must be less than 5s // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lt = "5s"]; // } // ``` @@ -4533,7 +4480,7 @@ message DurationRules { id: "duration.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; // `lte` indicates that the field must be less than or equal to the specified @@ -4542,7 +4489,7 @@ message DurationRules { // // ```proto // message MyDuration { - // // value must be less than or equal to 10s + // // must be less than or equal to 10s // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lte = "10s"]; // } // ``` @@ -4550,7 +4497,7 @@ message DurationRules { id: "duration.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; } oneof greater_than { @@ -4577,31 +4524,31 @@ message DurationRules { id: "duration.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "duration.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "duration.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "duration.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "duration.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -4628,31 +4575,31 @@ message DurationRules { id: "duration.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "duration.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "duration.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "duration.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "duration.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; } @@ -4663,13 +4610,13 @@ message DurationRules { // // ```proto // message MyDuration { - // // value must be in list [1s, 2s, 3s] + // // must be in list [1s, 2s, 3s] // google.protobuf.Duration value = 1 [(buf.validate.field).duration.in = ["1s", "2s", "3s"]]; // } // ``` repeated google.protobuf.Duration in = 7 [(predefined).cel = { id: "duration.in" - expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + expression: "!(this in getField(rules, 'in')) ? 'must be in list %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` denotes that the field must not be equal to @@ -4685,7 +4632,7 @@ message DurationRules { // ``` repeated google.protobuf.Duration not_in = 8 [(predefined).cel = { id: "duration.not_in" - expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + expression: "this in rules.not_in ? 'must not be in list %s'.format([rules.not_in]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -4705,16 +4652,9 @@ message DurationRules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -4734,7 +4674,7 @@ message FieldMaskRules { // ``` optional google.protobuf.FieldMask const = 1 [(predefined).cel = { id: "field_mask.const" - expression: "this.paths != getField(rules, 'const').paths ? 'value must equal paths %s'.format([getField(rules, 'const').paths]) : ''" + expression: "this.paths != getField(rules, 'const').paths ? 'must equal paths %s'.format([getField(rules, 'const').paths]) : ''" }]; // `in` requires the field value to only contain paths matching specified @@ -4753,7 +4693,7 @@ message FieldMaskRules { // ``` repeated string in = 2 [(predefined).cel = { id: "field_mask.in" - expression: "!this.paths.all(p, p in getField(rules, 'in') || getField(rules, 'in').exists(f, p.startsWith(f+'.'))) ? 'value must only contain paths in %s'.format([getField(rules, 'in')]) : ''" + expression: "!this.paths.all(p, p in getField(rules, 'in') || getField(rules, 'in').exists(f, p.startsWith(f+'.'))) ? 'must only contain paths in %s'.format([getField(rules, 'in')]) : ''" }]; // `not_in` requires the field value to not contain paths matching specified @@ -4772,7 +4712,7 @@ message FieldMaskRules { // ``` repeated string not_in = 3 [(predefined).cel = { id: "field_mask.not_in" - expression: "!this.paths.all(p, !(p in getField(rules, 'not_in') || getField(rules, 'not_in').exists(f, p.startsWith(f+'.')))) ? 'value must not contain any paths in %s'.format([getField(rules, 'not_in')]) : ''" + expression: "!this.paths.all(p, !(p in getField(rules, 'not_in') || getField(rules, 'not_in').exists(f, p.startsWith(f+'.')))) ? 'must not contain any paths in %s'.format([getField(rules, 'not_in')]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -4792,16 +4732,9 @@ message FieldMaskRules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } @@ -4817,25 +4750,25 @@ message TimestampRules { // ``` optional google.protobuf.Timestamp const = 2 [(predefined).cel = { id: "timestamp.const" - expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + expression: "this != getField(rules, 'const') ? 'must equal %s'.format([getField(rules, 'const')]) : ''" }]; oneof less_than { - // requires the duration field value to be less than the specified value (field < value). If the field value doesn't meet the required conditions, an error message is generated. + // `lt` requires the timestamp field value to be less than the specified value (field < value). If the field value doesn't meet the required conditions, an error message is generated. // // ```proto - // message MyDuration { - // // duration must be less than 'P3D' [duration.lt] - // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lt = { seconds: 259200 }]; + // message MyTimestamp { + // // timestamp must be less than '2023-01-01T00:00:00Z' [timestamp.lt] + // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.lt = { seconds: 1672444800 }]; // } // ``` google.protobuf.Timestamp lt = 3 [(predefined).cel = { id: "timestamp.lt" expression: "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" - "? 'value must be less than %s'.format([rules.lt]) : ''" + "? 'must be less than %s'.format([rules.lt]) : ''" }]; - // requires the timestamp field value to be less than or equal to the specified value (field <= value). If the field value doesn't meet the required conditions, an error message is generated. + // `lte` requires the timestamp field value to be less than or equal to the specified value (field <= value). If the field value doesn't meet the required conditions, an error message is generated. // // ```proto // message MyTimestamp { @@ -4847,20 +4780,20 @@ message TimestampRules { id: "timestamp.lte" expression: "!has(rules.gte) && !has(rules.gt) && this > rules.lte" - "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + "? 'must be less than or equal to %s'.format([rules.lte]) : ''" }]; // `lt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be less than the current time. `lt_now` can only be used with the `within` rule. // // ```proto // message MyTimestamp { - // // value must be less than now + // // must be less than now // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.lt_now = true]; // } // ``` bool lt_now = 7 [(predefined).cel = { id: "timestamp.lt_now" - expression: "(rules.lt_now && this > now) ? 'value must be less than now' : ''" + expression: "(rules.lt_now && this > now) ? 'must be less than now' : ''" }]; } oneof greater_than { @@ -4887,31 +4820,31 @@ message TimestampRules { id: "timestamp.gt" expression: "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" - "? 'value must be greater than %s'.format([rules.gt]) : ''" + "? 'must be greater than %s'.format([rules.gt]) : ''" }, (predefined).cel = { id: "timestamp.gt_lt" expression: "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" - "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "timestamp.gt_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" - "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + "? 'must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" }, (predefined).cel = { id: "timestamp.gt_lte" expression: "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" - "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" }, (predefined).cel = { id: "timestamp.gt_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" - "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + "? 'must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" } ]; @@ -4938,31 +4871,31 @@ message TimestampRules { id: "timestamp.gte" expression: "!has(rules.lt) && !has(rules.lte) && this < rules.gte" - "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + "? 'must be greater than or equal to %s'.format([rules.gte]) : ''" }, (predefined).cel = { id: "timestamp.gte_lt" expression: "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "timestamp.gte_lt_exclusive" expression: "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + "? 'must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" }, (predefined).cel = { id: "timestamp.gte_lte" expression: "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" - "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" }, (predefined).cel = { id: "timestamp.gte_lte_exclusive" expression: "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" - "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + "? 'must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" } ]; @@ -4970,13 +4903,13 @@ message TimestampRules { // // ```proto // message MyTimestamp { - // // value must be greater than now + // // must be greater than now // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.gt_now = true]; // } // ``` bool gt_now = 8 [(predefined).cel = { id: "timestamp.gt_now" - expression: "(rules.gt_now && this < now) ? 'value must be greater than now' : ''" + expression: "(rules.gt_now && this < now) ? 'must be greater than now' : ''" }]; } @@ -4984,13 +4917,13 @@ message TimestampRules { // // ```proto // message MyTimestamp { - // // value must be within 1 hour of now + // // must be within 1 hour of now // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.within = {seconds: 3600}]; // } // ``` optional google.protobuf.Duration within = 9 [(predefined).cel = { id: "timestamp.within" - expression: "this < now-rules.within || this > now+rules.within ? 'value must be within %s of now'.format([rules.within]) : ''" + expression: "this < now-rules.within || this > now+rules.within ? 'must be within %s of now'.format([rules.within]) : ''" }]; // `example` specifies values that the field may have. These values SHOULD @@ -5010,16 +4943,9 @@ message TimestampRules { expression: "true" }]; - // Extension fields in this range that have the (buf.validate.predefined) - // option set will be treated as predefined field rules that can then be - // set on the field options of other fields to apply field rules. - // Extension numbers 1000 to 99999 are reserved for extension numbers that are - // defined in the [Protobuf Global Extension Registry][1]. Extension numbers - // above this range are reserved for extension numbers that are not explicitly - // assigned. For rules defined in publicly-consumed schemas, use of extensions - // above 99999 is discouraged due to the risk of conflicts. - // - // [1]: https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ extensions 1000 to max; } diff --git a/src/test/java/build/buf/protovalidate/ValidationResultTest.java b/src/test/java/build/buf/protovalidate/ValidationResultTest.java index 801bf9411..8228b113a 100644 --- a/src/test/java/build/buf/protovalidate/ValidationResultTest.java +++ b/src/test/java/build/buf/protovalidate/ValidationResultTest.java @@ -40,7 +40,7 @@ void testToStringSingleViolation() { RuleViolation violation = RuleViolation.newBuilder() .setRuleId("int32.const") - .setMessage("value must equal 42") + .setMessage("must equal 42") .addFirstFieldPathElement(elem) .build(); List violations = new ArrayList<>(); @@ -48,7 +48,7 @@ void testToStringSingleViolation() { ValidationResult result = new ValidationResult(violations); assertThat(result.toString()) - .isEqualTo("Validation error:\n - test_field_name: value must equal 42 [int32.const]"); + .isEqualTo("Validation error:\n - test_field_name: must equal 42 [int32.const]"); } @Test @@ -59,7 +59,7 @@ void testToStringMultipleViolations() { RuleViolation violation1 = RuleViolation.newBuilder() .setRuleId("int32.const") - .setMessage("value must equal 42") + .setMessage("must equal 42") .addFirstFieldPathElement(elem) .build(); @@ -76,7 +76,7 @@ void testToStringMultipleViolations() { assertThat(result.toString()) .isEqualTo( - "Validation error:\n - test_field_name: value must equal 42 [int32.const]\n - test_field_name: value is required [int32.required]"); + "Validation error:\n - test_field_name: must equal 42 [int32.const]\n - test_field_name: value is required [int32.required]"); } @Test @@ -93,7 +93,7 @@ void testToStringSingleViolationMultipleFieldPathElements() { RuleViolation violation1 = RuleViolation.newBuilder() .setRuleId("int32.const") - .setMessage("value must equal 42") + .setMessage("must equal 42") .addAllFieldPathElements(elems) .build(); @@ -103,21 +103,17 @@ void testToStringSingleViolationMultipleFieldPathElements() { assertThat(result.toString()) .isEqualTo( - "Validation error:\n - test_field_name.nested_name: value must equal 42 [int32.const]"); + "Validation error:\n - test_field_name.nested_name: must equal 42 [int32.const]"); } @Test void testToStringSingleViolationNoFieldPathElements() { RuleViolation violation = - RuleViolation.newBuilder() - .setRuleId("int32.const") - .setMessage("value must equal 42") - .build(); + RuleViolation.newBuilder().setRuleId("int32.const").setMessage("must equal 42").build(); List violations = new ArrayList<>(); violations.add(violation); ValidationResult result = new ValidationResult(violations); - assertThat(result.toString()) - .isEqualTo("Validation error:\n - value must equal 42 [int32.const]"); + assertThat(result.toString()).isEqualTo("Validation error:\n - must equal 42 [int32.const]"); } } diff --git a/src/test/java/build/buf/protovalidate/ValidatorConstructionTest.java b/src/test/java/build/buf/protovalidate/ValidatorConstructionTest.java index 75e51a96e..c4a02bc73 100644 --- a/src/test/java/build/buf/protovalidate/ValidatorConstructionTest.java +++ b/src/test/java/build/buf/protovalidate/ValidatorConstructionTest.java @@ -193,7 +193,7 @@ public void testConfigApplied() throws ValidationException { assertThat(result.isSuccess()).isFalse(); assertThat(result.getViolations().size()).isEqualTo(1); assertThat(result.getViolations().get(0).toProto().getMessage()) - .isEqualTo("value length must be at most 5 characters"); + .isEqualTo("must be at most 5 characters"); } // Tests that the config is applied when building a validator with seed descriptors. @@ -214,6 +214,6 @@ public void testConfigAppliedWithSeedDescriptors() throws ValidationException { assertThat(result.isSuccess()).isFalse(); assertThat(result.getViolations().size()).isEqualTo(1); assertThat(result.getViolations().get(0).toProto().getMessage()) - .isEqualTo("value length must be at most 5 characters"); + .isEqualTo("must be at most 5 characters"); } } diff --git a/src/test/java/build/buf/protovalidate/ValidatorDifferentJavaPackagesTest.java b/src/test/java/build/buf/protovalidate/ValidatorDifferentJavaPackagesTest.java index 6c2843419..dc7b30f84 100644 --- a/src/test/java/build/buf/protovalidate/ValidatorDifferentJavaPackagesTest.java +++ b/src/test/java/build/buf/protovalidate/ValidatorDifferentJavaPackagesTest.java @@ -99,7 +99,7 @@ public void testValidationFieldRules() throws Exception { StringRules.getDescriptor() .findFieldByNumber(StringRules.PATTERN_FIELD_NUMBER)))) .setRuleId("string.pattern") - .setMessage("value does not match regex pattern `^[a-z0-9]{1,9}$`") + .setMessage("does not match regex pattern `^[a-z0-9]{1,9}$`") .build(); expectViolation(invalidMsgImports, expectedViolation); diff --git a/src/test/java/build/buf/protovalidate/ValidatorDynamicMessageTest.java b/src/test/java/build/buf/protovalidate/ValidatorDynamicMessageTest.java index e5ba50abb..ff9fc5f81 100644 --- a/src/test/java/build/buf/protovalidate/ValidatorDynamicMessageTest.java +++ b/src/test/java/build/buf/protovalidate/ValidatorDynamicMessageTest.java @@ -76,7 +76,7 @@ public void testFieldRuleDynamicMessage() throws Exception { StringRules.getDescriptor() .findFieldByNumber(StringRules.PATTERN_FIELD_NUMBER)))) .setRuleId("string.pattern") - .setMessage("value does not match regex pattern `^[a-z0-9]{1,9}$`") + .setMessage("does not match regex pattern `^[a-z0-9]{1,9}$`") .build(); ValidationResult result = ValidatorFactory.newBuilder().build().validate(messageBuilder.build()); @@ -165,7 +165,7 @@ public void testRequiredFieldRuleDynamicMessageInvalid() throws Exception { StringRules.getDescriptor() .findFieldByNumber(StringRules.PATTERN_FIELD_NUMBER)))) .setRuleId("string.pattern") - .setMessage("value does not match regex pattern `^[a-z0-9]{1,9}$`") + .setMessage("does not match regex pattern `^[a-z0-9]{1,9}$`") .build(); assertThat( ValidatorFactory.newBuilder()