Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bytes.pattern doc clarity #266

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading