Skip to content

Commit d0efa63

Browse files
authored
Clarify rule string.uri_ref (#305)
1 parent d7e9a0d commit d0efa63

File tree

2 files changed

+943
-930
lines changed

2 files changed

+943
-930
lines changed

proto/protovalidate/buf/validate/validate.proto

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,9 +3392,10 @@ message StringRules {
33923392
}
33933393
];
33943394

3395-
// `uri` specifies that the field value must be a valid,
3396-
// absolute URI as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3). If the field value isn't a valid,
3397-
// absolute URI, an error message will be generated.
3395+
// `uri` specifies that the field value must be a valid URI as defined by
3396+
// [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3).
3397+
//
3398+
// If the field value isn't a valid URI, an error message will be generated.
33983399
//
33993400
// ```proto
34003401
// message MyString {
@@ -3415,19 +3416,24 @@ message StringRules {
34153416
}
34163417
];
34173418

3418-
// `uri_ref` specifies that the field value must be a valid URI
3419-
// as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3) and may be either relative or absolute. If the
3420-
// field value isn't a valid URI, an error message will be generated.
3419+
// `uri_ref` specifies that the field value must be a valid URI Reference as
3420+
// defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-4.1).
3421+
//
3422+
// A URI Reference is either a [URI](https://tools.ietf.org/html/rfc3986#section-3),
3423+
// or a [Relative Reference](https://tools.ietf.org/html/rfc3986#section-4.2).
3424+
//
3425+
// If the field value isn't a valid URI Reference, an error message will be
3426+
// generated.
34213427
//
34223428
// ```proto
34233429
// message MyString {
3424-
// // value must be a valid URI
3430+
// // value must be a valid URI Reference
34253431
// string value = 1 [(buf.validate.field).string.uri_ref = true];
34263432
// }
34273433
// ```
34283434
bool uri_ref = 18 [(predefined).cel = {
34293435
id: "string.uri_ref"
3430-
message: "value must be a valid URI"
3436+
message: "value must be a valid URI Reference"
34313437
expression: "!rules.uri_ref || this.isUriRef()"
34323438
}];
34333439

0 commit comments

Comments
 (0)