Skip to content

Commit

Permalink
Update bytes.pattern doc clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
rodaine authored Oct 17, 2024
1 parent 3f80b76 commit a3d20ef
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions proto/protovalidate/buf/validate/validate.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit a3d20ef

Please sign in to comment.