Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion examples/cel_field_selection.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ service ApartmentService {

message SearchApartmentRequest {
option (buf.validate.message).cel = {
id: "secondary_address_after_primary_address"
id: "min_bedrooms_lte_max_bedrooms"
message: "the minimum number of bedrooms cannot be higher than the maximum number"
// In a message-level constraint, `this` refers to the message itself, the `SearchApartmentRequest`.
// You can access a field with `this.field_name`.
Expand Down
2 changes: 1 addition & 1 deletion examples/cel_repeated_field_exists_one.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ message TeamRoster {

message Player {
string name = 1;
uint32 jersy_number = 2;
uint32 jersey_number = 2;
}

repeated Player players = 1;
Expand Down
4 changes: 2 additions & 2 deletions examples/cel_string_is_ip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ service LocationService {
message LocationForIpRequest {
string ip_address = 1 [(buf.validate.field).cel = {
id: "valid_address"
message: "."
message: "ip_address must be a valid IP address"
// `some_string.isIp()` returns whether the string is a valid ip address.
// `isIp(4)` returns whether a string is an ipv4 address.
// `isIp(6)` returns whether a string is an ipv6 address.
Expand All @@ -41,7 +41,7 @@ message LocationForIpResponse {
message LocationForIpPrefixRequest {
string ip_prefix = 1 [(buf.validate.field).cel = {
id: "valid_prefix"
message: "."
message: "ip_prefix must be a valid IP with prefix length"
// `some_string.isIpPrefix()` returns whether the string is a valid ip with prefix length.
// `isIpPrefix(4)` returns whether a string is an ipv4 with prefix length.
// `isIpPrefix(6)` returns whether a string is an ipv6 with prefix length.
Expand Down
6 changes: 3 additions & 3 deletions examples/cel_wrapper_type.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ message SearchStoreRequest {
// term is the search term
google.protobuf.StringValue term = 1 [(buf.validate.field).cel = {
id: "search_term_length"
message: "search term must be not exceed 100 characters"
message: "search term must not exceed 100 characters"
// This validates that _if_ term is specified, it must be shorter than 100
// characters long.
// This rule is only evaluated when this field is specified, because
Expand All @@ -69,8 +69,8 @@ message SearchStoreRequest {
google.protobuf.BoolValue in_stock = 3;
// min_price is the minimum price that the search results should have.
google.protobuf.FloatValue min_price = 4 [(buf.validate.field).cel = {
id: "min_price_finite"
message: "min_price_must_be_positive"
id: "min_price_positive"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A positive infinite value will pass this rule, so the id min_price_finite was off. Took the liberty to push up 5be5968 to rename to min_price_positive

message: "minimum price must be positive"
// This validates that _if_ min_price is specified, it must be greater than 0.
// This rule is only evaluated when this field is specified, because
// google.protobuf.FloatValue is a message type, and CEL rules are evaluated
Expand Down
Loading