From a3d20ef7e19c87f5848e3626a7e984810d7106d0 Mon Sep 17 00:00:00 2001 From: Chris Roche Date: Thu, 17 Oct 2024 11:04:40 -0700 Subject: [PATCH 1/2] Update bytes.pattern doc clarity --- proto/protovalidate/buf/validate/validate.proto | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proto/protovalidate/buf/validate/validate.proto b/proto/protovalidate/buf/validate/validate.proto index 7236347..a66017c 100644 --- a/proto/protovalidate/buf/validate/validate.proto +++ b/proto/protovalidate/buf/validate/validate.proto @@ -3829,14 +3829,15 @@ message BytesRules { // `pattern` requires the field value to match the specified regular // expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)). - // The value of the field must be valid UTF-8 or validation will fail with a - // runtime error. + // The pattern must be valid UTF-8 or validation will fail with a runtime + // error. Use escape sequences to specify non-UTF-8 octets. + // // If the field value doesn't match the pattern, an error message is generated. // // ```proto // message MyBytes { - // // value must match regex pattern "^[a-zA-Z0-9]+$". - // optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9]+$"]; + // // value must match regex pattern "^[^\\x00-\\x08\\x0A-\\x1F\\x7F]*$". + // optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[^\\x00-\\x08\\x0A-\\x1F\\x7F]*$"]; // } // ``` optional string pattern = 4 [(predefined).cel = { From 7f2007348969e5aa7a2c6bb7234eb4656cd1e63c Mon Sep 17 00:00:00 2001 From: Chris Roche Date: Thu, 17 Oct 2024 12:28:08 -0700 Subject: [PATCH 2/2] Update validate.proto --- proto/protovalidate/buf/validate/validate.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/protovalidate/buf/validate/validate.proto b/proto/protovalidate/buf/validate/validate.proto index a66017c..5904a75 100644 --- a/proto/protovalidate/buf/validate/validate.proto +++ b/proto/protovalidate/buf/validate/validate.proto @@ -3829,7 +3829,7 @@ message BytesRules { // `pattern` requires the field value to match the specified regular // expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)). - // The pattern must be valid UTF-8 or validation will fail with a runtime + // The pattern must be valid UTF-8 or validation will fail with a runtime // error. Use escape sequences to specify non-UTF-8 octets. // // If the field value doesn't match the pattern, an error message is generated.