diff --git a/gradle.properties b/gradle.properties index 2a546cec..d9e13df0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Version of buf.build/bufbuild/protovalidate to use. -protovalidate.version = v0.14.2 +protovalidate.version = v1.0.0 # Arguments to the protovalidate-conformance CLI protovalidate.conformance.args = --strict_message --strict_error --expected_failures=expected-failures.yaml diff --git a/src/main/resources/buf/validate/validate.proto b/src/main/resources/buf/validate/validate.proto index f7453d30..519545dd 100644 --- a/src/main/resources/buf/validate/validate.proto +++ b/src/main/resources/buf/validate/validate.proto @@ -243,7 +243,8 @@ message FieldRules { // the fields are set and valid. // // Fields that don't track presence are always validated by Protovalidate, - // whether they are set or not. It is not necessary to add `required`: + // whether they are set or not. It is not necessary to add `required`. It + // can be added to indicate that the field cannot be the zero value. // // ```proto // syntax="proto3"; @@ -254,9 +255,14 @@ message FieldRules { // (buf.validate.field).string.email = true // ]; // // `repeated.min_items` always applies, even to an empty list. - // repeated string labels = 4 [ + // repeated string labels = 2 [ // (buf.validate.field).repeated.min_items = 1 // ]; + // // `required`, for fields that don't track presence, indicates + // // the value of the field can't be the zero value. + // int32 zero_value_not_allowed = 3 [ + // (buf.validate.field).required = true + // ]; // } // ``` // @@ -419,7 +425,8 @@ enum Ignore { // // The field's rules will always be ignored, including any validations // // on value's fields. // MyOtherMessage value = 1 [ - // (buf.validate.field).ignore = IGNORE_ALWAYS]; + // (buf.validate.field).ignore = IGNORE_ALWAYS + // ]; // } // ``` IGNORE_ALWAYS = 3;