From 9d927da810340b6c533a15731acada26de26fbea Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Wed, 16 Oct 2024 14:57:49 -0400 Subject: [PATCH 01/14] Add rule path to Violation message --- proto/protovalidate/buf/validate/validate.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proto/protovalidate/buf/validate/validate.proto b/proto/protovalidate/buf/validate/validate.proto index 7236347a..a0719290 100644 --- a/proto/protovalidate/buf/validate/validate.proto +++ b/proto/protovalidate/buf/validate/validate.proto @@ -4774,6 +4774,11 @@ message Violation { // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. optional string field_path = 1; + // `rule_path` is a machine-readable identifier that points to the specific constraint rule that failed validation. + // This will be a nested field starting from the options of the field that failed validation. + // This value is only present for standard or predefined rules on fields. + optional string rule_path = 5; + // `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. // This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated. optional string constraint_id = 2; From c02b7db4e9ec67334bbae23c79f7899c0260789a Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Wed, 16 Oct 2024 15:03:51 -0400 Subject: [PATCH 02/14] `make generate` --- .../internal/gen/buf/validate/validate.pb.go | 129 ++++++++++-------- 1 file changed, 71 insertions(+), 58 deletions(-) diff --git a/tools/internal/gen/buf/validate/validate.pb.go b/tools/internal/gen/buf/validate/validate.pb.go index 519fc020..e46fe3b1 100644 --- a/tools/internal/gen/buf/validate/validate.pb.go +++ b/tools/internal/gen/buf/validate/validate.pb.go @@ -6769,6 +6769,10 @@ type Violation struct { // `field_path` is a machine-readable identifier that points to the specific field that failed the validation. // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. FieldPath *string `protobuf:"bytes,1,opt,name=field_path,json=fieldPath" json:"field_path,omitempty"` + // `rule_path` is a machine-readable identifier that points to the specific constraint rule that failed validation. + // This will be a nested field starting from the options of the field that failed validation. + // This value is only present for standard or predefined rules on fields. + RulePath *string `protobuf:"bytes,5,opt,name=rule_path,json=rulePath" json:"rule_path,omitempty"` // `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. // This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated. ConstraintId *string `protobuf:"bytes,2,opt,name=constraint_id,json=constraintId" json:"constraint_id,omitempty"` @@ -6818,6 +6822,13 @@ func (x *Violation) GetFieldPath() string { return "" } +func (x *Violation) GetRulePath() string { + if x != nil && x.RulePath != nil { + return *x.RulePath + } + return "" +} + func (x *Violation) GetConstraintId() string { if x != nil && x.ConstraintId != nil { return *x.ConstraintId @@ -10217,66 +10228,68 @@ var file_buf_validate_validate_proto_rawDesc = []byte{ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x22, 0x82, 0x01, 0x0a, 0x09, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, + 0x22, 0x9f, 0x01, 0x0a, 0x09, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x12, 0x23, 0x0a, - 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, - 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, - 0x66, 0x6f, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, - 0x6f, 0x72, 0x4b, 0x65, 0x79, 0x2a, 0x9d, 0x01, 0x0a, 0x06, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, - 0x12, 0x16, 0x0a, 0x12, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x49, 0x47, 0x4e, 0x4f, - 0x52, 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x55, 0x4e, 0x50, 0x4f, 0x50, 0x55, 0x4c, 0x41, 0x54, 0x45, - 0x44, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x49, 0x46, - 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x02, - 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x41, 0x4c, 0x57, 0x41, 0x59, - 0x53, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x0c, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x45, 0x4d, - 0x50, 0x54, 0x59, 0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x16, 0x0a, 0x0e, 0x49, 0x47, 0x4e, - 0x4f, 0x52, 0x45, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x02, 0x1a, 0x02, 0x08, - 0x01, 0x1a, 0x02, 0x10, 0x01, 0x2a, 0x6e, 0x0a, 0x0a, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, - 0x67, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x17, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, - 0x45, 0x58, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x20, 0x0a, 0x1c, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, - 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x4e, 0x41, 0x4d, 0x45, - 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, - 0x58, 0x5f, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x56, 0x41, - 0x4c, 0x55, 0x45, 0x10, 0x02, 0x3a, 0x5c, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, - 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x3a, 0x54, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x1d, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, - 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, - 0x74, 0x73, 0x52, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x3a, 0x54, 0x0a, 0x05, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, - 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x3a, - 0x63, 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x1d, 0x2e, + 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, + 0x09, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x72, 0x75, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, + 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x49, 0x64, 0x12, + 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x6f, 0x72, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x4b, + 0x65, 0x79, 0x2a, 0x9d, 0x01, 0x0a, 0x06, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x12, 0x16, 0x0a, + 0x12, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, + 0x49, 0x46, 0x5f, 0x55, 0x4e, 0x50, 0x4f, 0x50, 0x55, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, + 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x44, 0x45, + 0x46, 0x41, 0x55, 0x4c, 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x12, 0x11, 0x0a, + 0x0d, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x41, 0x4c, 0x57, 0x41, 0x59, 0x53, 0x10, 0x03, + 0x12, 0x14, 0x0a, 0x0c, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x45, 0x4d, 0x50, 0x54, 0x59, + 0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x16, 0x0a, 0x0e, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, + 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x02, 0x1a, 0x02, 0x08, 0x01, 0x1a, 0x02, + 0x10, 0x01, 0x2a, 0x6e, 0x0a, 0x0a, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x67, 0x65, 0x78, + 0x12, 0x1b, 0x0a, 0x17, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x20, 0x0a, + 0x1c, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x48, 0x54, 0x54, + 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, + 0x21, 0x0a, 0x1d, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x48, + 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, + 0x10, 0x02, 0x3a, 0x5c, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, - 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, - 0x69, 0x6e, 0x65, 0x64, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, - 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x42, 0x0d, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x66, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x74, 0x6f, - 0x6f, 0x6c, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, - 0x2f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xa2, 0x02, 0x03, - 0x42, 0x56, 0x58, 0xaa, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0xca, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0xe2, 0x02, 0x18, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x42, - 0x75, 0x66, 0x3a, 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, + 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x73, + 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x3a, 0x54, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, + 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4f, + 0x6e, 0x65, 0x6f, 0x66, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, + 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x3a, 0x54, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, + 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, + 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, + 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x3a, 0x63, 0x0a, 0x0a, + 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x09, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x23, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, + 0x50, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, + 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, + 0x64, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x42, 0x0d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x66, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x74, 0x6f, 0x6f, 0x6c, 0x73, + 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x62, 0x75, + 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x42, 0x56, 0x58, + 0xaa, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xca, + 0x02, 0x0c, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xe2, 0x02, + 0x18, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x42, 0x75, 0x66, 0x3a, + 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, } var ( From f62467743393b3b95fea73b62d1b22a8f00bce0f Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Tue, 22 Oct 2024 11:31:17 -0400 Subject: [PATCH 03/14] Update `rule_path` comment --- proto/protovalidate/buf/validate/validate.proto | 4 ++-- tools/internal/gen/buf/validate/validate.pb.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/proto/protovalidate/buf/validate/validate.proto b/proto/protovalidate/buf/validate/validate.proto index a0719290..b7ec1e7b 100644 --- a/proto/protovalidate/buf/validate/validate.proto +++ b/proto/protovalidate/buf/validate/validate.proto @@ -4775,8 +4775,8 @@ message Violation { optional string field_path = 1; // `rule_path` is a machine-readable identifier that points to the specific constraint rule that failed validation. - // This will be a nested field starting from the options of the field that failed validation. - // This value is only present for standard or predefined rules on fields. + // This will be a nested field starting from the FieldConstraints of the field that failed validation. + // This value is not present when there is no corresponding rule field, e.g. for custom constraints. optional string rule_path = 5; // `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. diff --git a/tools/internal/gen/buf/validate/validate.pb.go b/tools/internal/gen/buf/validate/validate.pb.go index e46fe3b1..4cc6a2d0 100644 --- a/tools/internal/gen/buf/validate/validate.pb.go +++ b/tools/internal/gen/buf/validate/validate.pb.go @@ -6770,8 +6770,8 @@ type Violation struct { // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. FieldPath *string `protobuf:"bytes,1,opt,name=field_path,json=fieldPath" json:"field_path,omitempty"` // `rule_path` is a machine-readable identifier that points to the specific constraint rule that failed validation. - // This will be a nested field starting from the options of the field that failed validation. - // This value is only present for standard or predefined rules on fields. + // This will be a nested field starting from the FieldConstraints of the field that failed validation. + // This value is not present when there is no corresponding rule field, e.g. for custom constraints. RulePath *string `protobuf:"bytes,5,opt,name=rule_path,json=rulePath" json:"rule_path,omitempty"` // `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. // This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated. From d4a7f0bc6fa7c8decffa5b57cb14cc6dc22c9276 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Tue, 22 Oct 2024 11:31:33 -0400 Subject: [PATCH 04/14] Add rule path to conformance test suite --- .../internal/cases/cases_any.go | 28 +- .../internal/cases/cases_bool.go | 14 +- .../internal/cases/cases_bytes.go | 51 +- .../internal/cases/cases_double.go | 205 ++- .../internal/cases/cases_duration.go | 21 + .../internal/cases/cases_enum.go | 64 +- .../internal/cases/cases_fixed32.go | 140 +- .../internal/cases/cases_fixed64.go | 140 +- .../internal/cases/cases_float.go | 221 ++- .../internal/cases/cases_ignore.go | 1450 +++++++++++++---- .../internal/cases/cases_ignore_empty.go | 268 ++- .../internal/cases/cases_int32.go | 140 +- .../internal/cases/cases_int64.go | 140 +- .../internal/cases/cases_kitchensink.go | 48 + .../internal/cases/cases_map.go | 12 + .../internal/cases/cases_message.go | 8 + .../internal/cases/cases_nested.go | 1 + .../internal/cases/cases_oneof.go | 51 +- .../internal/cases/cases_predefined.go | 125 ++ .../internal/cases/cases_repeated.go | 27 + .../internal/cases/cases_required.go | 192 ++- .../internal/cases/cases_sfixed32.go | 19 + .../internal/cases/cases_sfixed64.go | 19 + .../internal/cases/cases_sint32.go | 140 +- .../internal/cases/cases_sint64.go | 140 +- .../internal/cases/cases_strings.go | 810 +++++++-- .../internal/cases/cases_timestamp.go | 208 ++- .../internal/cases/cases_uint32.go | 140 +- .../internal/cases/cases_uint64.go | 140 +- .../internal/cases/cases_wrapper.go | 17 +- .../internal/results/result.go | 9 +- 31 files changed, 4112 insertions(+), 876 deletions(-) diff --git a/tools/protovalidate-conformance/internal/cases/cases_any.go b/tools/protovalidate-conformance/internal/cases/cases_any.go index 68ba8ec2..e0439009 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_any.go +++ b/tools/protovalidate-conformance/internal/cases/cases_any.go @@ -60,12 +60,22 @@ func anySuite() suites.Suite { "in/invalid/known": { Message: &cases.AnyIn{Val: tsAny}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("any.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("any.in"), + ConstraintId: proto.String("any.in"), + }, + ), }, "in/invalid/unknown": { Message: &cases.AnyIn{Val: fooAny}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("any.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("any.in"), + ConstraintId: proto.String("any.in"), + }, + ), }, "not_in/valid/known": { Message: &cases.AnyNotIn{Val: durAny}, @@ -82,7 +92,12 @@ func anySuite() suites.Suite { "not_in/invalid/known": { Message: &cases.AnyNotIn{Val: tsAny}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("any.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("any.not_in"), + ConstraintId: proto.String("any.not_in"), + }, + ), }, "required/valid/known": { Message: &cases.AnyRequired{Val: tsAny}, @@ -95,7 +110,12 @@ func anySuite() suites.Suite { "require/invalid": { Message: &cases.AnyRequired{}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }, + ), }, } } diff --git a/tools/protovalidate-conformance/internal/cases/cases_bool.go b/tools/protovalidate-conformance/internal/cases/cases_bool.go index e7b85890..2151fcab 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_bool.go +++ b/tools/protovalidate-conformance/internal/cases/cases_bool.go @@ -35,7 +35,12 @@ func boolSuite() suites.Suite { "const/true/invalid": { Message: &cases.BoolConstTrue{Val: false}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("bool.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("bool.const"), + ConstraintId: proto.String("bool.const"), + }, + ), }, "const/false/valid": { Message: &cases.BoolConstFalse{Val: false}, @@ -44,7 +49,12 @@ func boolSuite() suites.Suite { "const/false/invalid": { Message: &cases.BoolConstFalse{Val: true}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("bool.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("bool.const"), + ConstraintId: proto.String("bool.const"), + }, + ), }, "example/valid": { Message: &cases.BoolExample{Val: true}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_bytes.go b/tools/protovalidate-conformance/internal/cases/cases_bytes.go index 8d40e541..6d1e625b 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_bytes.go +++ b/tools/protovalidate-conformance/internal/cases/cases_bytes.go @@ -35,7 +35,12 @@ func bytesSuite() suites.Suite { "const/invalid": { Message: &cases.BytesConst{Val: []byte("bar")}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("bytes.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("bytes.const"), + ConstraintId: proto.String("bytes.const"), + }, + ), }, "in/valid": { Message: &cases.BytesIn{Val: []byte("bar")}, @@ -44,7 +49,12 @@ func bytesSuite() suites.Suite { "in/invalid": { Message: &cases.BytesIn{Val: []byte("quux")}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("bytes.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("bytes.in"), + ConstraintId: proto.String("bytes.in"), + }, + ), }, "not_in/valid": { Message: &cases.BytesNotIn{Val: []byte("quux")}, @@ -53,7 +63,12 @@ func bytesSuite() suites.Suite { "not_in/invalid": { Message: &cases.BytesNotIn{Val: []byte("fizz")}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("bytes.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("bytes.not_in"), + ConstraintId: proto.String("bytes.not_in"), + }, + ), }, "len/valid": { Message: &cases.BytesLen{Val: []byte("baz")}, @@ -62,12 +77,22 @@ func bytesSuite() suites.Suite { "len/invalid/less": { Message: &cases.BytesLen{Val: []byte("go")}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("bytes.len")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("bytes.len"), + ConstraintId: proto.String("bytes.len"), + }, + ), }, "len/invalid/greater": { Message: &cases.BytesLen{Val: []byte("fizz")}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("bytes.len")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("bytes.len"), + ConstraintId: proto.String("bytes.len"), + }, + ), }, "min_len/valid/equal": { Message: &cases.BytesMinLen{Val: []byte("baz")}, @@ -81,6 +106,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesMinLen{Val: []byte("go")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.min_len"), ConstraintId: proto.String("bytes.min_len"), Message: proto.String("value length must be at least 3 bytes"), }), @@ -97,6 +123,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesMaxLen{Val: []byte("1234567890")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.max_len"), ConstraintId: proto.String("bytes.max_len"), Message: proto.String("value must be at most 5 bytes"), }), @@ -117,6 +144,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesMinMaxLen{Val: []byte("go")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.min_len"), ConstraintId: proto.String("bytes.min_len"), Message: proto.String("value length must be at least 3 bytes"), }), @@ -125,6 +153,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesMinMaxLen{Val: []byte("validate")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.max_len"), ConstraintId: proto.String("bytes.max_len"), Message: proto.String("value must be at most 5 bytes"), }), @@ -137,6 +166,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesEqualMinMaxLen{Val: []byte("validate")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.max_len"), ConstraintId: proto.String("bytes.max_len"), Message: proto.String("value must be at most 5 bytes"), }), @@ -149,6 +179,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesPattern{Val: []byte("你好你好")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.pattern"), ConstraintId: proto.String("bytes.pattern"), Message: proto.String("value must match regex pattern `^[\\x00-\\x7F]+$`"), }), @@ -157,6 +188,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesPattern{Val: []byte("")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.pattern"), ConstraintId: proto.String("bytes.pattern"), Message: proto.String("value must match regex pattern `^[\\x00-\\x7F]+$`"), }), @@ -177,6 +209,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesPrefix{Val: []byte("bar")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.prefix"), ConstraintId: proto.String("bytes.prefix"), Message: proto.String("value does not have prefix 99"), }), @@ -193,6 +226,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesContains{Val: []byte("candy bazs")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.contains"), ConstraintId: proto.String("bytes.contains"), Message: proto.String("value does not contain 626172"), }), @@ -209,6 +243,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesSuffix{Val: []byte("foobar")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.suffix"), ConstraintId: proto.String("bytes.suffix"), Message: proto.String("value does not have suffix 62757a7a"), }), @@ -217,6 +252,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesSuffix{Val: []byte("FooBaz")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.suffix"), ConstraintId: proto.String("bytes.suffix"), Message: proto.String("value does not have suffix 62757a7a"), }), @@ -233,6 +269,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesIP{Val: []byte("foobar")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.ip"), ConstraintId: proto.String("bytes.ip"), Message: proto.String("value must be a valid IP address"), }), @@ -249,6 +286,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesIPv4{Val: []byte("foobar")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.ipv4"), ConstraintId: proto.String("bytes.ipv4"), Message: proto.String("value must be a valid IPv4 address"), }), @@ -261,6 +299,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesIPv4{Val: []byte("\x20\x01\x0D\xB8\x85\xA3\x00\x00\x00\x00\x8A\x2E\x03\x70\x73\x34")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.ipv4"), ConstraintId: proto.String("bytes.ipv4"), Message: proto.String("value must be a valid IPv4 address"), }), @@ -273,6 +312,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesIPv6{Val: []byte("fooar")}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.ipv6"), ConstraintId: proto.String("bytes.ipv6"), Message: proto.String("value must be a valid IPv6 address"), }), @@ -285,6 +325,7 @@ func bytesSuite() suites.Suite { Message: &cases.BytesIPv6{Val: []byte{0xC0, 0xA8, 0x00, 0x01}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.ipv6"), ConstraintId: proto.String("bytes.ipv6"), }), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_double.go b/tools/protovalidate-conformance/internal/cases/cases_double.go index 1befedce..cf46d192 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_double.go +++ b/tools/protovalidate-conformance/internal/cases/cases_double.go @@ -37,12 +37,22 @@ func doubleSuite() suites.Suite { "const/invalid": { Message: &cases.DoubleConst{Val: 4.56}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.const"), + ConstraintId: proto.String("double.const"), + }, + ), }, "const/invalid_nan": { Message: &cases.DoubleConst{Val: math.NaN()}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.const"), + ConstraintId: proto.String("double.const"), + }, + ), }, "in/valid": { Message: &cases.DoubleIn{Val: 7.89}, @@ -51,12 +61,22 @@ func doubleSuite() suites.Suite { "in/invalid": { Message: &cases.DoubleIn{Val: 10.11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.in"), + ConstraintId: proto.String("double.in"), + }, + ), }, "in/invalid_nan": { Message: &cases.DoubleIn{Val: math.NaN()}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.in"), + ConstraintId: proto.String("double.in"), + }, + ), }, "not_in/valid": { Message: &cases.DoubleNotIn{Val: 1}, @@ -69,7 +89,12 @@ func doubleSuite() suites.Suite { "not_in/invalid": { Message: &cases.DoubleNotIn{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.not_in"), + ConstraintId: proto.String("double.not_in"), + }, + ), }, "lt/valid/less": { Message: &cases.DoubleLT{Val: -1}, @@ -78,17 +103,32 @@ func doubleSuite() suites.Suite { "lt/invalid/equal": { Message: &cases.DoubleLT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.lt"), + ConstraintId: proto.String("double.lt"), + }, + ), }, "lt/invalid/greater": { Message: &cases.DoubleLT{Val: 1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.lt"), + ConstraintId: proto.String("double.lt"), + }, + ), }, "lt/invalid/nan": { Message: &cases.DoubleLT{Val: math.NaN()}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.lt"), + ConstraintId: proto.String("double.lt"), + }, + ), }, "lte/valid/less": { Message: &cases.DoubleLTE{Val: 63}, @@ -101,12 +141,22 @@ func doubleSuite() suites.Suite { "lte/invalid/greater": { Message: &cases.DoubleLTE{Val: 65}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.lte"), + ConstraintId: proto.String("double.lte"), + }, + ), }, "lte/invalid/nan": { Message: &cases.DoubleLTE{Val: math.NaN()}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.lte"), + ConstraintId: proto.String("double.lte"), + }, + ), }, "gt/valid/greater": { Message: &cases.DoubleGT{Val: 17}, @@ -115,17 +165,32 @@ func doubleSuite() suites.Suite { "gt/invalid/equal": { Message: &cases.DoubleGT{Val: 16}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt"), + }, + ), }, "gt/invalid/less": { Message: &cases.DoubleGT{Val: 15}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt"), + }, + ), }, "gt/invalid/nan": { Message: &cases.DoubleGT{Val: math.NaN()}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt"), + }, + ), }, "gte/valid/greater": { Message: &cases.DoubleGTE{Val: 9}, @@ -138,12 +203,22 @@ func doubleSuite() suites.Suite { "gte/invalid/less": { Message: &cases.DoubleGTE{Val: 7}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gte"), + ConstraintId: proto.String("double.gte"), + }, + ), }, "gte/invalid/nan": { Message: &cases.DoubleGTE{Val: math.NaN()}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gte"), + ConstraintId: proto.String("double.gte"), + }, + ), }, "gt_lt/inclusive/valid/within": { Message: &cases.DoubleGTLT{Val: 5}, @@ -152,22 +227,42 @@ func doubleSuite() suites.Suite { "gt_lt/inclusive/invalid/above": { Message: &cases.DoubleGTLT{Val: 11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/below": { Message: &cases.DoubleGTLT{Val: -1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/max": { Message: &cases.DoubleGTLT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/min": { Message: &cases.DoubleGTLT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt_lt"), + }, + ), }, "gt_lt/exclusive/valid/above": { Message: &cases.DoubleExLTGT{Val: 11}, @@ -180,22 +275,42 @@ func doubleSuite() suites.Suite { "gt_lt/exclusive/invalid/within": { Message: &cases.DoubleExLTGT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/max": { Message: &cases.DoubleExLTGT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/min": { Message: &cases.DoubleExLTGT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/nan": { Message: &cases.DoubleExLTGT{Val: math.NaN()}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), + ConstraintId: proto.String("double.gt_lt_exclusive"), + }, + ), }, "gte_lte/inclusive/valid/within": { Message: &cases.DoubleGTELTE{Val: 200}, @@ -212,17 +327,32 @@ func doubleSuite() suites.Suite { "gte_lte/inclusive/invalid/above": { Message: &cases.DoubleGTELTE{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gte"), + ConstraintId: proto.String("double.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/below": { Message: &cases.DoubleGTELTE{Val: 100}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gte"), + ConstraintId: proto.String("double.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/nan": { Message: &cases.DoubleGTELTE{Val: math.NaN()}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gte"), + ConstraintId: proto.String("double.gte_lte"), + }, + ), }, "gte_lte/exclusive/valid/above": { Message: &cases.DoubleExGTELTE{Val: 300}, @@ -243,12 +373,22 @@ func doubleSuite() suites.Suite { "gte_lte/exclusive/invalid/within": { Message: &cases.DoubleExGTELTE{Val: 200}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gte"), + ConstraintId: proto.String("double.gte_lte_exclusive"), + }, + ), }, "gte_lte/exclusive/invalid/nan": { Message: &cases.DoubleExGTELTE{Val: math.NaN()}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("double.gte"), + ConstraintId: proto.String("double.gte_lte_exclusive"), + }, + ), }, "finite/valid": { Message: &cases.DoubleFinite{Val: 1}, @@ -259,6 +399,7 @@ func doubleSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("double.finite"), ConstraintId: proto.String("double.finite"), Message: proto.String("value must be finite"), }), @@ -268,6 +409,7 @@ func doubleSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("double.finite"), ConstraintId: proto.String("double.finite"), Message: proto.String("value must be finite")}), }, @@ -280,8 +422,11 @@ func doubleSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("double.finite"), ConstraintId: proto.String("double.finite"), - Message: proto.String("value must be finite")}), + Message: proto.String("value must be finite"), + }, + ), }, "ignore_empty/valid/empty": { Message: &cases.DoubleIgnore{Val: 0}, @@ -294,7 +439,7 @@ func doubleSuite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.DoubleIgnore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("double.gte_lte")}), + &validate.Violation{FieldPath: proto.String("val"), RulePath: proto.String("double.gte"), ConstraintId: proto.String("double.gte_lte")}), }, "compilation/wrong_type": { Message: &cases.DoubleIncorrectType{Val: 123}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_duration.go b/tools/protovalidate-conformance/internal/cases/cases_duration.go index e7688973..aab6ea44 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_duration.go +++ b/tools/protovalidate-conformance/internal/cases/cases_duration.go @@ -45,6 +45,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }), @@ -68,6 +69,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.const"), ConstraintId: proto.String("duration.const"), Message: proto.String("value must equal 3s"), }), @@ -89,6 +91,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.in"), ConstraintId: proto.String("duration.in"), Message: proto.String(`value must be in list [duration("1s"), duration("0.000001s")]`), }), @@ -110,6 +113,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.not_in"), ConstraintId: proto.String("duration.not_in"), Message: proto.String(`value must not be in list [duration("0s")]`), }), @@ -131,6 +135,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.lt"), ConstraintId: proto.String("duration.lt"), Message: proto.String("value must be less than 0s"), }), @@ -143,6 +148,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.lt"), ConstraintId: proto.String("duration.lt"), Message: proto.String("value must be less than 0s"), }), @@ -172,6 +178,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.lte"), ConstraintId: proto.String("duration.lte"), Message: proto.String(""), }), @@ -195,6 +202,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gt"), ConstraintId: proto.String("duration.gt"), Message: proto.String(""), }), @@ -205,6 +213,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gt"), ConstraintId: proto.String("duration.gt"), Message: proto.String("value must be greater than 0.000001s"), }), @@ -234,6 +243,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gte"), ConstraintId: proto.String("duration.gte"), Message: proto.String("value must be greater than or equal to 0.001s"), }), @@ -257,6 +267,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gt"), ConstraintId: proto.String("duration.gt_lt"), Message: proto.String("value must be greater than 0s and less than 1s"), }), @@ -268,6 +279,7 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gt"), ConstraintId: proto.String("duration.gt_lt"), Message: proto.String("value must be greater than 0s and less than 1s"), }), @@ -280,6 +292,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gt"), ConstraintId: proto.String("duration.gt_lt"), Message: proto.String("value must be greater than 0s and less than 1s"), }), @@ -290,6 +303,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gt"), ConstraintId: proto.String("duration.gt_lt"), Message: proto.String("value must be greater than 0s and less than 1s"), }), @@ -321,6 +335,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gt"), ConstraintId: proto.String("duration.gt_lt_exclusive"), Message: proto.String("value must be greater than 1s or less than 0s"), }), @@ -333,6 +348,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gt"), ConstraintId: proto.String("duration.gt_lt_exclusive"), Message: proto.String("value must be greater than 1s or less than 0s"), }), @@ -343,6 +359,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gt"), ConstraintId: proto.String("duration.gt_lt_exclusive"), Message: proto.String("value must be greater than 1s or less than 0s"), }), @@ -379,6 +396,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gte"), ConstraintId: proto.String("duration.gte_lte"), Message: proto.String("value must be greater than or equal to 60s and less than or equal to 3600s"), }), @@ -391,6 +409,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gte"), ConstraintId: proto.String("duration.gte_lte"), Message: proto.String("value must be greater than or equal to 60s and less than or equal to 3600s"), }), @@ -434,6 +453,7 @@ func durationSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.gte"), ConstraintId: proto.String("duration.gte_lte_exclusive"), Message: proto.String("value must be greater than or equal to 3600s or less than or equal to 60s"), }), @@ -442,6 +462,7 @@ func durationSuite() suites.Suite { Message: &cases.DurationFieldWithOtherFields{DurationVal: nil, IntVal: 12}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("int_val"), + RulePath: proto.String("int32.gt"), ConstraintId: proto.String("int32.gt"), Message: proto.String("value must be greater than 16"), }), diff --git a/tools/protovalidate-conformance/internal/cases/cases_enum.go b/tools/protovalidate-conformance/internal/cases/cases_enum.go index 3c6082fa..b63b836a 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_enum.go +++ b/tools/protovalidate-conformance/internal/cases/cases_enum.go @@ -38,7 +38,12 @@ func enumSuite() suites.Suite { "const/invalid": { Message: &cases.EnumConst{Val: cases.TestEnum_TEST_ENUM_ONE}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("enum.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("enum.const"), + ConstraintId: proto.String("enum.const"), + }, + ), }, "alias/const/valid": { Message: &cases.EnumAliasConst{Val: cases.TestEnumAlias_TEST_ENUM_ALIAS_B}, @@ -47,7 +52,12 @@ func enumSuite() suites.Suite { "alias/const/invalid": { Message: &cases.EnumAliasConst{Val: cases.TestEnumAlias_TEST_ENUM_ALIAS_GAMMA}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("enum.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("enum.const"), + ConstraintId: proto.String("enum.const"), + }, + ), }, "defined_only/valid/unspecified": { Message: &cases.EnumDefined{Val: cases.TestEnum_TEST_ENUM_UNSPECIFIED}, @@ -60,7 +70,13 @@ func enumSuite() suites.Suite { "defined_only/invalid/unknown": { Message: &cases.EnumDefined{Val: math.MaxInt32}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("enum.defined_only"), Message: proto.String("value must be one of the defined enum values")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("enum.defined_only"), + ConstraintId: proto.String("enum.defined_only"), + Message: proto.String("value must be one of the defined enum values"), + }, + ), }, "alias/defined_only/valid/unspecified": { Message: &cases.EnumAliasDefined{Val: cases.TestEnumAlias_TEST_ENUM_ALIAS_UNSPECIFIED}, @@ -73,7 +89,12 @@ func enumSuite() suites.Suite { "alias/defined_only/invalid/unknown": { Message: &cases.EnumAliasDefined{Val: math.MaxInt32}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("enum.defined_only")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("enum.defined_only"), + ConstraintId: proto.String("enum.defined_only"), + }, + ), }, "in/valid": { Message: &cases.EnumIn{Val: cases.TestEnum_TEST_ENUM_TWO}, @@ -82,7 +103,12 @@ func enumSuite() suites.Suite { "in/invalid": { Message: &cases.EnumIn{Val: cases.TestEnum_TEST_ENUM_ONE}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("enum.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("enum.in"), + ConstraintId: proto.String("enum.in"), + }, + ), }, "alias/in/valid": { Message: &cases.EnumAliasIn{Val: cases.TestEnumAlias_TEST_ENUM_ALIAS_BETA}, @@ -91,7 +117,12 @@ func enumSuite() suites.Suite { "alias/in/invalid": { Message: &cases.EnumAliasIn{Val: cases.TestEnumAlias_TEST_ENUM_ALIAS_A}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("enum.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("enum.in"), + ConstraintId: proto.String("enum.in"), + }, + ), }, "not_in/valid": { Message: &cases.EnumNotIn{Val: cases.TestEnum_TEST_ENUM_UNSPECIFIED}, @@ -104,7 +135,12 @@ func enumSuite() suites.Suite { "not_in/invalid": { Message: &cases.EnumNotIn{Val: cases.TestEnum_TEST_ENUM_ONE}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("enum.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("enum.not_in"), + ConstraintId: proto.String("enum.not_in"), + }, + ), }, "alias/not_in/valid": { Message: &cases.EnumAliasNotIn{Val: cases.TestEnumAlias_TEST_ENUM_ALIAS_BETA}, @@ -113,7 +149,12 @@ func enumSuite() suites.Suite { "alias/not_in/invalid": { Message: &cases.EnumAliasNotIn{Val: cases.TestEnumAlias_TEST_ENUM_ALIAS_A}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("enum.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("enum.not_in"), + ConstraintId: proto.String("enum.not_in"), + }, + ), }, "external/defined_only/valid": { Message: &cases.EnumExternal{Val: other_package.Embed_ENUMERATED_VALUE}, @@ -122,7 +163,12 @@ func enumSuite() suites.Suite { "external/defined_only/invalid": { Message: &cases.EnumExternal{Val: math.MaxInt32}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("enum.defined_only")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("enum.defined_only"), + ConstraintId: proto.String("enum.defined_only"), + }, + ), }, "example/valid": { Message: &cases.EnumExample{Val: cases.TestEnum_TEST_ENUM_TWO}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_fixed32.go b/tools/protovalidate-conformance/internal/cases/cases_fixed32.go index 5c5fe5ff..8aff6be1 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_fixed32.go +++ b/tools/protovalidate-conformance/internal/cases/cases_fixed32.go @@ -35,7 +35,12 @@ func fixed32Suite() suites.Suite { "const/invalid": { Message: &cases.Fixed32Const{Val: 2}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.const"), + ConstraintId: proto.String("fixed32.const"), + }, + ), }, "in/valid": { Message: &cases.Fixed32In{Val: 3}, @@ -44,7 +49,12 @@ func fixed32Suite() suites.Suite { "in/invalid": { Message: &cases.Fixed32In{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.in"), + ConstraintId: proto.String("fixed32.in"), + }, + ), }, "not_in/valid": { Message: &cases.Fixed32NotIn{Val: 1}, @@ -53,7 +63,12 @@ func fixed32Suite() suites.Suite { "not_in/invalid": { Message: &cases.Fixed32NotIn{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.not_in"), + ConstraintId: proto.String("fixed32.not_in"), + }, + ), }, "lt/valid/less": { Message: &cases.Fixed32LT{Val: 4}, @@ -62,12 +77,22 @@ func fixed32Suite() suites.Suite { "lt/invalid/equal": { Message: &cases.Fixed32LT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.lt"), + ConstraintId: proto.String("fixed32.lt"), + }, + ), }, "lt/invalid/greater": { Message: &cases.Fixed32LT{Val: 6}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.lt"), + ConstraintId: proto.String("fixed32.lt"), + }, + ), }, "lte/valid/less": { Message: &cases.Fixed32LTE{Val: 63}, @@ -80,7 +105,12 @@ func fixed32Suite() suites.Suite { "lte/invalid/greater": { Message: &cases.Fixed32LTE{Val: 65}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.lte"), + ConstraintId: proto.String("fixed32.lte"), + }, + ), }, "gt/valid/greater": { Message: &cases.Fixed32GT{Val: 17}, @@ -89,12 +119,22 @@ func fixed32Suite() suites.Suite { "gt/invalid/equal": { Message: &cases.Fixed32GT{Val: 16}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gt"), + ConstraintId: proto.String("fixed32.gt"), + }, + ), }, "gt/invalid/less": { Message: &cases.Fixed32GT{Val: 15}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gt"), + ConstraintId: proto.String("fixed32.gt"), + }, + ), }, "gte/valid/greater": { Message: &cases.Fixed32GTE{Val: 9}, @@ -107,7 +147,12 @@ func fixed32Suite() suites.Suite { "gte/invalid/less": { Message: &cases.Fixed32GTE{Val: 7}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gte"), + ConstraintId: proto.String("fixed32.gte"), + }, + ), }, "gt_lt/inclusive/valid/within": { Message: &cases.Fixed32GTLT{Val: 6}, @@ -116,22 +161,42 @@ func fixed32Suite() suites.Suite { "gt_lt/inclusive/invalid/above": { Message: &cases.Fixed32GTLT{Val: 11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gt"), + ConstraintId: proto.String("fixed32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/below": { Message: &cases.Fixed32GTLT{Val: 4}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gt"), + ConstraintId: proto.String("fixed32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/max": { Message: &cases.Fixed32GTLT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gt"), + ConstraintId: proto.String("fixed32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/min": { Message: &cases.Fixed32GTLT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gt"), + ConstraintId: proto.String("fixed32.gt_lt"), + }, + ), }, "gt_lt/exclusive/valid/above": { Message: &cases.Fixed32ExLTGT{Val: 11}, @@ -144,17 +209,32 @@ func fixed32Suite() suites.Suite { "gt_lt/exclusive/invalid/within": { Message: &cases.Fixed32ExLTGT{Val: 6}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gt"), + ConstraintId: proto.String("fixed32.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/max": { Message: &cases.Fixed32ExLTGT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gt"), + ConstraintId: proto.String("fixed32.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/min": { Message: &cases.Fixed32ExLTGT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gt"), + ConstraintId: proto.String("fixed32.gt_lt_exclusive"), + }, + ), }, "gte_lte/inclusive/valid/within": { Message: &cases.Fixed32GTELTE{Val: 200}, @@ -171,12 +251,22 @@ func fixed32Suite() suites.Suite { "gte_lte/inclusive/invalid/above": { Message: &cases.Fixed32GTELTE{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gte"), + ConstraintId: proto.String("fixed32.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/below": { Message: &cases.Fixed32GTELTE{Val: 100}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gte"), + ConstraintId: proto.String("fixed32.gte_lte"), + }, + ), }, "gte_lte/exclusive/valid/above": { Message: &cases.Fixed32ExGTELTE{Val: 300}, @@ -197,7 +287,12 @@ func fixed32Suite() suites.Suite { "gte_lte/exclusive/invalid/within": { Message: &cases.Fixed32ExGTELTE{Val: 200}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gte"), + ConstraintId: proto.String("fixed32.gte_lte_exclusive"), + }, + ), }, "ignore_empty/valid/empty": { Message: &cases.Fixed32Ignore{Val: 0}, @@ -210,7 +305,12 @@ func fixed32Suite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.Fixed32Ignore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.gte"), + ConstraintId: proto.String("fixed32.gte_lte"), + }, + ), }, "compilation/wrong_type": { Message: &cases.Fixed32IncorrectType{Val: 123}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_fixed64.go b/tools/protovalidate-conformance/internal/cases/cases_fixed64.go index 5f411f00..b7345fb8 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_fixed64.go +++ b/tools/protovalidate-conformance/internal/cases/cases_fixed64.go @@ -35,7 +35,12 @@ func fixed64Suite() suites.Suite { "const/invalid": { Message: &cases.Fixed64Const{Val: 2}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.const"), + ConstraintId: proto.String("fixed64.const"), + }, + ), }, "in/valid": { Message: &cases.Fixed64In{Val: 3}, @@ -44,7 +49,12 @@ func fixed64Suite() suites.Suite { "in/invalid": { Message: &cases.Fixed64In{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.in"), + ConstraintId: proto.String("fixed64.in"), + }, + ), }, "not_in/valid": { Message: &cases.Fixed64NotIn{Val: 1}, @@ -53,7 +63,12 @@ func fixed64Suite() suites.Suite { "not_in/invalid": { Message: &cases.Fixed64NotIn{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.not_in"), + ConstraintId: proto.String("fixed64.not_in"), + }, + ), }, "lt/valid/less": { Message: &cases.Fixed64LT{Val: 4}, @@ -62,12 +77,22 @@ func fixed64Suite() suites.Suite { "lt/invalid/equal": { Message: &cases.Fixed64LT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.lt"), + ConstraintId: proto.String("fixed64.lt"), + }, + ), }, "lt/invalid/greater": { Message: &cases.Fixed64LT{Val: 6}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.lt"), + ConstraintId: proto.String("fixed64.lt"), + }, + ), }, "lte/valid/less": { Message: &cases.Fixed64LTE{Val: 63}, @@ -80,7 +105,12 @@ func fixed64Suite() suites.Suite { "lte/invalid/greater": { Message: &cases.Fixed64LTE{Val: 65}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.lte"), + ConstraintId: proto.String("fixed64.lte"), + }, + ), }, "gt/valid/greater": { Message: &cases.Fixed64GT{Val: 17}, @@ -89,12 +119,22 @@ func fixed64Suite() suites.Suite { "gt/invalid/equal": { Message: &cases.Fixed64GT{Val: 16}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gt"), + ConstraintId: proto.String("fixed64.gt"), + }, + ), }, "gt/invalid/less": { Message: &cases.Fixed64GT{Val: 15}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gt"), + ConstraintId: proto.String("fixed64.gt"), + }, + ), }, "gte/valid/greater": { Message: &cases.Fixed64GTE{Val: 9}, @@ -107,7 +147,12 @@ func fixed64Suite() suites.Suite { "gte/invalid/less": { Message: &cases.Fixed64GTE{Val: 7}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gte"), + ConstraintId: proto.String("fixed64.gte"), + }, + ), }, "gt_lt/inclusive/valid/within": { Message: &cases.Fixed64GTLT{Val: 6}, @@ -116,22 +161,42 @@ func fixed64Suite() suites.Suite { "gt_lt/inclusive/invalid/above": { Message: &cases.Fixed64GTLT{Val: 11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gt"), + ConstraintId: proto.String("fixed64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/below": { Message: &cases.Fixed64GTLT{Val: 4}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gt"), + ConstraintId: proto.String("fixed64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/max": { Message: &cases.Fixed64GTLT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gt"), + ConstraintId: proto.String("fixed64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/min": { Message: &cases.Fixed64GTLT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gt"), + ConstraintId: proto.String("fixed64.gt_lt"), + }, + ), }, "gt_lt/exclusive/valid/above": { Message: &cases.Fixed64ExLTGT{Val: 11}, @@ -144,17 +209,32 @@ func fixed64Suite() suites.Suite { "gt_lt/exclusive/invalid/within": { Message: &cases.Fixed64ExLTGT{Val: 6}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gt"), + ConstraintId: proto.String("fixed64.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/max": { Message: &cases.Fixed64ExLTGT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gt"), + ConstraintId: proto.String("fixed64.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/min": { Message: &cases.Fixed64ExLTGT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gt"), + ConstraintId: proto.String("fixed64.gt_lt_exclusive"), + }, + ), }, "gte_lte/inclusive/valid/within": { Message: &cases.Fixed64GTELTE{Val: 200}, @@ -171,12 +251,22 @@ func fixed64Suite() suites.Suite { "gte_lte/inclusive/invalid/above": { Message: &cases.Fixed64GTELTE{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gte"), + ConstraintId: proto.String("fixed64.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/below": { Message: &cases.Fixed64GTELTE{Val: 100}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gte"), + ConstraintId: proto.String("fixed64.gte_lte"), + }, + ), }, "gte_lte/exclusive/valid/above": { Message: &cases.Fixed64ExGTELTE{Val: 300}, @@ -197,7 +287,12 @@ func fixed64Suite() suites.Suite { "gte_lte/exclusive/invalid/within": { Message: &cases.Fixed64ExGTELTE{Val: 200}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gte"), + ConstraintId: proto.String("fixed64.gte_lte_exclusive"), + }, + ), }, "ignore_empty/valid/empty": { Message: &cases.Fixed64Ignore{Val: 0}, @@ -210,7 +305,12 @@ func fixed64Suite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.Fixed64Ignore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("fixed64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.gte"), + ConstraintId: proto.String("fixed64.gte_lte"), + }, + ), }, "compilation/wrong_type": { Message: &cases.Fixed64IncorrectType{Val: 123}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_float.go b/tools/protovalidate-conformance/internal/cases/cases_float.go index 0e2171a3..edc6ac7d 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_float.go +++ b/tools/protovalidate-conformance/internal/cases/cases_float.go @@ -37,12 +37,22 @@ func floatSuite() suites.Suite { "const/invalid": { Message: &cases.FloatConst{Val: 4.56}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.const"), + ConstraintId: proto.String("float.const"), + }, + ), }, "const/nan": { Message: &cases.FloatConst{Val: float32(math.NaN())}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.const"), + ConstraintId: proto.String("float.const"), + }, + ), }, "in/valid": { Message: &cases.FloatIn{Val: 7.89}, @@ -51,12 +61,22 @@ func floatSuite() suites.Suite { "in/invalid": { Message: &cases.FloatIn{Val: 10.11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.in"), + ConstraintId: proto.String("float.in"), + }, + ), }, "in/nan": { Message: &cases.FloatIn{Val: float32(math.NaN())}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.in"), + ConstraintId: proto.String("float.in"), + }, + ), }, "not_in/valid": { Message: &cases.FloatNotIn{Val: 1}, @@ -65,7 +85,12 @@ func floatSuite() suites.Suite { "not_in/invalid": { Message: &cases.FloatNotIn{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.not_in"), + ConstraintId: proto.String("float.not_in"), + }, + ), }, "not_in/nan": { Message: &cases.FloatNotIn{Val: float32(math.NaN())}, @@ -78,17 +103,32 @@ func floatSuite() suites.Suite { "lt/invalid/equal": { Message: &cases.FloatLT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.lt"), + ConstraintId: proto.String("float.lt"), + }, + ), }, "lt/invalid/greater": { Message: &cases.FloatLT{Val: 1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.lt"), + ConstraintId: proto.String("float.lt"), + }, + ), }, "lt/invalid/nan": { Message: &cases.FloatLT{Val: float32(math.NaN())}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.lt"), + ConstraintId: proto.String("float.lt"), + }, + ), }, "lte/valid/less": { Message: &cases.FloatLTE{Val: 63}, @@ -101,12 +141,22 @@ func floatSuite() suites.Suite { "lte/invalid/greater": { Message: &cases.FloatLTE{Val: 65}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.lte"), + ConstraintId: proto.String("float.lte"), + }, + ), }, "lte/invalid/nan": { Message: &cases.FloatLTE{Val: float32(math.NaN())}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.lte"), + ConstraintId: proto.String("float.lte"), + }, + ), }, "gt/valid/greater": { Message: &cases.FloatGT{Val: 17}, @@ -115,17 +165,32 @@ func floatSuite() suites.Suite { "gt/invalid/equal": { Message: &cases.FloatGT{Val: 16}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt"), + }, + ), }, "gt/invalid/less": { Message: &cases.FloatGT{Val: 15}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt"), + }, + ), }, "gt/invalid/nan": { Message: &cases.FloatGT{Val: float32(math.NaN())}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt"), + }, + ), }, "gte/valid/greater": { Message: &cases.FloatGTE{Val: 9}, @@ -138,12 +203,22 @@ func floatSuite() suites.Suite { "gte/invalid/less": { Message: &cases.FloatGTE{Val: 7}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gte"), + ConstraintId: proto.String("float.gte"), + }, + ), }, "gte/invalid/nan": { Message: &cases.FloatGTE{Val: float32(math.NaN())}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gte"), + ConstraintId: proto.String("float.gte"), + }, + ), }, "gt_lt/inclusive/valid/within": { Message: &cases.FloatGTLT{Val: 5}, @@ -152,27 +227,52 @@ func floatSuite() suites.Suite { "gt_lt/inclusive/invalid/above": { Message: &cases.FloatGTLT{Val: 11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/below": { Message: &cases.FloatGTLT{Val: -1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/max": { Message: &cases.FloatGTLT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/min": { Message: &cases.FloatGTLT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/nan": { Message: &cases.FloatGTLT{Val: float32(math.NaN())}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt_lt"), + }, + ), }, "gt_lt/exclusive/valid/above": { Message: &cases.FloatExLTGT{Val: 11}, @@ -185,22 +285,42 @@ func floatSuite() suites.Suite { "gt_lt/exclusive/invalid/within": { Message: &cases.FloatExLTGT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/max": { Message: &cases.FloatExLTGT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/min": { Message: &cases.FloatExLTGT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/nan": { Message: &cases.FloatExLTGT{Val: float32(math.NaN())}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), + ConstraintId: proto.String("float.gt_lt_exclusive"), + }, + ), }, "gte_lte/inclusive/valid/within": { Message: &cases.FloatGTELTE{Val: 200}, @@ -217,17 +337,32 @@ func floatSuite() suites.Suite { "gte_lte/inclusive/invalid/above": { Message: &cases.FloatGTELTE{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gte"), + ConstraintId: proto.String("float.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/below": { Message: &cases.FloatGTELTE{Val: 100}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gte"), + ConstraintId: proto.String("float.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/nan": { Message: &cases.FloatGTELTE{Val: float32(math.NaN())}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gte"), + ConstraintId: proto.String("float.gte_lte"), + }, + ), }, "gte_lte/exclusive/valid/above": { Message: &cases.FloatExGTELTE{Val: 300}, @@ -248,12 +383,22 @@ func floatSuite() suites.Suite { "gte_lte/exclusive/invalid/within": { Message: &cases.FloatExGTELTE{Val: 200}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gte"), + ConstraintId: proto.String("float.gte_lte_exclusive"), + }, + ), }, "gte_lte/exclusive/invalid/nan": { Message: &cases.FloatExGTELTE{Val: float32(math.NaN())}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gte"), + ConstraintId: proto.String("float.gte_lte_exclusive"), + }, + ), }, "finite/valid": { Message: &cases.FloatFinite{Val: 1}, @@ -264,6 +409,7 @@ func floatSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.finite"), ConstraintId: proto.String("float.finite"), Message: proto.String("value must be finite"), }), @@ -273,8 +419,11 @@ func floatSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.finite"), ConstraintId: proto.String("float.finite"), - Message: proto.String("value must be finite")}), + Message: proto.String("value must be finite"), + }, + ), }, "finite/inf/not_checked": { Message: &cases.FloatNotFinite{Val: float32(math.Inf(1))}, @@ -285,8 +434,11 @@ func floatSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.finite"), ConstraintId: proto.String("float.finite"), - Message: proto.String("value must be finite")}), + Message: proto.String("value must be finite"), + }, + ), }, "ignore_empty/valid/empty": { Message: &cases.FloatIgnore{Val: 0}, @@ -299,7 +451,12 @@ func floatSuite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.FloatIgnore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("float.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("float.gte"), + ConstraintId: proto.String("float.gte_lte"), + }, + ), }, "compilation/wrong_type": { Message: &cases.FloatIncorrectType{Val: 123}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_ignore.go b/tools/protovalidate-conformance/internal/cases/cases_ignore.go index c6cab197..f8ee4428 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_ignore.go +++ b/tools/protovalidate-conformance/internal/cases/cases_ignore.go @@ -33,12 +33,20 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/optional/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreUnspecified{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreUnspecified{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreUnspecified{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreUnspecified{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional_with_default/ignore_unspecified/valid/unpopulated": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreUnspecifiedWithDefault{}, @@ -49,16 +57,28 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/optional_with_default/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional_with_default/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional_with_default/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreEmpty{}, @@ -69,12 +89,20 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/optional/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreEmpty{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreEmpty{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional/ignore_empty/invalid/default": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreEmpty{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreEmpty{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional_with_default/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreEmptyWithDefault{}, @@ -85,16 +113,28 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/optional_with_default/ignore_empty/invalid/default": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional_with_default/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional_with_default/ignore_empty/invalid/zero": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreEmptyWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreEmptyWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional/ignore_default/valid/unpopulated": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreDefault{}, @@ -105,8 +145,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/optional/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional/ignore_default/valid/default": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreDefault{Val: proto.Int32(0)}, @@ -125,76 +169,128 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/optional_with_default/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional_with_default/ignore_default/invalid/zero": suites.Case{ - Message: &cases.Proto2ScalarOptionalIgnoreDefaultWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarOptionalIgnoreDefaultWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreUnspecified{Val: proto.Int32(123)}, Expected: results.Success(true), }, "proto2/scalar/required/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreUnspecified{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreUnspecified{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreUnspecified{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreUnspecified{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required_with_default/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(123)}, Expected: results.Success(true), }, "proto2/scalar/required_with_default/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required_with_default/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required_with_default/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreEmpty{Val: proto.Int32(123)}, Expected: results.Success(true), }, "proto2/scalar/required/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreEmpty{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreEmpty{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required/ignore_empty/invalid/default": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreEmpty{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreEmpty{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required_with_default/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreEmptyWithDefault{Val: proto.Int32(123)}, Expected: results.Success(true), }, "proto2/scalar/required_with_default/ignore_empty/invalid/default": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required_with_default/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required_with_default/ignore_empty/invalid/zero": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreEmptyWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreEmptyWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required/ignore_default/valid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreDefault{Val: proto.Int32(123)}, Expected: results.Success(true), }, "proto2/scalar/required/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required/ignore_default/valid/default": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreDefault{Val: proto.Int32(0)}, @@ -209,12 +305,20 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/required_with_default/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required_with_default/ignore_default/invalid/zero": suites.Case{ - Message: &cases.Proto2ScalarRequiredIgnoreDefaultWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2ScalarRequiredIgnoreDefaultWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/message/optional/ignore_unspecified/valid/unpopulated": suites.Case{ Message: &cases.Proto2MessageOptionalIgnoreUnspecified{}, @@ -230,13 +334,19 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2MessageOptionalIgnoreUnspecified{ Val: &cases.Proto2MessageOptionalIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto2.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto2.message.ignore.empty"), + }), }, "proto2/message/optional/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto2MessageOptionalIgnoreUnspecified{ Val: &cases.Proto2MessageOptionalIgnoreUnspecified_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto2.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto2.message.ignore.empty"), + }), }, "proto2/message/optional/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.Proto2MessageOptionalIgnoreEmpty{}, @@ -252,13 +362,19 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2MessageOptionalIgnoreEmpty{ Val: &cases.Proto2MessageOptionalIgnoreEmpty_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto2.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto2.message.ignore.empty"), + }), }, "proto2/message/optional/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto2MessageOptionalIgnoreEmpty{ Val: &cases.Proto2MessageOptionalIgnoreEmpty_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto2.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto2.message.ignore.empty"), + }), }, "proto2/message/optional/ignore_default/valid/unpopulated": suites.Case{ Message: &cases.Proto2MessageOptionalIgnoreDefault{}, @@ -274,7 +390,10 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2MessageOptionalIgnoreDefault{ Val: &cases.Proto2MessageOptionalIgnoreDefault_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto2.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto2.message.ignore.empty"), + }), }, "proto2/message/optional/ignore_default/valid/default": suites.Case{ Message: &cases.Proto2MessageOptionalIgnoreDefault{ @@ -292,13 +411,19 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2MessageRequiredIgnoreUnspecified{ Val: &cases.Proto2MessageRequiredIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto2.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto2.message.ignore.empty"), + }), }, "proto2/message/required/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto2MessageRequiredIgnoreUnspecified{ Val: &cases.Proto2MessageRequiredIgnoreUnspecified_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto2.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto2.message.ignore.empty"), + }), }, "proto2/message/required/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto2MessageRequiredIgnoreEmpty{ @@ -310,13 +435,19 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2MessageRequiredIgnoreEmpty{ Val: &cases.Proto2MessageRequiredIgnoreEmpty_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto2.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto2.message.ignore.empty"), + }), }, "proto2/message/required/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto2MessageRequiredIgnoreEmpty{ Val: &cases.Proto2MessageRequiredIgnoreEmpty_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto2.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto2.message.ignore.empty"), + }), }, "proto2/message/required/ignore_default/valid/populated": suites.Case{ Message: &cases.Proto2MessageRequiredIgnoreDefault{ @@ -328,7 +459,10 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2MessageRequiredIgnoreDefault{ Val: &cases.Proto2MessageRequiredIgnoreDefault_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto2.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto2.message.ignore.empty"), + }), }, "proto2/message/required/ignore_default/valid/default": suites.Case{ Message: &cases.Proto2MessageRequiredIgnoreDefault{ @@ -350,13 +484,21 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2OneofIgnoreUnspecified{ O: &cases.Proto2OneofIgnoreUnspecified_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto2OneofIgnoreUnspecified{ O: &cases.Proto2OneofIgnoreUnspecified_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof_with_default/ignore_unspecified/valid/unpopulated": suites.Case{ Message: &cases.Proto2OneofIgnoreUnspecifiedWithDefault{}, @@ -372,19 +514,31 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2OneofIgnoreUnspecifiedWithDefault{ O: &cases.Proto2OneofIgnoreUnspecifiedWithDefault_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof_with_default/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto2OneofIgnoreUnspecifiedWithDefault{ O: &cases.Proto2OneofIgnoreUnspecifiedWithDefault_Val{Val: -42}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof_with_default/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.Proto2OneofIgnoreUnspecifiedWithDefault{ O: &cases.Proto2OneofIgnoreUnspecifiedWithDefault_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.Proto2OneofIgnoreEmpty{}, @@ -400,13 +554,21 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2OneofIgnoreEmpty{ O: &cases.Proto2OneofIgnoreEmpty_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto2OneofIgnoreEmpty{ O: &cases.Proto2OneofIgnoreEmpty_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof_with_default/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.Proto2OneofIgnoreEmptyWithDefault{}, @@ -422,19 +584,31 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2OneofIgnoreEmptyWithDefault{ O: &cases.Proto2OneofIgnoreEmptyWithDefault_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof_with_default/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto2OneofIgnoreEmptyWithDefault{ O: &cases.Proto2OneofIgnoreEmptyWithDefault_Val{Val: -42}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof_with_default/ignore_empty/invalid/zero": suites.Case{ Message: &cases.Proto2OneofIgnoreEmptyWithDefault{ O: &cases.Proto2OneofIgnoreEmptyWithDefault_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof/ignore_default/valid/unpopulated": suites.Case{ Message: &cases.Proto2OneofIgnoreDefault{}, @@ -450,7 +624,11 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2OneofIgnoreDefault{ O: &cases.Proto2OneofIgnoreDefault_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof/ignore_default/valid/default": suites.Case{ Message: &cases.Proto2OneofIgnoreDefault{ @@ -472,7 +650,11 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2OneofIgnoreDefaultWithDefault{ O: &cases.Proto2OneofIgnoreDefaultWithDefault_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof_with_default/ignore_default/valid/default": suites.Case{ Message: &cases.Proto2OneofIgnoreDefaultWithDefault{ @@ -484,15 +666,27 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto2OneofIgnoreDefaultWithDefault{ O: &cases.Proto2OneofIgnoreDefaultWithDefault_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/repeated/ignore_unspecified/invalid/unpopulated": suites.Case{ - Message: &cases.Proto2RepeatedIgnoreUnspecified{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.Proto2RepeatedIgnoreUnspecified{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto2/repeated/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto2RepeatedIgnoreUnspecified{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.Proto2RepeatedIgnoreUnspecified{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto2/repeated/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.Proto2RepeatedIgnoreUnspecified{Val: []int32{1, 2, 3}}, @@ -503,8 +697,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/repeated/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto2RepeatedIgnoreEmpty{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.Proto2RepeatedIgnoreEmpty{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto2/repeated/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto2RepeatedIgnoreEmpty{Val: []int32{1, 2, 3}}, @@ -515,20 +713,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/repeated/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto2RepeatedIgnoreDefault{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.Proto2RepeatedIgnoreDefault{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto2/repeated/ignore_default/valid/populated": suites.Case{ Message: &cases.Proto2RepeatedIgnoreDefault{Val: []int32{1, 2, 3}}, Expected: results.Success(true), }, "proto2/map/ignore_unspecified/invalid/unpopulated": suites.Case{ - Message: &cases.Proto2MapIgnoreUnspecified{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.Proto2MapIgnoreUnspecified{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto2/map/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto2MapIgnoreUnspecified{Val: map[int32]int32{1: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.Proto2MapIgnoreUnspecified{Val: map[int32]int32{1: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto2/map/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.Proto2MapIgnoreUnspecified{Val: map[int32]int32{1: 1, 2: 2, 3: 3}}, @@ -539,8 +749,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/map/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto2MapIgnoreEmpty{Val: map[int32]int32{1: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.Proto2MapIgnoreEmpty{Val: map[int32]int32{1: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto2/map/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto2MapIgnoreEmpty{Val: map[int32]int32{1: 1, 2: 2, 3: 3}}, @@ -551,8 +765,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/map/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto2MapIgnoreDefault{Val: map[int32]int32{1: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.Proto2MapIgnoreDefault{Val: map[int32]int32{1: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto2/map/ignore_default/valid/populated": suites.Case{ Message: &cases.Proto2MapIgnoreDefault{Val: map[int32]int32{1: 1, 2: 2, 3: 3}}, @@ -563,20 +781,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/repeated/items/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto2RepeatedItemIgnoreUnspecified{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2RepeatedItemIgnoreUnspecified{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/repeated/items/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.Proto2RepeatedItemIgnoreUnspecified{Val: []int32{0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2RepeatedItemIgnoreUnspecified{Val: []int32{0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/repeated/items/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto2RepeatedItemIgnoreEmpty{Val: []int32{1}}, Expected: results.Success(true), }, "proto2/repeated/items/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto2RepeatedItemIgnoreEmpty{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2RepeatedItemIgnoreEmpty{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/repeated/items/ignore_empty/valid/zero": suites.Case{ Message: &cases.Proto2RepeatedItemIgnoreEmpty{Val: []int32{0}}, @@ -587,8 +817,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/repeated/items/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto2RepeatedItemIgnoreDefault{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2RepeatedItemIgnoreDefault{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/repeated/items/ignore_default/valid/zero": suites.Case{ Message: &cases.Proto2RepeatedItemIgnoreDefault{Val: []int32{0}}, @@ -599,20 +833,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/map/keys/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto2MapKeyIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2MapKeyIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/map/keys/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.Proto2MapKeyIgnoreUnspecified{Val: map[int32]int32{0: 0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2MapKeyIgnoreUnspecified{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/map/keys/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto2MapKeyIgnoreEmpty{Val: map[int32]int32{1: 1}}, Expected: results.Success(true), }, "proto2/map/keys/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto2MapKeyIgnoreEmpty{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2MapKeyIgnoreEmpty{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/map/keys/ignore_empty/valid/zero": suites.Case{ Message: &cases.Proto2MapKeyIgnoreEmpty{Val: map[int32]int32{0: 0}}, @@ -623,8 +869,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/map/keys/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto2MapKeyIgnoreDefault{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2MapKeyIgnoreDefault{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/map/keys/ignore_default/valid/zero": suites.Case{ Message: &cases.Proto2MapKeyIgnoreDefault{Val: map[int32]int32{0: 0}}, @@ -635,20 +885,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/map/values/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto2MapValueIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2MapValueIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/map/values/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.Proto2MapValueIgnoreUnspecified{Val: map[int32]int32{0: 0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2MapValueIgnoreUnspecified{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/map/values/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto2MapValueIgnoreEmpty{Val: map[int32]int32{1: 1}}, Expected: results.Success(true), }, "proto2/map/values/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto2MapValueIgnoreEmpty{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2MapValueIgnoreEmpty{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/map/values/ignore_empty/valid/zero": suites.Case{ Message: &cases.Proto2MapValueIgnoreEmpty{Val: map[int32]int32{0: 0}}, @@ -659,8 +921,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto2/map/values/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto2MapValueIgnoreDefault{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto2MapValueIgnoreDefault{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/map/values/ignore_default/valid/zero": suites.Case{ Message: &cases.Proto2MapValueIgnoreDefault{Val: map[int32]int32{0: 0}}, @@ -675,12 +941,20 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/scalar/optional/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto3ScalarOptionalIgnoreUnspecified{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3ScalarOptionalIgnoreUnspecified{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/optional/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.Proto3ScalarOptionalIgnoreUnspecified{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3ScalarOptionalIgnoreUnspecified{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/optional/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.Proto3ScalarOptionalIgnoreEmpty{}, @@ -691,12 +965,20 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/scalar/optional/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto3ScalarOptionalIgnoreEmpty{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3ScalarOptionalIgnoreEmpty{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/optional/ignore_empty/invalid/default": suites.Case{ - Message: &cases.Proto3ScalarOptionalIgnoreEmpty{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3ScalarOptionalIgnoreEmpty{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/optional/ignore_default/valid/unpopulated": suites.Case{ Message: &cases.Proto3ScalarOptionalIgnoreDefault{}, @@ -707,8 +989,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/scalar/optional/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto3ScalarOptionalIgnoreDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3ScalarOptionalIgnoreDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/optional/ignore_default/valid/default": suites.Case{ Message: &cases.Proto3ScalarOptionalIgnoreDefault{Val: proto.Int32(0)}, @@ -719,20 +1005,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/scalar/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto3ScalarIgnoreUnspecified{Val: -123}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3ScalarIgnoreUnspecified{Val: -123}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.Proto3ScalarIgnoreUnspecified{Val: 0}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3ScalarIgnoreUnspecified{Val: 0}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto3ScalarIgnoreEmpty{Val: 123}, Expected: results.Success(true), }, "proto3/scalar/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto3ScalarIgnoreEmpty{Val: -123}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3ScalarIgnoreEmpty{Val: -123}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/ignore_empty/valid/default": suites.Case{ Message: &cases.Proto3ScalarIgnoreEmpty{Val: 0}, @@ -743,8 +1041,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/scalar/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto3ScalarIgnoreDefault{Val: -123}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3ScalarIgnoreDefault{Val: -123}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/ignore_default/valid/default": suites.Case{ Message: &cases.Proto3ScalarIgnoreDefault{Val: 0}, @@ -764,13 +1066,19 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto3MessageOptionalIgnoreUnspecified{ Val: &cases.Proto3MessageOptionalIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto3.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto3.message.ignore.empty"), + }), }, "proto3/message/optional/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto3MessageOptionalIgnoreUnspecified{ Val: &cases.Proto3MessageOptionalIgnoreUnspecified_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto3.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto3.message.ignore.empty"), + }), }, "proto3/message/optional/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.Proto3MessageOptionalIgnoreEmpty{}, @@ -786,13 +1094,19 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto3MessageOptionalIgnoreEmpty{ Val: &cases.Proto3MessageOptionalIgnoreEmpty_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto3.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto3.message.ignore.empty"), + }), }, "proto3/message/optional/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto3MessageOptionalIgnoreEmpty{ Val: &cases.Proto3MessageOptionalIgnoreEmpty_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto3.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto3.message.ignore.empty"), + }), }, "proto3/message/optional/ignore_default/valid/unpopulated": suites.Case{ Message: &cases.Proto3MessageOptionalIgnoreDefault{}, @@ -808,7 +1122,10 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto3MessageOptionalIgnoreDefault{ Val: &cases.Proto3MessageOptionalIgnoreDefault_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto3.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto3.message.ignore.empty"), + }), }, "proto3/message/optional/ignore_default/valid/default": suites.Case{ Message: &cases.Proto3MessageOptionalIgnoreDefault{ @@ -826,13 +1143,19 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto3MessageIgnoreUnspecified{ Val: &cases.Proto3MessageIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto3.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto3.message.ignore.empty"), + }), }, "proto3/message/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto3MessageIgnoreUnspecified{ Val: &cases.Proto3MessageIgnoreUnspecified_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto3.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto3.message.ignore.empty"), + }), }, "proto3/message/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto3MessageIgnoreEmpty{ @@ -844,13 +1167,19 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto3MessageIgnoreEmpty{ Val: &cases.Proto3MessageIgnoreEmpty_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto3.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto3.message.ignore.empty"), + }), }, "proto3/message/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto3MessageIgnoreEmpty{ Val: &cases.Proto3MessageIgnoreEmpty_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto3.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto3.message.ignore.empty"), + }), }, "proto3/message/ignore_default/valid/populated": suites.Case{ Message: &cases.Proto3MessageIgnoreDefault{ @@ -862,7 +1191,10 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto3MessageIgnoreDefault{ Val: &cases.Proto3MessageIgnoreDefault_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto3.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto3.message.ignore.empty"), + }), }, "proto3/message/ignore_default/valid/default": suites.Case{ Message: &cases.Proto3MessageIgnoreDefault{ @@ -884,13 +1216,21 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto3OneofIgnoreUnspecified{ O: &cases.Proto3OneofIgnoreUnspecified_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/oneof/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto3OneofIgnoreUnspecified{ O: &cases.Proto3OneofIgnoreUnspecified_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/oneof/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.Proto3OneofIgnoreEmpty{}, @@ -906,13 +1246,21 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto3OneofIgnoreEmpty{ O: &cases.Proto3OneofIgnoreEmpty_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/oneof/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto3OneofIgnoreEmpty{ O: &cases.Proto3OneofIgnoreEmpty_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/oneof/ignore_default/valid/unpopulated": suites.Case{ Message: &cases.Proto3OneofIgnoreDefault{}, @@ -928,7 +1276,11 @@ func ignoreSuite() suites.Suite { Message: &cases.Proto3OneofIgnoreDefault{ O: &cases.Proto3OneofIgnoreDefault_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/oneof/ignore_default/valid/default": suites.Case{ Message: &cases.Proto3OneofIgnoreDefault{ @@ -937,12 +1289,20 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/repeated/ignore_unspecified/invalid/unpopulated": suites.Case{ - Message: &cases.Proto3RepeatedIgnoreUnspecified{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.Proto3RepeatedIgnoreUnspecified{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto3/repeated/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto3RepeatedIgnoreUnspecified{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.Proto3RepeatedIgnoreUnspecified{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto3/repeated/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.Proto3RepeatedIgnoreUnspecified{Val: []int32{1, 2, 3}}, @@ -953,8 +1313,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/repeated/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto3RepeatedIgnoreEmpty{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.Proto3RepeatedIgnoreEmpty{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto3/repeated/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto3RepeatedIgnoreEmpty{Val: []int32{1, 2, 3}}, @@ -965,20 +1329,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/repeated/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto3RepeatedIgnoreDefault{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.Proto3RepeatedIgnoreDefault{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto3/repeated/ignore_default/valid/populated": suites.Case{ Message: &cases.Proto3RepeatedIgnoreDefault{Val: []int32{1, 2, 3}}, Expected: results.Success(true), }, "proto3/map/ignore_unspecified/invalid/unpopulated": suites.Case{ - Message: &cases.Proto3MapIgnoreUnspecified{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.Proto3MapIgnoreUnspecified{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto3/map/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto3MapIgnoreUnspecified{Val: map[int32]int32{1: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.Proto3MapIgnoreUnspecified{Val: map[int32]int32{1: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto3/map/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.Proto3MapIgnoreUnspecified{Val: map[int32]int32{1: 1, 2: 2, 3: 3}}, @@ -989,8 +1365,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/map/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto3MapIgnoreEmpty{Val: map[int32]int32{1: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.Proto3MapIgnoreEmpty{Val: map[int32]int32{1: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto3/map/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto3MapIgnoreEmpty{Val: map[int32]int32{1: 1, 2: 2, 3: 3}}, @@ -1001,8 +1381,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/map/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto3MapIgnoreDefault{Val: map[int32]int32{1: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.Proto3MapIgnoreDefault{Val: map[int32]int32{1: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto3/map/ignore_default/valid/populated": suites.Case{ Message: &cases.Proto3MapIgnoreDefault{Val: map[int32]int32{1: 1, 2: 2, 3: 3}}, @@ -1013,20 +1397,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/repeated/items/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto3RepeatedItemIgnoreUnspecified{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3RepeatedItemIgnoreUnspecified{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/repeated/items/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.Proto3RepeatedItemIgnoreUnspecified{Val: []int32{0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3RepeatedItemIgnoreUnspecified{Val: []int32{0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/repeated/items/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto3RepeatedItemIgnoreEmpty{Val: []int32{1}}, Expected: results.Success(true), }, "proto3/repeated/items/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto3RepeatedItemIgnoreEmpty{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3RepeatedItemIgnoreEmpty{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/repeated/items/ignore_empty/valid/zero": suites.Case{ Message: &cases.Proto3RepeatedItemIgnoreEmpty{Val: []int32{0}}, @@ -1037,8 +1433,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/repeated/items/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto3RepeatedItemIgnoreDefault{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3RepeatedItemIgnoreDefault{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/repeated/items/ignore_default/valid/zero": suites.Case{ Message: &cases.Proto3RepeatedItemIgnoreDefault{Val: []int32{0}}, @@ -1049,20 +1449,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/map/keys/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto3MapKeyIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3MapKeyIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/map/keys/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.Proto3MapKeyIgnoreUnspecified{Val: map[int32]int32{0: 0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3MapKeyIgnoreUnspecified{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/map/keys/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto3MapKeyIgnoreEmpty{Val: map[int32]int32{1: 1}}, Expected: results.Success(true), }, "proto3/map/keys/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto3MapKeyIgnoreEmpty{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3MapKeyIgnoreEmpty{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/map/keys/ignore_empty/valid/zero": suites.Case{ Message: &cases.Proto3MapKeyIgnoreEmpty{Val: map[int32]int32{0: 0}}, @@ -1073,8 +1485,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/map/keys/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto3MapKeyIgnoreDefault{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3MapKeyIgnoreDefault{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/map/keys/ignore_default/valid/zero": suites.Case{ Message: &cases.Proto3MapKeyIgnoreDefault{Val: map[int32]int32{0: 0}}, @@ -1085,20 +1501,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/map/values/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.Proto3MapValueIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3MapValueIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/map/values/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.Proto3MapValueIgnoreUnspecified{Val: map[int32]int32{0: 0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3MapValueIgnoreUnspecified{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/map/values/ignore_empty/valid/populated": suites.Case{ Message: &cases.Proto3MapValueIgnoreEmpty{Val: map[int32]int32{1: 1}}, Expected: results.Success(true), }, "proto3/map/values/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.Proto3MapValueIgnoreEmpty{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3MapValueIgnoreEmpty{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/map/values/ignore_empty/valid/zero": suites.Case{ Message: &cases.Proto3MapValueIgnoreEmpty{Val: map[int32]int32{0: 0}}, @@ -1109,8 +1537,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto3/map/values/ignore_default/invalid/populated": suites.Case{ - Message: &cases.Proto3MapValueIgnoreDefault{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Proto3MapValueIgnoreDefault{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/map/values/ignore_default/valid/zero": suites.Case{ Message: &cases.Proto3MapValueIgnoreDefault{Val: map[int32]int32{0: 0}}, @@ -1125,12 +1557,20 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/explicit_presence/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecified{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecified{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecified{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecified{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_unspecified/valid/unpopulated": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecifiedWithDefault{}, @@ -1141,16 +1581,28 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/explicit_presence_with_default/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreEmpty{}, @@ -1161,12 +1613,20 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/explicit_presence/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreEmpty{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreEmpty{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence/ignore_empty/invalid/default": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreEmpty{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreEmpty{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreEmptyWithDefault{}, @@ -1177,16 +1637,28 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/explicit_presence_with_default/ignore_empty/invalid/default": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_empty/invalid/zero": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreEmptyWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreEmptyWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence/ignore_default/valid/unpopulated": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreDefault{}, @@ -1197,8 +1669,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/explicit_presence/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence/ignore_default/valid/default": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreDefault{Val: proto.Int32(0)}, @@ -1217,32 +1693,52 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/explicit_presence_with_default/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_default/invalid/zero": suites.Case{ - Message: &cases.EditionsScalarExplicitPresenceIgnoreDefaultWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarExplicitPresenceIgnoreDefaultWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/implicit_presence/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.EditionsScalarImplicitPresenceIgnoreUnspecified{Val: 123}, Expected: results.Success(true), }, "proto/2023/scalar/implicit_presence/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarImplicitPresenceIgnoreUnspecified{Val: -123}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarImplicitPresenceIgnoreUnspecified{Val: -123}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/implicit_presence/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.EditionsScalarImplicitPresenceIgnoreUnspecified{Val: 0}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarImplicitPresenceIgnoreUnspecified{Val: 0}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/implicit_presence/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsScalarImplicitPresenceIgnoreEmpty{Val: 123}, Expected: results.Success(true), }, "proto/2023/scalar/implicit_presence/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarImplicitPresenceIgnoreEmpty{Val: -123}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarImplicitPresenceIgnoreEmpty{Val: -123}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/implicit_presence/ignore_empty/valid/default": suites.Case{ Message: &cases.EditionsScalarImplicitPresenceIgnoreEmpty{Val: 0}, @@ -1253,8 +1749,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/implicit_presence/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarImplicitPresenceIgnoreDefault{Val: -123}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarImplicitPresenceIgnoreDefault{Val: -123}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/implicit_presence/ignore_default/valid/default": suites.Case{ Message: &cases.EditionsScalarImplicitPresenceIgnoreDefault{Val: 0}, @@ -1265,64 +1765,108 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/legacy_required/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecified{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecified{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/legacy_required/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecified{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecified{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/required_with_default/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(123)}, Expected: results.Success(true), }, "proto/2023/scalar/required_with_default/ignore_unspecified/invalid/default": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/required_with_default/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/required_with_default/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/legacy_required/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreEmpty{Val: proto.Int32(123)}, Expected: results.Success(true), }, "proto/2023/scalar/legacy_required/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreEmpty{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreEmpty{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/legacy_required/ignore_empty/invalid/default": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreEmpty{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreEmpty{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/required_with_default/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreEmptyWithDefault{Val: proto.Int32(123)}, Expected: results.Success(true), }, "proto/2023/scalar/required_with_default/ignore_empty/invalid/default": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/required_with_default/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/required_with_default/ignore_empty/invalid/zero": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreEmptyWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreEmptyWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/legacy_required/ignore_default/valid/populated": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreDefault{Val: proto.Int32(123)}, Expected: results.Success(true), }, "proto/2023/scalar/legacy_required/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/legacy_required/ignore_default/valid/default": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreDefault{Val: proto.Int32(0)}, @@ -1337,12 +1881,20 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/required_with_default/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/required_with_default/ignore_default/invalid/zero": suites.Case{ - Message: &cases.EditionsScalarLegacyRequiredIgnoreDefaultWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsScalarLegacyRequiredIgnoreDefaultWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/message/explicit_presence/length_prefixed/ignore_unspecified/valid/unpopulated": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceIgnoreUnspecified{}, @@ -1358,13 +1910,19 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageExplicitPresenceIgnoreUnspecified{ Val: &cases.EditionsMessageExplicitPresenceIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/explicit_presence/length_prefixed/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceIgnoreUnspecified{ Val: &cases.EditionsMessageExplicitPresenceIgnoreUnspecified_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/explicit_presence/delimited/ignore_unspecified/valid/unpopulated": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreUnspecified{}, @@ -1380,13 +1938,19 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreUnspecified{ Val: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/explicit_presence/delimited/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreUnspecified{ Val: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreUnspecified_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/explicit_presence/length_prefixed/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceIgnoreEmpty{}, @@ -1402,13 +1966,19 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageExplicitPresenceIgnoreEmpty{ Val: &cases.EditionsMessageExplicitPresenceIgnoreEmpty_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/explicit_presence/length_prefixed/ignore_empty/invalid/default": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceIgnoreEmpty{ Val: &cases.EditionsMessageExplicitPresenceIgnoreEmpty_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/explicit_presence/delimited/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreEmpty{}, @@ -1424,13 +1994,19 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreEmpty{ Val: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreEmpty_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/explicit_presence/delimited/ignore_empty/invalid/default": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreEmpty{ Val: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreEmpty_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/explicit_presence/length_prefixed/ignore_default/valid/unpopulated": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceIgnoreDefault{}, @@ -1446,7 +2022,10 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageExplicitPresenceIgnoreDefault{ Val: &cases.EditionsMessageExplicitPresenceIgnoreDefault_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/explicit_presence/length_prefixed/ignore_default/valid/default": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceIgnoreDefault{ @@ -1468,7 +2047,10 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreDefault{ Val: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreDefault_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/explicit_presence/delimited/ignore_default/valid/default": suites.Case{ Message: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreDefault{ @@ -1486,13 +2068,19 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageLegacyRequiredIgnoreUnspecified{ Val: &cases.EditionsMessageLegacyRequiredIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/legacy_required/length_prefixed/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsMessageLegacyRequiredIgnoreUnspecified{ Val: &cases.EditionsMessageLegacyRequiredIgnoreUnspecified_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/legacy_required/delimited/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreUnspecified{ @@ -1504,13 +2092,19 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreUnspecified{ Val: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/legacy_required/delimited/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreUnspecified{ Val: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreUnspecified_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/legacy_required/length_prefixed/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsMessageLegacyRequiredIgnoreEmpty{ @@ -1522,13 +2116,19 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageLegacyRequiredIgnoreEmpty{ Val: &cases.EditionsMessageLegacyRequiredIgnoreEmpty_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/legacy_required/length_prefixed/ignore_empty/invalid/default": suites.Case{ Message: &cases.EditionsMessageLegacyRequiredIgnoreEmpty{ Val: &cases.EditionsMessageLegacyRequiredIgnoreEmpty_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/legacy_required/delimited/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreEmpty{ @@ -1540,13 +2140,19 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreEmpty{ Val: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreEmpty_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/legacy_required/delimited/ignore_empty/invalid/default": suites.Case{ Message: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreEmpty{ Val: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreEmpty_Msg{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/legacy_required/length_prefixed/ignore_default/valid/populated": suites.Case{ Message: &cases.EditionsMessageLegacyRequiredIgnoreDefault{ @@ -1558,7 +2164,10 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageLegacyRequiredIgnoreDefault{ Val: &cases.EditionsMessageLegacyRequiredIgnoreDefault_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/legacy_required/length_prefixed/ignore_default/valid/default": suites.Case{ Message: &cases.EditionsMessageLegacyRequiredIgnoreDefault{ @@ -1576,7 +2185,10 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreDefault{ Val: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreDefault_Msg{Val: proto.String("bar")}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("proto.editions.message.ignore.empty"), + }), }, "proto/2023/message/legacy_required/delimited/ignore_default/valid/default": suites.Case{ Message: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreDefault{ @@ -1598,13 +2210,21 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsOneofIgnoreUnspecified{ O: &cases.EditionsOneofIgnoreUnspecified_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsOneofIgnoreUnspecified{ O: &cases.EditionsOneofIgnoreUnspecified_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof_with_default/ignore_unspecified/valid/unpopulated": suites.Case{ Message: &cases.EditionsOneofIgnoreUnspecifiedWithDefault{}, @@ -1620,19 +2240,31 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsOneofIgnoreUnspecifiedWithDefault{ O: &cases.EditionsOneofIgnoreUnspecifiedWithDefault_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof_with_default/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsOneofIgnoreUnspecifiedWithDefault{ O: &cases.EditionsOneofIgnoreUnspecifiedWithDefault_Val{Val: -42}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof_with_default/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.EditionsOneofIgnoreUnspecifiedWithDefault{ O: &cases.EditionsOneofIgnoreUnspecifiedWithDefault_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.EditionsOneofIgnoreEmpty{}, @@ -1648,13 +2280,21 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsOneofIgnoreEmpty{ O: &cases.EditionsOneofIgnoreEmpty_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof/ignore_empty/invalid/default": suites.Case{ Message: &cases.EditionsOneofIgnoreEmpty{ O: &cases.EditionsOneofIgnoreEmpty_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof_with_default/ignore_empty/valid/unpopulated": suites.Case{ Message: &cases.EditionsOneofIgnoreEmptyWithDefault{}, @@ -1670,19 +2310,31 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsOneofIgnoreEmptyWithDefault{ O: &cases.EditionsOneofIgnoreEmptyWithDefault_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof_with_default/ignore_empty/invalid/default": suites.Case{ Message: &cases.EditionsOneofIgnoreEmptyWithDefault{ O: &cases.EditionsOneofIgnoreEmptyWithDefault_Val{Val: -42}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof_with_default/ignore_empty/invalid/zero": suites.Case{ Message: &cases.EditionsOneofIgnoreEmptyWithDefault{ O: &cases.EditionsOneofIgnoreEmptyWithDefault_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof/ignore_default/valid/unpopulated": suites.Case{ Message: &cases.EditionsOneofIgnoreDefault{}, @@ -1698,7 +2350,11 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsOneofIgnoreDefault{ O: &cases.EditionsOneofIgnoreDefault_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof/ignore_default/valid/default": suites.Case{ Message: &cases.EditionsOneofIgnoreDefault{ @@ -1720,7 +2376,11 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsOneofIgnoreDefaultWithDefault{ O: &cases.EditionsOneofIgnoreDefaultWithDefault_Val{Val: -123}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof_with_default/ignore_default/valid/default": suites.Case{ Message: &cases.EditionsOneofIgnoreDefaultWithDefault{ @@ -1732,27 +2392,47 @@ func ignoreSuite() suites.Suite { Message: &cases.EditionsOneofIgnoreDefaultWithDefault{ O: &cases.EditionsOneofIgnoreDefaultWithDefault_Val{}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/repeated/compact/ignore_unspecified/invalid/unpopulated": suites.Case{ - Message: &cases.EditionsRepeatedIgnoreUnspecified{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.EditionsRepeatedIgnoreUnspecified{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto/2023/repeated/compact/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedIgnoreUnspecified{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.EditionsRepeatedIgnoreUnspecified{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto/2023/repeated/compact/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.EditionsRepeatedIgnoreUnspecified{Val: []int32{1, 2, 3}}, Expected: results.Success(true), }, "proto/2023/repeated/expanded/ignore_unspecified/invalid/unpopulated": suites.Case{ - Message: &cases.EditionsRepeatedExpandedIgnoreUnspecified{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.EditionsRepeatedExpandedIgnoreUnspecified{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto/2023/repeated/expanded/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedExpandedIgnoreUnspecified{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.EditionsRepeatedExpandedIgnoreUnspecified{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto/2023/repeated/expanded/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.EditionsRepeatedExpandedIgnoreUnspecified{Val: []int32{1, 2, 3}}, @@ -1763,8 +2443,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/repeated/compact/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedIgnoreEmpty{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.EditionsRepeatedIgnoreEmpty{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto/2023/repeated/compact/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsRepeatedIgnoreEmpty{Val: []int32{1, 2, 3}}, @@ -1775,8 +2459,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/repeated/expanded/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedExpandedIgnoreEmpty{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.EditionsRepeatedExpandedIgnoreEmpty{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto/2023/repeated/expanded/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsRepeatedExpandedIgnoreEmpty{Val: []int32{1, 2, 3}}, @@ -1787,8 +2475,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/repeated/compact/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedIgnoreDefault{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.EditionsRepeatedIgnoreDefault{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto/2023/repeated/compact/ignore_default/valid/populated": suites.Case{ Message: &cases.EditionsRepeatedIgnoreDefault{Val: []int32{1, 2, 3}}, @@ -1799,20 +2491,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/repeated/expanded/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedExpandedIgnoreDefault{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.EditionsRepeatedExpandedIgnoreDefault{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto/2023/repeated/expanded/ignore_default/valid/populated": suites.Case{ Message: &cases.EditionsRepeatedExpandedIgnoreDefault{Val: []int32{1, 2, 3}}, Expected: results.Success(true), }, "proto/2023/map/ignore_unspecified/invalid/unpopulated": suites.Case{ - Message: &cases.EditionsMapIgnoreUnspecified{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.EditionsMapIgnoreUnspecified{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto/2023/map/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsMapIgnoreUnspecified{Val: map[int32]int32{1: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.EditionsMapIgnoreUnspecified{Val: map[int32]int32{1: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto/2023/map/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.EditionsMapIgnoreUnspecified{Val: map[int32]int32{1: 1, 2: 2, 3: 3}}, @@ -1823,8 +2527,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/map/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsMapIgnoreEmpty{Val: map[int32]int32{1: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.EditionsMapIgnoreEmpty{Val: map[int32]int32{1: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto/2023/map/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsMapIgnoreEmpty{Val: map[int32]int32{1: 1, 2: 2, 3: 3}}, @@ -1835,8 +2543,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/map/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsMapIgnoreDefault{Val: map[int32]int32{1: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.EditionsMapIgnoreDefault{Val: map[int32]int32{1: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto/2023/map/ignore_default/valid/populated": suites.Case{ Message: &cases.EditionsMapIgnoreDefault{Val: map[int32]int32{1: 1, 2: 2, 3: 3}}, @@ -1847,32 +2559,52 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/repeated/compact/items/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedItemIgnoreUnspecified{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsRepeatedItemIgnoreUnspecified{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/repeated/compact/items/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.EditionsRepeatedItemIgnoreUnspecified{Val: []int32{0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsRepeatedItemIgnoreUnspecified{Val: []int32{0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/repeated/expanded/items/ignore_unspecified/valid/populated": suites.Case{ Message: &cases.EditionsRepeatedExpandedItemIgnoreUnspecified{Val: []int32{1}}, Expected: results.Success(true), }, "proto/2023/repeated/expanded/items/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedExpandedItemIgnoreUnspecified{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsRepeatedExpandedItemIgnoreUnspecified{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/repeated/expanded/items/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.EditionsRepeatedExpandedItemIgnoreUnspecified{Val: []int32{0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsRepeatedExpandedItemIgnoreUnspecified{Val: []int32{0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/repeated/compact/items/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsRepeatedItemIgnoreEmpty{Val: []int32{1}}, Expected: results.Success(true), }, "proto/2023/repeated/compact/items/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedItemIgnoreEmpty{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsRepeatedItemIgnoreEmpty{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/repeated/compact/items/ignore_empty/valid/zero": suites.Case{ Message: &cases.EditionsRepeatedItemIgnoreEmpty{Val: []int32{0}}, @@ -1883,8 +2615,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/repeated/expanded/items/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedExpandedItemIgnoreEmpty{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsRepeatedExpandedItemIgnoreEmpty{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/repeated/expanded/items/ignore_empty/valid/zero": suites.Case{ Message: &cases.EditionsRepeatedExpandedItemIgnoreEmpty{Val: []int32{0}}, @@ -1895,8 +2631,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/repeated/compact/items/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedItemIgnoreDefault{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsRepeatedItemIgnoreDefault{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/repeated/compact/items/ignore_default/valid/zero": suites.Case{ Message: &cases.EditionsRepeatedItemIgnoreDefault{Val: []int32{0}}, @@ -1907,8 +2647,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/repeated/expanded/items/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsRepeatedExpandedItemIgnoreDefault{Val: []int32{-42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsRepeatedExpandedItemIgnoreDefault{Val: []int32{-42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/repeated/expanded/items/ignore_default/valid/zero": suites.Case{ Message: &cases.EditionsRepeatedExpandedItemIgnoreDefault{Val: []int32{0}}, @@ -1919,20 +2663,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/map/keys/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsMapKeyIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsMapKeyIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/map/keys/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.EditionsMapKeyIgnoreUnspecified{Val: map[int32]int32{0: 0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsMapKeyIgnoreUnspecified{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/map/keys/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsMapKeyIgnoreEmpty{Val: map[int32]int32{1: 1}}, Expected: results.Success(true), }, "proto/2023/map/keys/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsMapKeyIgnoreEmpty{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsMapKeyIgnoreEmpty{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/map/keys/ignore_empty/valid/zero": suites.Case{ Message: &cases.EditionsMapKeyIgnoreEmpty{Val: map[int32]int32{0: 0}}, @@ -1943,8 +2699,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/map/keys/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsMapKeyIgnoreDefault{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsMapKeyIgnoreDefault{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/map/keys/ignore_default/valid/zero": suites.Case{ Message: &cases.EditionsMapKeyIgnoreDefault{Val: map[int32]int32{0: 0}}, @@ -1955,20 +2715,32 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/map/values/ignore_unspecified/invalid/populated": suites.Case{ - Message: &cases.EditionsMapValueIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsMapValueIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/map/values/ignore_unspecified/invalid/zero": suites.Case{ - Message: &cases.EditionsMapValueIgnoreUnspecified{Val: map[int32]int32{0: 0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsMapValueIgnoreUnspecified{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/map/values/ignore_empty/valid/populated": suites.Case{ Message: &cases.EditionsMapValueIgnoreEmpty{Val: map[int32]int32{1: 1}}, Expected: results.Success(true), }, "proto/2023/map/values/ignore_empty/invalid/populated": suites.Case{ - Message: &cases.EditionsMapValueIgnoreEmpty{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsMapValueIgnoreEmpty{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/map/values/ignore_empty/valid/zero": suites.Case{ Message: &cases.EditionsMapValueIgnoreEmpty{Val: map[int32]int32{0: 0}}, @@ -1979,8 +2751,12 @@ func ignoreSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/map/values/ignore_default/invalid/populated": suites.Case{ - Message: &cases.EditionsMapValueIgnoreDefault{Val: map[int32]int32{-42: -42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[-42]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.EditionsMapValueIgnoreDefault{Val: map[int32]int32{-42: -42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[-42]"), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/map/values/ignore_default/valid/zero": suites.Case{ Message: &cases.EditionsMapValueIgnoreDefault{Val: map[int32]int32{0: 0}}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go b/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go index 21c4eaca..1dfee591 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go +++ b/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go @@ -29,12 +29,20 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/optional/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyProto2ScalarOptional{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyProto2ScalarOptional{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional/zero": suites.Case{ - Message: &cases.IgnoreEmptyProto2ScalarOptional{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyProto2ScalarOptional{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional/unset": suites.Case{ Message: &cases.IgnoreEmptyProto2ScalarOptional{}, @@ -45,12 +53,20 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/optional_with_default/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional_with_default/zero": suites.Case{ - Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/optional_with_default/default": suites.Case{ Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(42)}, @@ -65,20 +81,31 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/required/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyProto2ScalarRequired{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyProto2ScalarRequired{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/scalar/required/zero": suites.Case{ - Message: &cases.IgnoreEmptyProto2ScalarRequired{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyProto2ScalarRequired{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/message/nonzero": suites.Case{ Message: &cases.IgnoreEmptyProto2Message{Val: &cases.IgnoreEmptyProto2Message_Msg{Val: proto.String("foo")}}, Expected: results.Success(true), }, "proto2/message/zero": suites.Case{ - Message: &cases.IgnoreEmptyProto2Message{Val: &cases.IgnoreEmptyProto2Message_Msg{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("ignore_empty.proto2.message")}), + Message: &cases.IgnoreEmptyProto2Message{Val: &cases.IgnoreEmptyProto2Message_Msg{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("ignore_empty.proto2.message"), + }), }, "proto2/message/unset": suites.Case{ Message: &cases.IgnoreEmptyProto2Message{}, @@ -89,8 +116,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto2/oneof/zero": suites.Case{ - Message: &cases.IgnoreEmptyProto2Oneof{O: &cases.IgnoreEmptyProto2Oneof_Val{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyProto2Oneof{O: &cases.IgnoreEmptyProto2Oneof_Val{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto2/oneof/unset": suites.Case{ Message: &cases.IgnoreEmptyProto2Oneof{}, @@ -101,8 +132,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto2/repeated/noempty/invalid": suites.Case{ - Message: &cases.IgnoreEmptyProto2Repeated{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.IgnoreEmptyProto2Repeated{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto2/repeated/empty": suites.Case{ Message: &cases.IgnoreEmptyProto2Repeated{}, @@ -113,8 +148,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto2/map/nonempty/invalid": suites.Case{ - Message: &cases.IgnoreEmptyProto2Map{Val: map[int32]int32{0: 0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.IgnoreEmptyProto2Map{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto2/map/empty": suites.Case{ Message: &cases.IgnoreEmptyProto2Map{}, @@ -125,8 +164,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto3/scalar/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyProto3Scalar{Val: -42}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyProto3Scalar{Val: -42}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/zero": suites.Case{ Message: &cases.IgnoreEmptyProto3Scalar{Val: 0}, @@ -137,8 +180,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto3/scalar/optional/zero": suites.Case{ - Message: &cases.IgnoreEmptyProto3OptionalScalar{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyProto3OptionalScalar{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/scalar/optional/unset": suites.Case{ Message: &cases.IgnoreEmptyProto3OptionalScalar{}, @@ -149,8 +196,11 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto3/message/zero": suites.Case{ - Message: &cases.IgnoreEmptyProto3Message{Val: &cases.IgnoreEmptyProto3Message_Msg{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("ignore_empty.proto3.message")}), + Message: &cases.IgnoreEmptyProto3Message{Val: &cases.IgnoreEmptyProto3Message_Msg{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("ignore_empty.proto3.message"), + }), }, "proto3/message/unset": suites.Case{ Message: &cases.IgnoreEmptyProto3Message{}, @@ -161,8 +211,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto3/oneof/zero": suites.Case{ - Message: &cases.IgnoreEmptyProto3Oneof{O: &cases.IgnoreEmptyProto3Oneof_Val{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyProto3Oneof{O: &cases.IgnoreEmptyProto3Oneof_Val{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/oneof/unset": suites.Case{ Message: &cases.IgnoreEmptyProto3Oneof{}, @@ -173,8 +227,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto3/repeated/noempty/invalid": suites.Case{ - Message: &cases.IgnoreEmptyProto3Repeated{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.IgnoreEmptyProto3Repeated{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto3/repeated/empty": suites.Case{ Message: &cases.IgnoreEmptyProto3Repeated{}, @@ -185,8 +243,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto3/map/nonempty/invalid": suites.Case{ - Message: &cases.IgnoreEmptyProto3Map{Val: map[int32]int32{0: 0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.IgnoreEmptyProto3Map{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto3/map/empty": suites.Case{ Message: &cases.IgnoreEmptyProto3Map{}, @@ -201,8 +263,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto3/repeated/items/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyRepeatedItems{Val: []int32{-1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val[0]"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyRepeatedItems{Val: []int32{-1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto3/map/keys/zero": suites.Case{ Message: &cases.IgnoreEmptyMapPairs{Val: map[string]int32{"": 42}}, @@ -213,8 +279,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto3/map/keys/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyMapPairs{Val: map[string]int32{"x": 42}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String(`val["x"]`), ForKey: proto.Bool(true), ConstraintId: proto.String("string.min_len")}), + Message: &cases.IgnoreEmptyMapPairs{Val: map[string]int32{"x": 42}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String(`val["x"]`), ForKey: proto.Bool(true), + RulePath: proto.String("map.keys.string.min_len"), + ConstraintId: proto.String("string.min_len"), + }), }, "proto3/map/values/zero": suites.Case{ Message: &cases.IgnoreEmptyMapPairs{Val: map[string]int32{"foo": 0}}, @@ -225,20 +295,32 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto3/map/values/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyMapPairs{Val: map[string]int32{"foo": -1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String(`val["foo"]`), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyMapPairs{Val: map[string]int32{"foo": -1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String(`val["foo"]`), + RulePath: proto.String("map.values.int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence/nonzero/valid": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarExplicitPresence{Val: proto.Int32(42)}, Expected: results.Success(true), }, "proto/2023/scalar/explicit_presence/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyEditionsScalarExplicitPresence{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyEditionsScalarExplicitPresence{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence/zero": suites.Case{ - Message: &cases.IgnoreEmptyEditionsScalarExplicitPresence{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyEditionsScalarExplicitPresence{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence/unset": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarExplicitPresence{}, @@ -249,12 +331,20 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/explicit_presence_with_default/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyEditionsScalarExplicitPresenceWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyEditionsScalarExplicitPresenceWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence_with_default/zero": suites.Case{ - Message: &cases.IgnoreEmptyEditionsScalarExplicitPresenceWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyEditionsScalarExplicitPresenceWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/explicit_presence_with_default/default": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarExplicitPresenceWithDefault{Val: proto.Int32(42)}, @@ -269,8 +359,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/implicit_presence/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyEditionsScalarImplicitPresence{Val: -42}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyEditionsScalarImplicitPresence{Val: -42}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/implicit_presence/zero": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarImplicitPresence{Val: 0}, @@ -281,32 +375,51 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/legacy_required/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyEditionsScalarLegacyRequired{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyEditionsScalarLegacyRequired{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/legacy_required/zero": suites.Case{ - Message: &cases.IgnoreEmptyEditionsScalarLegacyRequired{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyEditionsScalarLegacyRequired{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/legacy_required_with_default/nonzero/valid": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarLegacyRequiredWithDefault{Val: proto.Int32(42)}, Expected: results.Success(true), }, "proto/2023/scalar/legacy_required_with_default/nonzero/invalid": suites.Case{ - Message: &cases.IgnoreEmptyEditionsScalarLegacyRequiredWithDefault{Val: proto.Int32(-42)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyEditionsScalarLegacyRequiredWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/scalar/legacy_required_with_default/zero": suites.Case{ - Message: &cases.IgnoreEmptyEditionsScalarLegacyRequiredWithDefault{Val: proto.Int32(0)}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyEditionsScalarLegacyRequiredWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/message/explicit_presence/length_prefixed/nonzero": suites.Case{ Message: &cases.IgnoreEmptyEditionsMessageExplicitPresence{Val: &cases.IgnoreEmptyEditionsMessageExplicitPresence_Msg{Val: proto.String("foo")}}, Expected: results.Success(true), }, "proto/2023/message/explicit_presence/length_prefixed/zero": suites.Case{ - Message: &cases.IgnoreEmptyEditionsMessageExplicitPresence{Val: &cases.IgnoreEmptyEditionsMessageExplicitPresence_Msg{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("ignore_empty.editions.message")}), + Message: &cases.IgnoreEmptyEditionsMessageExplicitPresence{Val: &cases.IgnoreEmptyEditionsMessageExplicitPresence_Msg{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("ignore_empty.editions.message"), + }), }, "proto/2023/message/explicit_presence/length_prefixed/unset": suites.Case{ Message: &cases.IgnoreEmptyEditionsMessageExplicitPresence{}, @@ -317,8 +430,11 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/message/explicit_presence/delimited/zero": suites.Case{ - Message: &cases.IgnoreEmptyEditionsMessageExplicitPresenceDelimited{Val: &cases.IgnoreEmptyEditionsMessageExplicitPresenceDelimited_Msg{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("ignore_empty.editions.message")}), + Message: &cases.IgnoreEmptyEditionsMessageExplicitPresenceDelimited{Val: &cases.IgnoreEmptyEditionsMessageExplicitPresenceDelimited_Msg{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("ignore_empty.editions.message"), + }), }, "proto/2023/message/explicit_presence/delimited/unset": suites.Case{ Message: &cases.IgnoreEmptyEditionsMessageExplicitPresenceDelimited{}, @@ -329,8 +445,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/oneof/zero": suites.Case{ - Message: &cases.IgnoreEmptyEditionsOneof{O: &cases.IgnoreEmptyEditionsOneof_Val{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.IgnoreEmptyEditionsOneof{O: &cases.IgnoreEmptyEditionsOneof_Val{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "proto/2023/oneof/unset": suites.Case{ Message: &cases.IgnoreEmptyEditionsOneof{}, @@ -341,8 +461,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/repeated/compact/noempty/invalid": suites.Case{ - Message: &cases.IgnoreEmptyEditionsRepeated{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.IgnoreEmptyEditionsRepeated{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto/2023/repeated/compact/empty": suites.Case{ Message: &cases.IgnoreEmptyEditionsRepeated{}, @@ -353,8 +477,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/repeated/expanded/noempty/invalid": suites.Case{ - Message: &cases.IgnoreEmptyEditionsRepeatedExpanded{Val: []int32{1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("repeated.min_items")}), + Message: &cases.IgnoreEmptyEditionsRepeatedExpanded{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), + ConstraintId: proto.String("repeated.min_items"), + }), }, "proto/2023/repeated/expanded/empty": suites.Case{ Message: &cases.IgnoreEmptyEditionsRepeatedExpanded{}, @@ -365,8 +493,12 @@ func ignoreEmptySuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/map/nonempty/invalid": suites.Case{ - Message: &cases.IgnoreEmptyEditionsMap{Val: map[int32]int32{0: 0}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("map.min_pairs")}), + Message: &cases.IgnoreEmptyEditionsMap{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), + ConstraintId: proto.String("map.min_pairs"), + }), }, "proto/2023/map/empty": suites.Case{ Message: &cases.IgnoreEmptyEditionsMap{}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_int32.go b/tools/protovalidate-conformance/internal/cases/cases_int32.go index b3e12d57..2891c9c6 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_int32.go +++ b/tools/protovalidate-conformance/internal/cases/cases_int32.go @@ -35,7 +35,12 @@ func int32Suite() suites.Suite { "const/invalid": { Message: &cases.Int32Const{Val: 2}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.const"), + ConstraintId: proto.String("int32.const"), + }, + ), }, "in/valid": { Message: &cases.Int32In{Val: 3}, @@ -44,7 +49,12 @@ func int32Suite() suites.Suite { "in/invalid": { Message: &cases.Int32In{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.in"), + ConstraintId: proto.String("int32.in"), + }, + ), }, "not_in/valid": { Message: &cases.Int32NotIn{Val: 1}, @@ -53,7 +63,12 @@ func int32Suite() suites.Suite { "not_in/invalid": { Message: &cases.Int32NotIn{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.not_in"), + ConstraintId: proto.String("int32.not_in"), + }, + ), }, "lt/valid/less": { Message: &cases.Int32LT{Val: -1}, @@ -62,12 +77,22 @@ func int32Suite() suites.Suite { "lt/invalid/equal": { Message: &cases.Int32LT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.lt"), + ConstraintId: proto.String("int32.lt"), + }, + ), }, "lt/invalid/greater": { Message: &cases.Int32LT{Val: 1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.lt"), + ConstraintId: proto.String("int32.lt"), + }, + ), }, "lte/valid/less": { Message: &cases.Int32LTE{Val: 63}, @@ -80,7 +105,12 @@ func int32Suite() suites.Suite { "lte/invalid/greater": { Message: &cases.Int32LTE{Val: 65}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.lte"), + ConstraintId: proto.String("int32.lte"), + }, + ), }, "gt/valid/greater": { Message: &cases.Int32GT{Val: 17}, @@ -89,12 +119,22 @@ func int32Suite() suites.Suite { "gt/invalid/equal": { Message: &cases.Int32GT{Val: 16}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }, + ), }, "gt/invalid/less": { Message: &cases.Int32GT{Val: 15}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }, + ), }, "gte/valid/greater": { Message: &cases.Int32GTE{Val: 9}, @@ -107,7 +147,12 @@ func int32Suite() suites.Suite { "gte/invalid/less": { Message: &cases.Int32GTE{Val: 7}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gte"), + ConstraintId: proto.String("int32.gte"), + }, + ), }, "gt_lt/inclusive/valid/within": { Message: &cases.Int32GTLT{Val: 5}, @@ -116,22 +161,42 @@ func int32Suite() suites.Suite { "gt_lt/inclusive/invalid/above": { Message: &cases.Int32GTLT{Val: 11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/below": { Message: &cases.Int32GTLT{Val: -1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/max": { Message: &cases.Int32GTLT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/min": { Message: &cases.Int32GTLT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt_lt"), + }, + ), }, "gt_lt/exclusive/valid/above": { Message: &cases.Int32ExLTGT{Val: 11}, @@ -144,17 +209,32 @@ func int32Suite() suites.Suite { "gt_lt/exclusive/invalid/within": { Message: &cases.Int32ExLTGT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/max": { Message: &cases.Int32ExLTGT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/min": { Message: &cases.Int32ExLTGT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt_lt_exclusive"), + }, + ), }, "gte_lte/inclusive/valid/within": { Message: &cases.Int32GTELTE{Val: 200}, @@ -171,12 +251,22 @@ func int32Suite() suites.Suite { "gte_lte/inclusive/invalid/above": { Message: &cases.Int32GTELTE{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gte"), + ConstraintId: proto.String("int32.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/below": { Message: &cases.Int32GTELTE{Val: 100}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gte"), + ConstraintId: proto.String("int32.gte_lte"), + }, + ), }, "gte_lte/exclusive/valid/above": { Message: &cases.Int32ExGTELTE{Val: 300}, @@ -197,7 +287,12 @@ func int32Suite() suites.Suite { "gte_lte/exclusive/invalid/within": { Message: &cases.Int32ExGTELTE{Val: 200}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gte"), + ConstraintId: proto.String("int32.gte_lte_exclusive"), + }, + ), }, "ignore_empty/valid/empty": { Message: &cases.Int32Ignore{Val: 0}, @@ -210,7 +305,12 @@ func int32Suite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.Int32Ignore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int32.gte"), + ConstraintId: proto.String("int32.gte_lte"), + }, + ), }, "compilation/wrong_type": { Message: &cases.Int32IncorrectType{Val: 123}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_int64.go b/tools/protovalidate-conformance/internal/cases/cases_int64.go index 7abc829f..1674a218 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_int64.go +++ b/tools/protovalidate-conformance/internal/cases/cases_int64.go @@ -35,7 +35,12 @@ func int64Suite() suites.Suite { "const/invalid": { Message: &cases.Int64Const{Val: 2}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.const"), + ConstraintId: proto.String("int64.const"), + }, + ), }, "in/valid": { Message: &cases.Int64In{Val: 3}, @@ -44,7 +49,12 @@ func int64Suite() suites.Suite { "in/invalid": { Message: &cases.Int64In{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.in"), + ConstraintId: proto.String("int64.in"), + }, + ), }, "not_in/valid": { Message: &cases.Int64NotIn{Val: 1}, @@ -53,7 +63,12 @@ func int64Suite() suites.Suite { "not_in/invalid": { Message: &cases.Int64NotIn{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.not_in"), + ConstraintId: proto.String("int64.not_in"), + }, + ), }, "lt/valid/less": { Message: &cases.Int64LT{Val: -1}, @@ -62,12 +77,22 @@ func int64Suite() suites.Suite { "lt/invalid/equal": { Message: &cases.Int64LT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.lt"), + ConstraintId: proto.String("int64.lt"), + }, + ), }, "lt/invalid/greater": { Message: &cases.Int64LT{Val: 1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.lt"), + ConstraintId: proto.String("int64.lt"), + }, + ), }, "lte/valid/less": { Message: &cases.Int64LTE{Val: 63}, @@ -80,7 +105,12 @@ func int64Suite() suites.Suite { "lte/invalid/greater": { Message: &cases.Int64LTE{Val: 65}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.lte"), + ConstraintId: proto.String("int64.lte"), + }, + ), }, "gt/valid/greater": { Message: &cases.Int64GT{Val: 17}, @@ -89,12 +119,22 @@ func int64Suite() suites.Suite { "gt/invalid/equal": { Message: &cases.Int64GT{Val: 16}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gt"), + ConstraintId: proto.String("int64.gt"), + }, + ), }, "gt/invalid/less": { Message: &cases.Int64GT{Val: 15}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gt"), + ConstraintId: proto.String("int64.gt"), + }, + ), }, "gte/valid/greater": { Message: &cases.Int64GTE{Val: 9}, @@ -107,7 +147,12 @@ func int64Suite() suites.Suite { "gte/invalid/less": { Message: &cases.Int64GTE{Val: 7}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gte"), + ConstraintId: proto.String("int64.gte"), + }, + ), }, "gt_lt/inclusive/valid/within": { Message: &cases.Int64GTLT{Val: 5}, @@ -116,22 +161,42 @@ func int64Suite() suites.Suite { "gt_lt/inclusive/invalid/above": { Message: &cases.Int64GTLT{Val: 11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gt"), + ConstraintId: proto.String("int64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/below": { Message: &cases.Int64GTLT{Val: -1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gt"), + ConstraintId: proto.String("int64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/max": { Message: &cases.Int64GTLT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gt"), + ConstraintId: proto.String("int64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/min": { Message: &cases.Int64GTLT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gt"), + ConstraintId: proto.String("int64.gt_lt"), + }, + ), }, "gt_lt/exclusive/valid/above": { Message: &cases.Int64ExLTGT{Val: 11}, @@ -144,17 +209,32 @@ func int64Suite() suites.Suite { "gt_lt/exclusive/invalid/within": { Message: &cases.Int64ExLTGT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gt"), + ConstraintId: proto.String("int64.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/max": { Message: &cases.Int64ExLTGT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gt"), + ConstraintId: proto.String("int64.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/min": { Message: &cases.Int64ExLTGT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gt"), + ConstraintId: proto.String("int64.gt_lt_exclusive"), + }, + ), }, "gte_lte/inclusive/valid/within": { Message: &cases.Int64GTELTE{Val: 200}, @@ -171,12 +251,22 @@ func int64Suite() suites.Suite { "gte_lte/inclusive/invalid/above": { Message: &cases.Int64GTELTE{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gte"), + ConstraintId: proto.String("int64.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/below": { Message: &cases.Int64GTELTE{Val: 100}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gte"), + ConstraintId: proto.String("int64.gte_lte"), + }, + ), }, "gte_lte/exclusive/valid/above": { Message: &cases.Int64ExGTELTE{Val: 300}, @@ -197,7 +287,12 @@ func int64Suite() suites.Suite { "gte_lte/exclusive/invalid/within": { Message: &cases.Int64ExGTELTE{Val: 200}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gte"), + ConstraintId: proto.String("int64.gte_lte_exclusive"), + }, + ), }, "ignore_empty/valid/empty": { Message: &cases.Int64Ignore{Val: 0}, @@ -210,7 +305,12 @@ func int64Suite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.Int64Ignore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("int64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("int64.gte"), + ConstraintId: proto.String("int64.gte_lte"), + }, + ), }, "big_constraints/valid": { Message: &cases.Int64BigConstraints{ diff --git a/tools/protovalidate-conformance/internal/cases/cases_kitchensink.go b/tools/protovalidate-conformance/internal/cases/cases_kitchensink.go index 699333fc..35f80d06 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_kitchensink.go +++ b/tools/protovalidate-conformance/internal/cases/cases_kitchensink.go @@ -41,36 +41,43 @@ func kitchenSinkSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val.bytes_val"), + RulePath: proto.String("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ FieldPath: proto.String("val.double_in"), + RulePath: proto.String("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ FieldPath: proto.String("val.enum_const"), + RulePath: proto.String("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ FieldPath: proto.String("val.int_const"), + RulePath: proto.String("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ FieldPath: proto.String("val.o"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ FieldPath: proto.String("val.dur_val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ FieldPath: proto.String("val.const"), + RulePath: proto.String("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `abcd`"), }, @@ -81,71 +88,85 @@ func kitchenSinkSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val.another.bytes_val"), + RulePath: proto.String("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ FieldPath: proto.String("val.bytes_val"), + RulePath: proto.String("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ FieldPath: proto.String("val.another.double_in"), + RulePath: proto.String("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ FieldPath: proto.String("val.double_in"), + RulePath: proto.String("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ FieldPath: proto.String("val.another.enum_const"), + RulePath: proto.String("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ FieldPath: proto.String("val.enum_const"), + RulePath: proto.String("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ FieldPath: proto.String("val.another.int_const"), + RulePath: proto.String("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ FieldPath: proto.String("val.int_const"), + RulePath: proto.String("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ FieldPath: proto.String("val.o"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ FieldPath: proto.String("val.another.o"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ FieldPath: proto.String("val.another.dur_val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ FieldPath: proto.String("val.dur_val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ FieldPath: proto.String("val.another.const"), + RulePath: proto.String("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `abcd`"), }, &validate.Violation{ FieldPath: proto.String("val.const"), + RulePath: proto.String("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `abcd`"), }, @@ -156,71 +177,85 @@ func kitchenSinkSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val.bool_const"), + RulePath: proto.String("bool.const"), ConstraintId: proto.String("bool.const"), Message: proto.String("value must equal false"), }, &validate.Violation{ FieldPath: proto.String("val.bytes_val"), + RulePath: proto.String("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ FieldPath: proto.String("val.nested.bytes_val"), + RulePath: proto.String("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ FieldPath: proto.String("val.double_in"), + RulePath: proto.String("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ FieldPath: proto.String("val.nested.double_in"), + RulePath: proto.String("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ FieldPath: proto.String("val.enum_const"), + RulePath: proto.String("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ FieldPath: proto.String("val.nested.enum_const"), + RulePath: proto.String("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ FieldPath: proto.String("val.int_const"), + RulePath: proto.String("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ FieldPath: proto.String("val.nested.int_const"), + RulePath: proto.String("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ FieldPath: proto.String("val.o"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ FieldPath: proto.String("val.dur_val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ FieldPath: proto.String("val.nested.o"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ FieldPath: proto.String("val.nested.dur_val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ FieldPath: proto.String("val.nested.const"), + RulePath: proto.String("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `abcd`"), }, @@ -231,66 +266,79 @@ func kitchenSinkSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val.any_val"), + RulePath: proto.String("any.in"), ConstraintId: proto.String("any.in"), Message: proto.String("type URL must be in the allow list"), }, &validate.Violation{ FieldPath: proto.String("val.bool_const"), + RulePath: proto.String("bool.const"), ConstraintId: proto.String("bool.const"), Message: proto.String("value must equal false"), }, &validate.Violation{ FieldPath: proto.String("val.bytes_val"), + RulePath: proto.String("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ FieldPath: proto.String("val.double_in"), + RulePath: proto.String("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ FieldPath: proto.String("val.enum_const"), + RulePath: proto.String("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ FieldPath: proto.String("val.float_val"), + RulePath: proto.String("float.gt"), ConstraintId: proto.String("float.gt"), Message: proto.String("value must be greater than 0"), }, &validate.Violation{ FieldPath: proto.String("val.float_const"), + RulePath: proto.String("float.lt"), ConstraintId: proto.String("float.lt"), Message: proto.String("value must be less than 8"), }, &validate.Violation{ FieldPath: proto.String("val.int_const"), + RulePath: proto.String("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ FieldPath: proto.String("val.o"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ FieldPath: proto.String("val.dur_val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ FieldPath: proto.String("val.const"), + RulePath: proto.String("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `abcd`"), }, &validate.Violation{ FieldPath: proto.String("val.ts_val"), + RulePath: proto.String("timestamp.gt"), ConstraintId: proto.String("timestamp.gt"), Message: proto.String("value must be greater than 1970-01-01T00:00:07Z"), }, &validate.Violation{ FieldPath: proto.String("val.rep_ts_val[0]"), + RulePath: proto.String("repeated.items.timestamp.gte"), ConstraintId: proto.String("timestamp.gte"), Message: proto.String("value must be greater than or equal to 1970-01-01T00:00:00.001Z"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_map.go b/tools/protovalidate-conformance/internal/cases/cases_map.go index a428e849..6ae7b63b 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_map.go +++ b/tools/protovalidate-conformance/internal/cases/cases_map.go @@ -41,6 +41,7 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), Message: proto.String("map must be at least 2 entries"), }, @@ -59,6 +60,7 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("map.max_pairs"), ConstraintId: proto.String("map.max_pairs"), Message: proto.String("map must be at most 3 entries"), }, @@ -81,6 +83,7 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), Message: proto.String("map must be at least 2 entries"), }, @@ -91,6 +94,7 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("map.max_pairs"), ConstraintId: proto.String("map.max_pairs"), Message: proto.String("map must be at most 4 entries"), }, @@ -105,6 +109,7 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), Message: proto.String("map must be at least 3 entries"), }, @@ -115,6 +120,7 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("map.max_pairs"), ConstraintId: proto.String("map.max_pairs"), Message: proto.String("map must be at most 3 entries"), }, @@ -137,6 +143,7 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("map.keys.sint64.lt"), ConstraintId: proto.String("sint64.lt"), Message: proto.String("value must be less than 0"), ForKey: proto.Bool(true), @@ -148,6 +155,7 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[\"!@#$%^&*()\"]"), + RulePath: proto.String("map.keys.string.pattern"), ConstraintId: proto.String("string.pattern"), Message: proto.String("value does not match regex pattern `(?i)^[a-z0-9]+$`"), ForKey: proto.Bool(true), @@ -171,11 +179,13 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[\"a\"]"), + RulePath: proto.String("map.values.string.min_len"), ConstraintId: proto.String("string.min_len"), Message: proto.String("value length must be at least 3 characters"), }, &validate.Violation{ FieldPath: proto.String("val[\"b\"]"), + RulePath: proto.String("map.values.string.min_len"), ConstraintId: proto.String("string.min_len"), Message: proto.String("value length must be at least 3 characters"), }, @@ -186,6 +196,7 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[\"b\"]"), + RulePath: proto.String("map.values.string.pattern"), ConstraintId: proto.String("string.pattern"), Message: proto.String("value does not match regex pattern `(?i)^[a-z0-9]+$`"), }, @@ -200,6 +211,7 @@ func mapSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1].val"), + RulePath: proto.String("string.min_len"), ConstraintId: proto.String("string.min_len"), Message: proto.String("value length must be at least 3 characters"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_message.go b/tools/protovalidate-conformance/internal/cases/cases_message.go index f640767b..64a933a3 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_message.go +++ b/tools/protovalidate-conformance/internal/cases/cases_message.go @@ -54,6 +54,7 @@ func messageSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val.const"), + RulePath: proto.String("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `foo`"), }, @@ -64,6 +65,7 @@ func messageSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val.nested.const"), + RulePath: proto.String("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `foo`"), }, @@ -86,6 +88,7 @@ func messageSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, @@ -96,11 +99,13 @@ func messageSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("one"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, @@ -115,6 +120,7 @@ func messageSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, @@ -133,6 +139,7 @@ func messageSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val.val"), + RulePath: proto.String("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }, @@ -143,6 +150,7 @@ func messageSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val.val"), + RulePath: proto.String("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_nested.go b/tools/protovalidate-conformance/internal/cases/cases_nested.go index 33a15219..3792bc94 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_nested.go +++ b/tools/protovalidate-conformance/internal/cases/cases_nested.go @@ -44,6 +44,7 @@ func nestedSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("two.three.uuid"), + RulePath: proto.String("string.uuid"), ConstraintId: proto.String("string.uuid"), }), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_oneof.go b/tools/protovalidate-conformance/internal/cases/cases_oneof.go index 5006c9cd..ed10f9a9 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_oneof.go +++ b/tools/protovalidate-conformance/internal/cases/cases_oneof.go @@ -49,16 +49,28 @@ func oneofSuite() suites.Suite { Expected: results.Success(true), }, "field/X/invalid": { - Message: &cases.Oneof{O: &cases.Oneof_X{X: "fizzbuzz"}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("x"), ConstraintId: proto.String("string.prefix")}), + Message: &cases.Oneof{O: &cases.Oneof_X{X: "fizzbuzz"}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("x"), + RulePath: proto.String("string.prefix"), + ConstraintId: proto.String("string.prefix"), + }), }, "field/Y/invalid": { - Message: &cases.Oneof{O: &cases.Oneof_Y{Y: -1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("y"), ConstraintId: proto.String("int32.gt")}), + Message: &cases.Oneof{O: &cases.Oneof_Y{Y: -1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("y"), + RulePath: proto.String("int32.gt"), + ConstraintId: proto.String("int32.gt"), + }), }, "filed/Z/invalid": { - Message: &cases.Oneof{O: &cases.Oneof_Z{Z: &cases.TestOneofMsg{}}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("z.val"), ConstraintId: proto.String("bool.const")}), + Message: &cases.Oneof{O: &cases.Oneof_Z{Z: &cases.TestOneofMsg{}}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("z.val"), + RulePath: proto.String("bool.const"), + ConstraintId: proto.String("bool.const"), + }), }, "required/valid/empty": { Message: &cases.OneofRequired{O: &cases.OneofRequired_X{X: ""}}, @@ -69,8 +81,12 @@ func oneofSuite() suites.Suite { Expected: results.Success(true), }, "required/invalid": { - Message: &cases.OneofRequired{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("o"), ConstraintId: proto.String("required")}), + Message: &cases.OneofRequired{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("o"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "required/required_field/valid/empty": { Message: &cases.OneofRequiredWithRequiredField{ @@ -88,13 +104,26 @@ func oneofSuite() suites.Suite { Message: &cases.OneofRequiredWithRequiredField{ O: &cases.OneofRequiredWithRequiredField_B{B: "foo"}, }, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("a"), ConstraintId: proto.String("required")}), + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("a"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "required/required_field/invalid": { Message: &cases.OneofRequiredWithRequiredField{}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("o"), ConstraintId: proto.String("required")}, - &validate.Violation{FieldPath: proto.String("a"), ConstraintId: proto.String("required")}), + &validate.Violation{ + FieldPath: proto.String("o"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }, + &validate.Violation{ + FieldPath: proto.String("a"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }, + ), }, } } diff --git a/tools/protovalidate-conformance/internal/cases/cases_predefined.go b/tools/protovalidate-conformance/internal/cases/cases_predefined.go index abb56bde..e6e137f6 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_predefined.go +++ b/tools/protovalidate-conformance/internal/cases/cases_predefined.go @@ -38,6 +38,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -52,6 +53,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -66,6 +68,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -80,6 +83,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), ConstraintId: proto.String("int64.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -94,6 +98,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -108,6 +113,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -122,6 +128,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, @@ -136,6 +143,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sint64.[buf.validate.conformance.cases.sint64_even_proto2]"), ConstraintId: proto.String("sint64.even.proto2"), Message: proto.String("sint64 value is not even"), }, @@ -150,6 +158,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.[buf.validate.conformance.cases.fixed32_even_proto2]"), ConstraintId: proto.String("fixed32.even.proto2"), Message: proto.String("fixed32 value is not even"), }, @@ -164,6 +173,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.[buf.validate.conformance.cases.fixed64_even_proto2]"), ConstraintId: proto.String("fixed64.even.proto2"), Message: proto.String("fixed64 value is not even"), }, @@ -178,6 +188,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.[buf.validate.conformance.cases.sfixed32_even_proto2]"), ConstraintId: proto.String("sfixed32.even.proto2"), Message: proto.String("sfixed32 value is not even"), }, @@ -192,6 +203,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.[buf.validate.conformance.cases.sfixed64_even_proto2]"), ConstraintId: proto.String("sfixed64.even.proto2"), Message: proto.String("sfixed64 value is not even"), }, @@ -206,6 +218,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -220,6 +233,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -234,6 +248,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -248,6 +263,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("enum.[buf.validate.conformance.cases.enum_non_zero_proto2]"), ConstraintId: proto.String("enum.non_zero.proto2"), Message: proto.String("enum value is not non-zero"), }, @@ -262,6 +278,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.[buf.validate.conformance.cases.repeated_at_least_five_proto2]"), ConstraintId: proto.String("repeated.at_least_five.proto2"), Message: proto.String("repeated field must have at least five values"), }, @@ -276,6 +293,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.[buf.validate.conformance.cases.duration_too_long_proto2]"), ConstraintId: proto.String("duration.too_long.proto2"), Message: proto.String("duration can't be longer than 10 seconds"), }, @@ -290,6 +308,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.[buf.validate.conformance.cases.timestamp_in_range_proto2]"), ConstraintId: proto.String("timestamp.time_range.proto2"), Message: proto.String("timestamp out of range"), }, @@ -304,6 +323,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -320,6 +340,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -334,6 +355,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -348,6 +370,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), ConstraintId: proto.String("int64.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -362,6 +385,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -376,6 +400,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -390,6 +415,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -404,6 +430,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -418,6 +445,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -436,6 +464,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -454,6 +483,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -472,6 +502,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -490,6 +521,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), ConstraintId: proto.String("int64.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -508,6 +540,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -526,6 +559,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -544,6 +578,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -562,6 +597,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -580,6 +616,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -604,11 +641,13 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("a"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, &validate.Violation{ FieldPath: proto.String("b.c"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, @@ -642,6 +681,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("a"), + RulePath: proto.String("sint32.lt"), ConstraintId: proto.String("sint32.lt"), Message: proto.String("value must be less than 28"), }, @@ -654,6 +694,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("a"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, @@ -680,6 +721,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -694,6 +736,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -708,6 +751,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -722,6 +766,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), ConstraintId: proto.String("int64.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -736,6 +781,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -750,6 +796,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -764,6 +811,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, @@ -778,6 +826,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sint64.[buf.validate.conformance.cases.sint64_even_proto2]"), ConstraintId: proto.String("sint64.even.proto2"), Message: proto.String("sint64 value is not even"), }, @@ -792,6 +841,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.[buf.validate.conformance.cases.fixed32_even_proto2]"), ConstraintId: proto.String("fixed32.even.proto2"), Message: proto.String("fixed32 value is not even"), }, @@ -806,6 +856,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.[buf.validate.conformance.cases.fixed64_even_proto2]"), ConstraintId: proto.String("fixed64.even.proto2"), Message: proto.String("fixed64 value is not even"), }, @@ -820,6 +871,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.[buf.validate.conformance.cases.sfixed32_even_proto2]"), ConstraintId: proto.String("sfixed32.even.proto2"), Message: proto.String("sfixed32 value is not even"), }, @@ -834,6 +886,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.[buf.validate.conformance.cases.sfixed64_even_proto2]"), ConstraintId: proto.String("sfixed64.even.proto2"), Message: proto.String("sfixed64 value is not even"), }, @@ -848,6 +901,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -862,6 +916,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -876,6 +931,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -890,6 +946,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("enum.[buf.validate.conformance.cases.enum_non_zero_proto2]"), ConstraintId: proto.String("enum.non_zero.proto2"), Message: proto.String("enum value is not non-zero"), }, @@ -904,6 +961,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.[buf.validate.conformance.cases.repeated_at_least_five_proto2]"), ConstraintId: proto.String("repeated.at_least_five.proto2"), Message: proto.String("repeated field must have at least five values"), }, @@ -918,6 +976,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("map.[buf.validate.conformance.cases.map_at_least_five_edition_2023]"), ConstraintId: proto.String("map.at_least_five.edition_2023"), Message: proto.String("map must have at least five pairs"), }, @@ -932,6 +991,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.[buf.validate.conformance.cases.duration_too_long_proto2]"), ConstraintId: proto.String("duration.too_long.proto2"), Message: proto.String("duration can't be longer than 10 seconds"), }, @@ -946,6 +1006,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.[buf.validate.conformance.cases.timestamp_in_range_proto2]"), ConstraintId: proto.String("timestamp.time_range.proto2"), Message: proto.String("timestamp out of range"), }, @@ -960,6 +1021,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -976,6 +1038,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -990,6 +1053,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -1004,6 +1068,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), ConstraintId: proto.String("int64.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -1018,6 +1083,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -1032,6 +1098,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -1046,6 +1113,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -1060,6 +1128,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1074,6 +1143,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1092,6 +1162,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -1110,6 +1181,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -1128,6 +1200,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -1146,6 +1219,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), ConstraintId: proto.String("int64.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -1164,6 +1238,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -1182,6 +1257,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -1200,6 +1276,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -1218,6 +1295,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1236,6 +1314,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1260,11 +1339,13 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("a"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, &validate.Violation{ FieldPath: proto.String("b.c"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, @@ -1298,6 +1379,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("a"), + RulePath: proto.String("sint32.lt"), ConstraintId: proto.String("sint32.lt"), Message: proto.String("value must be less than 28"), }, @@ -1310,6 +1392,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("a"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, @@ -1336,6 +1419,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_edition_2023]"), ConstraintId: proto.String("float.abs_range.edition_2023"), Message: proto.String("float value is out of range"), }, @@ -1350,6 +1434,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_edition_2023]"), ConstraintId: proto.String("double.abs_range.edition_2023"), Message: proto.String("double value is out of range"), }, @@ -1364,6 +1449,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_edition_2023]"), ConstraintId: proto.String("int32.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1378,6 +1464,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), ConstraintId: proto.String("int64.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1392,6 +1479,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_edition_2023]"), ConstraintId: proto.String("uint32.even.edition_2023"), Message: proto.String("uint32 value is not even"), }, @@ -1406,6 +1494,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_edition_2023]"), ConstraintId: proto.String("uint64.even.edition_2023"), Message: proto.String("uint64 value is not even"), }, @@ -1420,6 +1509,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, @@ -1434,6 +1524,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sint64.[buf.validate.conformance.cases.sint64_even_edition_2023]"), ConstraintId: proto.String("sint64.even.edition_2023"), Message: proto.String("sint64 value is not even"), }, @@ -1448,6 +1539,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("fixed32.[buf.validate.conformance.cases.fixed32_even_edition_2023]"), ConstraintId: proto.String("fixed32.even.edition_2023"), Message: proto.String("fixed32 value is not even"), }, @@ -1462,6 +1554,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("fixed64.[buf.validate.conformance.cases.fixed64_even_edition_2023]"), ConstraintId: proto.String("fixed64.even.edition_2023"), Message: proto.String("fixed64 value is not even"), }, @@ -1476,6 +1569,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.[buf.validate.conformance.cases.sfixed32_even_edition_2023]"), ConstraintId: proto.String("sfixed32.even.edition_2023"), Message: proto.String("sfixed32 value is not even"), }, @@ -1490,6 +1584,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.[buf.validate.conformance.cases.sfixed64_even_edition_2023]"), ConstraintId: proto.String("sfixed64.even.edition_2023"), Message: proto.String("sfixed64 value is not even"), }, @@ -1504,6 +1599,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_edition_2023]"), ConstraintId: proto.String("bool.false.edition_2023"), Message: proto.String("bool value is not false"), }, @@ -1518,6 +1614,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_edition_2023]"), ConstraintId: proto.String("string.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1532,6 +1629,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_edition_2023]"), ConstraintId: proto.String("bytes.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1546,6 +1644,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("enum.[buf.validate.conformance.cases.enum_non_zero_edition_2023]"), ConstraintId: proto.String("enum.non_zero.edition_2023"), Message: proto.String("enum value is not non-zero"), }, @@ -1560,6 +1659,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.[buf.validate.conformance.cases.repeated_at_least_five_edition_2023]"), ConstraintId: proto.String("repeated.at_least_five.edition_2023"), Message: proto.String("repeated field must have at least five values"), }, @@ -1574,6 +1674,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("map.[buf.validate.conformance.cases.map_at_least_five_edition_2023]"), ConstraintId: proto.String("map.at_least_five.edition_2023"), Message: proto.String("map must have at least five pairs"), }, @@ -1588,6 +1689,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("duration.[buf.validate.conformance.cases.duration_too_long_edition_2023]"), ConstraintId: proto.String("duration.too_long.edition_2023"), Message: proto.String("duration can't be longer than 10 seconds"), }, @@ -1602,6 +1704,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.[buf.validate.conformance.cases.timestamp_in_range_edition_2023]"), ConstraintId: proto.String("timestamp.time_range.edition_2023"), Message: proto.String("timestamp out of range"), }, @@ -1616,6 +1719,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_edition_2023]"), ConstraintId: proto.String("float.abs_range.edition_2023"), Message: proto.String("float value is out of range"), }, @@ -1632,6 +1736,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_edition_2023]"), ConstraintId: proto.String("double.abs_range.edition_2023"), Message: proto.String("double value is out of range"), }, @@ -1646,6 +1751,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_edition_2023]"), ConstraintId: proto.String("int32.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1660,6 +1766,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), ConstraintId: proto.String("int64.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1674,6 +1781,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_edition_2023]"), ConstraintId: proto.String("uint32.even.edition_2023"), Message: proto.String("uint32 value is not even"), }, @@ -1688,6 +1796,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_edition_2023]"), ConstraintId: proto.String("uint64.even.edition_2023"), Message: proto.String("uint64 value is not even"), }, @@ -1702,6 +1811,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_edition_2023]"), ConstraintId: proto.String("bool.false.edition_2023"), Message: proto.String("bool value is not false"), }, @@ -1716,6 +1826,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_edition_2023]"), ConstraintId: proto.String("string.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1730,6 +1841,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_edition_2023]"), ConstraintId: proto.String("bytes.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1748,6 +1860,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.float.[buf.validate.conformance.cases.float_abs_range_edition_2023]"), ConstraintId: proto.String("float.abs_range.edition_2023"), Message: proto.String("float value is out of range"), }, @@ -1766,6 +1879,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.double.[buf.validate.conformance.cases.double_abs_range_edition_2023]"), ConstraintId: proto.String("double.abs_range.edition_2023"), Message: proto.String("double value is out of range"), }, @@ -1784,6 +1898,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.int32.[buf.validate.conformance.cases.int32_abs_in_edition_2023]"), ConstraintId: proto.String("int32.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1802,6 +1917,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), ConstraintId: proto.String("int64.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1820,6 +1936,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.uint32.[buf.validate.conformance.cases.uint32_even_edition_2023]"), ConstraintId: proto.String("uint32.even.edition_2023"), Message: proto.String("uint32 value is not even"), }, @@ -1838,6 +1955,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.uint64.[buf.validate.conformance.cases.uint64_even_edition_2023]"), ConstraintId: proto.String("uint64.even.edition_2023"), Message: proto.String("uint64 value is not even"), }, @@ -1856,6 +1974,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.bool.[buf.validate.conformance.cases.bool_false_edition_2023]"), ConstraintId: proto.String("bool.false.edition_2023"), Message: proto.String("bool value is not false"), }, @@ -1874,6 +1993,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.string.[buf.validate.conformance.cases.string_valid_path_edition_2023]"), ConstraintId: proto.String("string.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1892,6 +2012,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.bytes.[buf.validate.conformance.cases.bytes_valid_path_edition_2023]"), ConstraintId: proto.String("bytes.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1916,11 +2037,13 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("a"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, &validate.Violation{ FieldPath: proto.String("b.c"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, @@ -1954,6 +2077,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("a"), + RulePath: proto.String("sint32.lt"), ConstraintId: proto.String("sint32.lt"), Message: proto.String("value must be less than 28"), }, @@ -1966,6 +2090,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("a"), + RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_repeated.go b/tools/protovalidate-conformance/internal/cases/cases_repeated.go index e6528f72..b76104de 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_repeated.go +++ b/tools/protovalidate-conformance/internal/cases/cases_repeated.go @@ -48,6 +48,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0].val"), + RulePath: proto.String("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }, @@ -70,6 +71,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0].val"), + RulePath: proto.String("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }, @@ -88,6 +90,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), Message: proto.String("value must contain at least 2 item(s)"), }, @@ -98,6 +101,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1].val"), + RulePath: proto.String("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }, @@ -116,6 +120,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.max_items"), ConstraintId: proto.String("repeated.max_items"), Message: proto.String("value must contain no more than 3 item(s)"), }, @@ -138,6 +143,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), Message: proto.String("value must contain at least 2 item(s)"), }, @@ -148,6 +154,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.max_items"), ConstraintId: proto.String("repeated.max_items"), Message: proto.String("value must contain no more than 4 item(s)"), }, @@ -162,6 +169,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), Message: proto.String("value must contain at least 3 item(s)"), }, @@ -172,6 +180,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.max_items"), ConstraintId: proto.String("repeated.max_items"), Message: proto.String("value must contain no more than 3 item(s)"), }, @@ -194,6 +203,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.unique"), ConstraintId: proto.String("repeated.unique"), }, ), @@ -211,11 +221,13 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("a"), + RulePath: proto.String("repeated.unique"), ConstraintId: proto.String("repeated.unique"), Message: proto.String("repeated value must contain unique items"), }, &validate.Violation{ FieldPath: proto.String("b"), + RulePath: proto.String("repeated.unique"), ConstraintId: proto.String("repeated.unique"), Message: proto.String("repeated value must contain unique items"), }), @@ -237,6 +249,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.float.gt"), ConstraintId: proto.String("float.gt"), Message: proto.String("value must be greater than 0"), }, @@ -247,6 +260,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[1]"), + RulePath: proto.String("repeated.items.string.pattern"), ConstraintId: proto.String("string.pattern"), Message: proto.String("value does not match regex pattern `(?i)^[a-z0-9]+$`"), }, @@ -257,6 +271,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.string.in"), ConstraintId: proto.String("string.in"), Message: proto.String(`value must be in list ["foo", "bar"]`), }, @@ -271,6 +286,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.string.not_in"), ConstraintId: proto.String("string.not_in"), Message: proto.String("value must not be in list [\"foo\", \"bar\"]"), }, @@ -285,6 +301,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.enum.in"), ConstraintId: proto.String("enum.in"), Message: proto.String("value must be in list [0]"), }, @@ -299,6 +316,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.enum.not_in"), ConstraintId: proto.String("enum.not_in"), Message: proto.String("value must not be in list [0]"), }, @@ -313,6 +331,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.enum.in"), ConstraintId: proto.String("enum.in"), Message: proto.String("value must be in list [0]"), }, @@ -327,6 +346,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.enum.not_in"), ConstraintId: proto.String("enum.not_in"), Message: proto.String("value must not be in list [0]"), }, @@ -341,6 +361,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.any.in"), ConstraintId: proto.String("any.in"), Message: proto.String("type URL must be in the allow list"), }, @@ -355,6 +376,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.any.not_in"), ConstraintId: proto.String("any.not_in"), Message: proto.String("type URL must not be in the block list"), }, @@ -381,6 +403,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), Message: proto.String("value must contain at least 1 item(s)"), }, @@ -391,6 +414,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.string.len"), ConstraintId: proto.String("string.len"), Message: proto.String("value length must be 3 characters"), }, @@ -405,6 +429,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), Message: proto.String("value must contain at least 1 item(s)"), }, @@ -415,6 +440,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("repeated.max_items"), ConstraintId: proto.String("repeated.max_items"), Message: proto.String("value must contain no more than 3 item(s)"), }, @@ -437,6 +463,7 @@ func repeatedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val[0]"), + RulePath: proto.String("repeated.items.duration.gte"), ConstraintId: proto.String("duration.gte"), Message: proto.String("value must be greater than or equal to 0.001s"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_required.go b/tools/protovalidate-conformance/internal/cases/cases_required.go index fcf97f2d..37cd034a 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_required.go +++ b/tools/protovalidate-conformance/internal/cases/cases_required.go @@ -33,8 +33,12 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/optional/unset": suites.Case{ - Message: &cases.RequiredProto2ScalarOptional{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto2ScalarOptional{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto2/scalar/optional_with_default/nonzero": suites.Case{ Message: &cases.RequiredProto2ScalarOptionalDefault{Val: proto.String("bar")}, @@ -49,8 +53,12 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto2/scalar/optional_with_default/unset": suites.Case{ - Message: &cases.RequiredProto2ScalarOptionalDefault{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto2ScalarOptionalDefault{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto2/scalar/required/nonzero": suites.Case{ Message: &cases.RequiredProto2ScalarRequired{Val: proto.String("foo")}, @@ -69,8 +77,12 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto2/message/unset": suites.Case{ - Message: &cases.RequiredProto2Message{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto2Message{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto2/oneof/nonzero": suites.Case{ Message: &cases.RequiredProto2Oneof{Val: &cases.RequiredProto2Oneof_A{A: "foo"}}, @@ -81,36 +93,56 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto2/oneof/other_member": suites.Case{ - Message: &cases.RequiredProto2Oneof{Val: &cases.RequiredProto2Oneof_B{B: "foo"}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("a"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto2Oneof{Val: &cases.RequiredProto2Oneof_B{B: "foo"}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("a"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto2/oneof/unset": suites.Case{ - Message: &cases.RequiredProto2Oneof{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("a"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto2Oneof{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("a"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto2/repeated/nonempty": suites.Case{ Message: &cases.RequiredProto2Repeated{Val: []string{"foo"}}, Expected: results.Success(true), }, "proto2/repeated/empty": suites.Case{ - Message: &cases.RequiredProto2Repeated{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto2Repeated{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto2/map/nonempty": suites.Case{ Message: &cases.RequiredProto2Map{Val: map[string]string{"foo": "bar"}}, Expected: results.Success(true), }, "proto2/map/empty": suites.Case{ - Message: &cases.RequiredProto2Map{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto2Map{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto3/scalar/nonzero": suites.Case{ Message: &cases.RequiredProto3Scalar{Val: "foo"}, Expected: results.Success(true), }, "proto3/scalar/zero": suites.Case{ - Message: &cases.RequiredProto3Scalar{Val: ""}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto3Scalar{Val: ""}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto3/scalar/optional/nonzero": suites.Case{ Message: &cases.RequiredProto3OptionalScalar{Val: proto.String("foo")}, @@ -121,8 +153,12 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto3/scalar/optional/unset": suites.Case{ - Message: &cases.RequiredProto3OptionalScalar{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto3OptionalScalar{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto3/message/nonzero": suites.Case{ Message: &cases.RequiredProto3Message{Val: &cases.RequiredProto3Message_Msg{Val: "foo"}}, @@ -133,8 +169,12 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto3/message/unset": suites.Case{ - Message: &cases.RequiredProto3Message{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto3Message{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto3/oneof/nonzero": suites.Case{ Message: &cases.RequiredProto3OneOf{Val: &cases.RequiredProto3OneOf_A{A: "foo"}}, @@ -145,28 +185,44 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto3/oneof/other_member": suites.Case{ - Message: &cases.RequiredProto3OneOf{Val: &cases.RequiredProto3OneOf_B{B: "foo"}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("a"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto3OneOf{Val: &cases.RequiredProto3OneOf_B{B: "foo"}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("a"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto3/oneof/unset": suites.Case{ - Message: &cases.RequiredProto3OneOf{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("a"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto3OneOf{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("a"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto3/repeated/nonempty": suites.Case{ Message: &cases.RequiredProto3Repeated{Val: []string{"foo"}}, Expected: results.Success(true), }, "proto3/repeated/empty": suites.Case{ - Message: &cases.RequiredProto3Repeated{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto3Repeated{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto3/map/nonempty": suites.Case{ Message: &cases.RequiredProto3Map{Val: map[string]string{"foo": "bar"}}, Expected: results.Success(true), }, "proto3/map/empty": suites.Case{ - Message: &cases.RequiredProto3Map{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredProto3Map{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto/2023/scalar/explicit_presence/nonzero": suites.Case{ Message: &cases.RequiredEditionsScalarExplicitPresence{Val: proto.String("foo")}, @@ -177,8 +233,12 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/explicit_presence/unset": suites.Case{ - Message: &cases.RequiredEditionsScalarExplicitPresence{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredEditionsScalarExplicitPresence{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto/2023/scalar/explicit_presence_with_default/nonzero": suites.Case{ Message: &cases.RequiredEditionsScalarExplicitPresenceDefault{Val: proto.String("bar")}, @@ -193,16 +253,24 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/scalar/explicit_presence_with_default/unset": suites.Case{ - Message: &cases.RequiredEditionsScalarExplicitPresenceDefault{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredEditionsScalarExplicitPresenceDefault{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto/2023/scalar/implicit_presence/nonzero": suites.Case{ Message: &cases.RequiredEditionsScalarImplicitPresence{Val: "foo"}, Expected: results.Success(true), }, "proto/2023/scalar/implicit_presence/zero": suites.Case{ - Message: &cases.RequiredEditionsScalarImplicitPresence{Val: ""}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredEditionsScalarImplicitPresence{Val: ""}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto/2023/scalar/legacy_required/nonzero": suites.Case{ Message: &cases.RequiredEditionsScalarLegacyRequired{Val: proto.String("foo")}, @@ -221,8 +289,12 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/message/explicit_presence/length_prefixed/unset": suites.Case{ - Message: &cases.RequiredEditionsMessageExplicitPresence{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredEditionsMessageExplicitPresence{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto/2023/message/explicit_presence/delimited/nonzero": suites.Case{ Message: &cases.RequiredEditionsMessageExplicitPresenceDelimited{Val: &cases.RequiredEditionsMessageExplicitPresenceDelimited_Msg{Val: proto.String("foo")}}, @@ -233,8 +305,12 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/message/explicit_presence/delimited/unset": suites.Case{ - Message: &cases.RequiredEditionsMessageExplicitPresenceDelimited{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredEditionsMessageExplicitPresenceDelimited{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto/2023/message/legacy_required/length_prefixed/nonzero": suites.Case{ Message: &cases.RequiredEditionsMessageLegacyRequired{Val: &cases.RequiredEditionsMessageLegacyRequired_Msg{Val: proto.String("foo")}}, @@ -261,36 +337,56 @@ func requiredSuite() suites.Suite { Expected: results.Success(true), }, "proto/2023/oneof/other_member": suites.Case{ - Message: &cases.RequiredEditionsOneof{Val: &cases.RequiredEditionsOneof_B{B: "foo"}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("a"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredEditionsOneof{Val: &cases.RequiredEditionsOneof_B{B: "foo"}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("a"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto/2023/oneof/unset": suites.Case{ - Message: &cases.RequiredEditionsOneof{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("a"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredEditionsOneof{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("a"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto/2023/repeated/compact/nonempty": suites.Case{ Message: &cases.RequiredEditionsRepeated{Val: []string{"foo"}}, Expected: results.Success(true), }, "proto/2023/repeated/compact/empty": suites.Case{ - Message: &cases.RequiredEditionsRepeated{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredEditionsRepeated{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto/2023/repeated/expanded/nonempty": suites.Case{ Message: &cases.RequiredEditionsRepeatedExpanded{Val: []string{"foo"}}, Expected: results.Success(true), }, "proto/2023/repeated/expanded/empty": suites.Case{ - Message: &cases.RequiredEditionsRepeatedExpanded{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredEditionsRepeatedExpanded{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "proto/2023/map/nonempty": suites.Case{ Message: &cases.RequiredEditionsMap{Val: map[string]string{"foo": "bar"}}, Expected: results.Success(true), }, "proto/2023/map/empty": suites.Case{ - Message: &cases.RequiredEditionsMap{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.RequiredEditionsMap{}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, } } diff --git a/tools/protovalidate-conformance/internal/cases/cases_sfixed32.go b/tools/protovalidate-conformance/internal/cases/cases_sfixed32.go index e6a30bc4..24fe03df 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_sfixed32.go +++ b/tools/protovalidate-conformance/internal/cases/cases_sfixed32.go @@ -37,6 +37,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.const"), ConstraintId: proto.String("sfixed32.const"), Message: proto.String("value must equal 1"), }, @@ -51,6 +52,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.in"), ConstraintId: proto.String("sfixed32.in"), Message: proto.String("value must be in list [2, 3]"), }, @@ -65,6 +67,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.not_in"), ConstraintId: proto.String("sfixed32.not_in"), Message: proto.String("value must not be in list [0]"), }, @@ -79,6 +82,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.lt"), ConstraintId: proto.String("sfixed32.lt"), Message: proto.String("value must be less than 0"), }, @@ -89,6 +93,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.lt"), ConstraintId: proto.String("sfixed32.lt"), Message: proto.String("value must be less than 0"), }, @@ -107,6 +112,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.lte"), ConstraintId: proto.String("sfixed32.lte"), Message: proto.String("value must be less than or equal to 64"), }, @@ -121,6 +127,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt"), Message: proto.String("value must be greater than 16"), }, @@ -131,6 +138,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt"), Message: proto.String("value must be greater than 16"), }, @@ -149,6 +157,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gte"), ConstraintId: proto.String("sfixed32.gte"), Message: proto.String("value must be greater than or equal to 8"), }, @@ -163,6 +172,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -173,6 +183,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -183,6 +194,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -193,6 +205,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -211,6 +224,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -221,6 +235,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -231,6 +246,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -253,6 +269,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gte"), ConstraintId: proto.String("sfixed32.gte_lte"), Message: proto.String("value must be greater than or equal to 128 and less than or equal to 256"), }, @@ -263,6 +280,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gte"), ConstraintId: proto.String("sfixed32.gte_lte"), Message: proto.String("value must be greater than or equal to 128 and less than or equal to 256"), }, @@ -289,6 +307,7 @@ func sfixed32Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed32.gte"), ConstraintId: proto.String("sfixed32.gte_lte_exclusive"), Message: proto.String("value must be greater than or equal to 256 or less than or equal to 128"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_sfixed64.go b/tools/protovalidate-conformance/internal/cases/cases_sfixed64.go index 800df010..db769150 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_sfixed64.go +++ b/tools/protovalidate-conformance/internal/cases/cases_sfixed64.go @@ -37,6 +37,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.const"), ConstraintId: proto.String("sfixed64.const"), Message: proto.String("value must equal 1"), }, @@ -51,6 +52,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.in"), ConstraintId: proto.String("sfixed64.in"), Message: proto.String("value must be in list [2, 3]"), }, @@ -65,6 +67,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.not_in"), ConstraintId: proto.String("sfixed64.not_in"), Message: proto.String("value must not be in list [0]"), }, @@ -79,6 +82,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.lt"), ConstraintId: proto.String("sfixed64.lt"), Message: proto.String("value must be less than 0"), }, @@ -89,6 +93,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.lt"), ConstraintId: proto.String("sfixed64.lt"), Message: proto.String("value must be less than 0"), }, @@ -107,6 +112,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.lte"), ConstraintId: proto.String("sfixed64.lte"), Message: proto.String("value must be less than or equal to 64"), }, @@ -121,6 +127,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt"), Message: proto.String("value must be greater than 16"), }, @@ -131,6 +138,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt"), Message: proto.String("value must be greater than 16"), }, @@ -149,6 +157,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gte"), ConstraintId: proto.String("sfixed64.gte"), Message: proto.String("value must be greater than or equal to 8"), }, @@ -163,6 +172,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -173,6 +183,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -183,6 +194,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -193,6 +205,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -211,6 +224,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -221,6 +235,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -231,6 +246,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -253,6 +269,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gte"), ConstraintId: proto.String("sfixed64.gte_lte"), Message: proto.String("value must be greater than or equal to 128 and less than or equal to 256"), }, @@ -263,6 +280,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gte"), ConstraintId: proto.String("sfixed64.gte_lte"), Message: proto.String("value must be greater than or equal to 128 and less than or equal to 256"), }, @@ -289,6 +307,7 @@ func sfixed64Suite() suites.Suite { Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("sfixed64.gte"), ConstraintId: proto.String("sfixed64.gte_lte_exclusive"), Message: proto.String("value must be greater than or equal to 256 or less than or equal to 128"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_sint32.go b/tools/protovalidate-conformance/internal/cases/cases_sint32.go index 3873ddc9..284929c1 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_sint32.go +++ b/tools/protovalidate-conformance/internal/cases/cases_sint32.go @@ -35,7 +35,12 @@ func sint32Suite() suites.Suite { "const/invalid": { Message: &cases.SInt32Const{Val: 2}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.const"), + ConstraintId: proto.String("sint32.const"), + }, + ), }, "in/valid": { Message: &cases.SInt32In{Val: 3}, @@ -44,7 +49,12 @@ func sint32Suite() suites.Suite { "in/invalid": { Message: &cases.SInt32In{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.in"), + ConstraintId: proto.String("sint32.in"), + }, + ), }, "not_in/valid": { Message: &cases.SInt32NotIn{Val: 1}, @@ -53,7 +63,12 @@ func sint32Suite() suites.Suite { "not_in/invalid": { Message: &cases.SInt32NotIn{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.not_in"), + ConstraintId: proto.String("sint32.not_in"), + }, + ), }, "lt/valid/less": { Message: &cases.SInt32LT{Val: -1}, @@ -62,12 +77,22 @@ func sint32Suite() suites.Suite { "lt/invalid/equal": { Message: &cases.SInt32LT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.lt"), + ConstraintId: proto.String("sint32.lt"), + }, + ), }, "lt/invalid/greater": { Message: &cases.SInt32LT{Val: 1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.lt"), + ConstraintId: proto.String("sint32.lt"), + }, + ), }, "lte/valid/less": { Message: &cases.SInt32LTE{Val: 63}, @@ -80,7 +105,12 @@ func sint32Suite() suites.Suite { "lte/invalid/greater": { Message: &cases.SInt32LTE{Val: 65}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.lte"), + ConstraintId: proto.String("sint32.lte"), + }, + ), }, "gt/valid/greater": { Message: &cases.SInt32GT{Val: 17}, @@ -89,12 +119,22 @@ func sint32Suite() suites.Suite { "gt/invalid/equal": { Message: &cases.SInt32GT{Val: 16}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gt"), + ConstraintId: proto.String("sint32.gt"), + }, + ), }, "gt/invalid/less": { Message: &cases.SInt32GT{Val: 15}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gt"), + ConstraintId: proto.String("sint32.gt"), + }, + ), }, "gte/valid/greater": { Message: &cases.SInt32GTE{Val: 9}, @@ -107,7 +147,12 @@ func sint32Suite() suites.Suite { "gte/invalid/less": { Message: &cases.SInt32GTE{Val: 7}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gte"), + ConstraintId: proto.String("sint32.gte"), + }, + ), }, "gt_lt/inclusive/valid/within": { Message: &cases.SInt32GTLT{Val: 5}, @@ -116,22 +161,42 @@ func sint32Suite() suites.Suite { "gt_lt/inclusive/invalid/above": { Message: &cases.SInt32GTLT{Val: 11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gt"), + ConstraintId: proto.String("sint32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/below": { Message: &cases.SInt32GTLT{Val: -1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gt"), + ConstraintId: proto.String("sint32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/max": { Message: &cases.SInt32GTLT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gt"), + ConstraintId: proto.String("sint32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/min": { Message: &cases.SInt32GTLT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gt"), + ConstraintId: proto.String("sint32.gt_lt"), + }, + ), }, "gt_lt/exclusive/valid/above": { Message: &cases.SInt32ExLTGT{Val: 11}, @@ -144,17 +209,32 @@ func sint32Suite() suites.Suite { "gt_lt/exclusive/invalid/within": { Message: &cases.SInt32ExLTGT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gt"), + ConstraintId: proto.String("sint32.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/max": { Message: &cases.SInt32ExLTGT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gt"), + ConstraintId: proto.String("sint32.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/min": { Message: &cases.SInt32ExLTGT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gt"), + ConstraintId: proto.String("sint32.gt_lt_exclusive"), + }, + ), }, "gte_lte/inclusive/valid/within": { Message: &cases.SInt32GTELTE{Val: 200}, @@ -171,12 +251,22 @@ func sint32Suite() suites.Suite { "gte_lte/inclusive/invalid/above": { Message: &cases.SInt32GTELTE{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gte"), + ConstraintId: proto.String("sint32.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/below": { Message: &cases.SInt32GTELTE{Val: 100}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gte"), + ConstraintId: proto.String("sint32.gte_lte"), + }, + ), }, "gte_lte/exclusive/valid/above": { Message: &cases.SInt32ExGTELTE{Val: 300}, @@ -197,7 +287,12 @@ func sint32Suite() suites.Suite { "gte_lte/exclusive/invalid/within": { Message: &cases.SInt32ExGTELTE{Val: 200}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gte"), + ConstraintId: proto.String("sint32.gte_lte_exclusive"), + }, + ), }, "ignore_empty/valid/empty": { Message: &cases.SInt32Ignore{Val: 0}, @@ -210,7 +305,12 @@ func sint32Suite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.SInt32Ignore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint32.gte"), + ConstraintId: proto.String("sint32.gte_lte"), + }, + ), }, "compilation/wrong_type": { Message: &cases.SInt32IncorrectType{Val: 123}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_sint64.go b/tools/protovalidate-conformance/internal/cases/cases_sint64.go index 277eeca6..f4ad9979 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_sint64.go +++ b/tools/protovalidate-conformance/internal/cases/cases_sint64.go @@ -35,7 +35,12 @@ func sint64Suite() suites.Suite { "const/invalid": { Message: &cases.SInt64Const{Val: 2}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.const"), + ConstraintId: proto.String("sint64.const"), + }, + ), }, "in/valid": { Message: &cases.SInt64In{Val: 3}, @@ -44,7 +49,12 @@ func sint64Suite() suites.Suite { "in/invalid": { Message: &cases.SInt64In{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.in"), + ConstraintId: proto.String("sint64.in"), + }, + ), }, "not_in/valid": { Message: &cases.SInt64NotIn{Val: 1}, @@ -53,7 +63,12 @@ func sint64Suite() suites.Suite { "not_in/invalid": { Message: &cases.SInt64NotIn{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.not_in"), + ConstraintId: proto.String("sint64.not_in"), + }, + ), }, "lt/valid/less": { Message: &cases.SInt64LT{Val: -1}, @@ -62,12 +77,22 @@ func sint64Suite() suites.Suite { "lt/invalid/equal": { Message: &cases.SInt64LT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.lt"), + ConstraintId: proto.String("sint64.lt"), + }, + ), }, "lt/invalid/greater": { Message: &cases.SInt64LT{Val: 1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.lt"), + ConstraintId: proto.String("sint64.lt"), + }, + ), }, "lte/valid/less": { Message: &cases.SInt64LTE{Val: 63}, @@ -80,7 +105,12 @@ func sint64Suite() suites.Suite { "lte/invalid/greater": { Message: &cases.SInt64LTE{Val: 65}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.lte"), + ConstraintId: proto.String("sint64.lte"), + }, + ), }, "gt/valid/greater": { Message: &cases.SInt64GT{Val: 17}, @@ -89,12 +119,22 @@ func sint64Suite() suites.Suite { "gt/invalid/equal": { Message: &cases.SInt64GT{Val: 16}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gt"), + ConstraintId: proto.String("sint64.gt"), + }, + ), }, "gt/invalid/less": { Message: &cases.SInt64GT{Val: 15}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gt"), + ConstraintId: proto.String("sint64.gt"), + }, + ), }, "gte/valid/greater": { Message: &cases.SInt64GTE{Val: 9}, @@ -107,7 +147,12 @@ func sint64Suite() suites.Suite { "gte/invalid/less": { Message: &cases.SInt64GTE{Val: 7}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gte"), + ConstraintId: proto.String("sint64.gte"), + }, + ), }, "gt_lt/inclusive/valid/within": { Message: &cases.SInt64GTLT{Val: 5}, @@ -116,22 +161,42 @@ func sint64Suite() suites.Suite { "gt_lt/inclusive/invalid/above": { Message: &cases.SInt64GTLT{Val: 11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gt"), + ConstraintId: proto.String("sint64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/below": { Message: &cases.SInt64GTLT{Val: -1}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gt"), + ConstraintId: proto.String("sint64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/max": { Message: &cases.SInt64GTLT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gt"), + ConstraintId: proto.String("sint64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/min": { Message: &cases.SInt64GTLT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gt"), + ConstraintId: proto.String("sint64.gt_lt"), + }, + ), }, "gt_lt/exclusive/valid/above": { Message: &cases.SInt64ExLTGT{Val: 11}, @@ -144,17 +209,32 @@ func sint64Suite() suites.Suite { "gt_lt/exclusive/invalid/within": { Message: &cases.SInt64ExLTGT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gt"), + ConstraintId: proto.String("sint64.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/max": { Message: &cases.SInt64ExLTGT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gt"), + ConstraintId: proto.String("sint64.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/min": { Message: &cases.SInt64ExLTGT{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gt"), + ConstraintId: proto.String("sint64.gt_lt_exclusive"), + }, + ), }, "gte_lte/inclusive/valid/within": { Message: &cases.SInt64GTELTE{Val: 200}, @@ -171,12 +251,22 @@ func sint64Suite() suites.Suite { "gte_lte/inclusive/invalid/above": { Message: &cases.SInt64GTELTE{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gte"), + ConstraintId: proto.String("sint64.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/below": { Message: &cases.SInt64GTELTE{Val: 100}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gte"), + ConstraintId: proto.String("sint64.gte_lte"), + }, + ), }, "gte_lte/exclusive/valid/above": { Message: &cases.SInt64ExGTELTE{Val: 300}, @@ -197,7 +287,12 @@ func sint64Suite() suites.Suite { "gte_lte/exclusive/invalid/within": { Message: &cases.SInt64ExGTELTE{Val: 200}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gte"), + ConstraintId: proto.String("sint64.gte_lte_exclusive"), + }, + ), }, "ignore_empty/valid/empty": { Message: &cases.SInt64Ignore{Val: 0}, @@ -210,7 +305,12 @@ func sint64Suite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.SInt64Ignore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("sint64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("sint64.gte"), + ConstraintId: proto.String("sint64.gte_lte"), + }, + ), }, "compilation/wrong_type": { Message: &cases.SInt64IncorrectType{Val: 123}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_strings.go b/tools/protovalidate-conformance/internal/cases/cases_strings.go index 64a4551a..1c1d23f3 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_strings.go +++ b/tools/protovalidate-conformance/internal/cases/cases_strings.go @@ -35,7 +35,12 @@ func stringSuite() suites.Suite { "const/invalid": { Message: &cases.StringConst{Val: "bar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.const"), + ConstraintId: proto.String("string.const"), + }, + ), }, "in/valid": { Message: &cases.StringIn{Val: "baz"}, @@ -44,7 +49,12 @@ func stringSuite() suites.Suite { "in/invalid": { Message: &cases.StringIn{Val: "foo"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.in"), + ConstraintId: proto.String("string.in"), + }, + ), }, "not_in/valid": { Message: &cases.StringNotIn{Val: "bar"}, @@ -53,7 +63,12 @@ func stringSuite() suites.Suite { "not_in/invalid": { Message: &cases.StringNotIn{Val: "fizz"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.not_in"), + ConstraintId: proto.String("string.not_in"), + }, + ), }, "len/valid/ascii": { Message: &cases.StringLen{Val: "foo"}, @@ -70,13 +85,19 @@ func stringSuite() suites.Suite { "len/invalid": { Message: &cases.StringLen{Val: "fizz"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.len")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.len"), + ConstraintId: proto.String("string.len"), + }, + ), }, "len/invalid/emoji/composite": { Message: &cases.StringLen{Val: "👩🏽‍💻🧑🏾‍💻👨🏼‍💻"}, Expected: results.Violations( &validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.len"), ConstraintId: proto.String("string.len"), Message: proto.String("value length must be 3 characters"), }), @@ -92,7 +113,12 @@ func stringSuite() suites.Suite { "min_len/invalid/less": { Message: &cases.StringMinLen{Val: "pb"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.min_len")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.min_len"), + ConstraintId: proto.String("string.min_len"), + }, + ), }, "max_len/valid/equal": { Message: &cases.StringMaxLen{Val: "proto"}, @@ -105,7 +131,12 @@ func stringSuite() suites.Suite { "max_len/invalid/greater": { Message: &cases.StringMaxLen{Val: "validate"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.max_len")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.max_len"), + ConstraintId: proto.String("string.max_len"), + }, + ), }, "min_max_len/valid/within": { Message: &cases.StringMinMaxLen{Val: "quux"}, @@ -122,12 +153,22 @@ func stringSuite() suites.Suite { "min_max_len/invalid/less": { Message: &cases.StringMinMaxLen{Val: "pb"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.min_len")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.min_len"), + ConstraintId: proto.String("string.min_len"), + }, + ), }, "min_max_len/invalid/greater": { Message: &cases.StringMinMaxLen{Val: "validate"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.max_len")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.max_len"), + ConstraintId: proto.String("string.max_len"), + }, + ), }, "min_max_len/equal/valid": { Message: &cases.StringEqualMinMaxLen{Val: "proto"}, @@ -136,7 +177,12 @@ func stringSuite() suites.Suite { "min_max_len/equal/invalid": { Message: &cases.StringEqualMinMaxLen{Val: "validate"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.max_len")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.max_len"), + ConstraintId: proto.String("string.max_len"), + }, + ), }, "len_bytes/valid/ascii": { Message: &cases.StringLenBytes{Val: "fizz"}, @@ -153,7 +199,12 @@ func stringSuite() suites.Suite { "len_bytes/invalid": { Message: &cases.StringLenBytes{Val: "foo"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.len_bytes")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.len_bytes"), + ConstraintId: proto.String("string.len_bytes"), + }, + ), }, "min_bytes/valid/equal": { Message: &cases.StringMinBytes{Val: "fizz"}, @@ -166,7 +217,12 @@ func stringSuite() suites.Suite { "min_bytes/invalid/less": { Message: &cases.StringMinBytes{Val: "foo"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.min_bytes")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.min_bytes"), + ConstraintId: proto.String("string.min_bytes"), + }, + ), }, "max_bytes/valid/equal": { Message: &cases.StringMaxBytes{Val: "validate"}, @@ -179,7 +235,12 @@ func stringSuite() suites.Suite { "max_bytes/invalid/greater": { Message: &cases.StringMaxBytes{Val: "validation"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.max_bytes")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.max_bytes"), + ConstraintId: proto.String("string.max_bytes"), + }, + ), }, "min_max_bytes/valid/within": { Message: &cases.StringMinMaxBytes{Val: "quux"}, @@ -196,12 +257,22 @@ func stringSuite() suites.Suite { "min_max_bytes/invalid/less": { Message: &cases.StringMinMaxBytes{Val: "pb"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.min_bytes")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.min_bytes"), + ConstraintId: proto.String("string.min_bytes"), + }, + ), }, "min_max_bytes/invalid/greater": { Message: &cases.StringMinMaxBytes{Val: "validation"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.max_bytes")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.max_bytes"), + ConstraintId: proto.String("string.max_bytes"), + }, + ), }, "min_max_bytes/equal/valid": { Message: &cases.StringEqualMinMaxBytes{Val: "fizz"}, @@ -210,7 +281,12 @@ func stringSuite() suites.Suite { "min_max_bytes/equal/invalid": { Message: &cases.StringEqualMinMaxBytes{Val: "foo"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.min_bytes")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.min_bytes"), + ConstraintId: proto.String("string.min_bytes"), + }, + ), }, "pattern/valid": { Message: &cases.StringPattern{Val: "Foo123"}, @@ -219,7 +295,12 @@ func stringSuite() suites.Suite { "pattern/invalid": { Message: &cases.StringPattern{Val: "!#@$#$%"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.pattern")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.pattern"), + ConstraintId: proto.String("string.pattern"), + }, + ), }, "pattern/escapes/valid": { Message: &cases.StringPatternEscapes{Val: "* \\ x"}, @@ -228,7 +309,12 @@ func stringSuite() suites.Suite { "pattern/escapes/invalid": { Message: &cases.StringPatternEscapes{Val: "invalid"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.pattern")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.pattern"), + ConstraintId: proto.String("string.pattern"), + }, + ), }, "prefix/valid/exact": { Message: &cases.StringPrefix{Val: "foo"}, @@ -241,7 +327,12 @@ func stringSuite() suites.Suite { "prefix/invalid": { Message: &cases.StringPrefix{Val: "fizz"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.prefix")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.prefix"), + ConstraintId: proto.String("string.prefix"), + }, + ), }, "contains/valid/exact": { Message: &cases.StringContains{Val: "bar"}, @@ -262,7 +353,12 @@ func stringSuite() suites.Suite { "contains/invalid": { Message: &cases.StringContains{Val: "fizzbuzz"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.contains")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.contains"), + ConstraintId: proto.String("string.contains"), + }, + ), }, "not_contains/valid": { Message: &cases.StringNotContains{Val: "fizzbuzz"}, @@ -271,7 +367,12 @@ func stringSuite() suites.Suite { "not_contains/invalid": { Message: &cases.StringNotContains{Val: "foobarbaz"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.not_contains")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.not_contains"), + ConstraintId: proto.String("string.not_contains"), + }, + ), }, "suffix/valid/exact": { Message: &cases.StringSuffix{Val: "baz"}, @@ -284,7 +385,12 @@ func stringSuite() suites.Suite { "suffix/invalid": { Message: &cases.StringSuffix{Val: "bazbarfoo"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.suffix")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.suffix"), + ConstraintId: proto.String("string.suffix"), + }, + ), }, "email/valid/simple": { Message: &cases.StringEmail{Val: "foo@bar.com"}, @@ -293,7 +399,12 @@ func stringSuite() suites.Suite { "email/invalid/empty": { Message: &cases.StringEmail{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email_empty"), + }, + ), }, "email/invalid/not_checked/empty": { Message: &cases.StringNotEmail{Val: ""}, @@ -306,59 +417,114 @@ func stringSuite() suites.Suite { "email/invalid/malformed": { Message: &cases.StringEmail{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email"), + }, + ), }, "email/invalid/local_segment_long": { Message: &cases.StringEmail{Val: "x0123456789012345678901234567890123456789012345678901234567890123456789@example.com"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email"), + }, + ), }, "email/invalid/host_segment_long": { Message: &cases.StringEmail{Val: "foo@x0123456789012345678901234567890123456789012345678901234567890123456789.com"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email"), + }, + ), }, "email/invalid/too_long": { Message: &cases.StringEmail{ Val: "x123456789.x123456789.x123456789.x123456789.x123456789@x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789.x123456789", }, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email"), + }, + ), }, "email/invalid/bad_hostname": { Message: &cases.StringEmail{Val: "foo@-bar.com"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email"), + }, + ), }, "email/invalid/only_dot_hostname": { Message: &cases.StringEmail{Val: "foo@."}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email"), + }, + ), }, "email/invalid/white_spaces": { Message: &cases.StringEmail{Val: " foo@example.com "}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email"), + }, + ), }, "email/invalid/trailing_white_space": { Message: &cases.StringEmail{Val: "foo@example.com "}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email"), + }, + ), }, "email/invalid/leading_white_space": { Message: &cases.StringEmail{Val: " foo@example.com"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email"), + }, + ), }, "email/invalid/angled_brackets": { Message: &cases.StringEmail{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.email")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.email"), + ConstraintId: proto.String("string.email"), + }, + ), }, "hostname/invalid/empty": { Message: &cases.StringHostname{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.hostname_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.hostname"), + ConstraintId: proto.String("string.hostname_empty"), + }, + ), }, "hostname/valid/lowercase": { Message: &cases.StringHostname{Val: "example.com"}, @@ -379,7 +545,12 @@ func stringSuite() suites.Suite { "hostname/invalid/malformed": { Message: &cases.StringHostname{Val: "@!#$%^&*&^%$#"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.hostname")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.hostname"), + ConstraintId: proto.String("string.hostname"), + }, + ), }, "hostname/invalid/not_checked/empty": { Message: &cases.StringNotHostname{Val: ""}, @@ -392,37 +563,72 @@ func stringSuite() suites.Suite { "hostname/invalid/underscore": { Message: &cases.StringHostname{Val: "foo_bar.com"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.hostname")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.hostname"), + ConstraintId: proto.String("string.hostname"), + }, + ), }, "hostname/invalid/long": { Message: &cases.StringHostname{Val: "x0123456789012345678901234567890123456789012345678901234567890123456789.com"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.hostname")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.hostname"), + ConstraintId: proto.String("string.hostname"), + }, + ), }, "hostname/invalid/trailing_hyphen": { Message: &cases.StringHostname{Val: "foo-bar-.com"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.hostname")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.hostname"), + ConstraintId: proto.String("string.hostname"), + }, + ), }, "hostname/invalid/leading_hyphen": { Message: &cases.StringHostname{Val: "-foo-bar.com"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.hostname")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.hostname"), + ConstraintId: proto.String("string.hostname"), + }, + ), }, "hostname/invalid/empty_part": { Message: &cases.StringHostname{Val: "foo..bar.com"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.hostname")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.hostname"), + ConstraintId: proto.String("string.hostname"), + }, + ), }, "hostname/invalid/IDNs": { Message: &cases.StringHostname{Val: "你好.com"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.hostname")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.hostname"), + ConstraintId: proto.String("string.hostname"), + }, + ), }, "hostname/invalid/only_dot": { Message: &cases.StringHostname{Val: "."}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.hostname")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.hostname"), + ConstraintId: proto.String("string.hostname"), + }, + ), }, "ip/valid/v4": { Message: &cases.StringIP{Val: "192.168.0.1"}, @@ -435,7 +641,12 @@ func stringSuite() suites.Suite { "ip/invalid": { Message: &cases.StringIP{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ip")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ip"), + ConstraintId: proto.String("string.ip"), + }, + ), }, "ip/invalid/not_checked/empty": { Message: &cases.StringNotIP{Val: "foobar"}, @@ -448,7 +659,12 @@ func stringSuite() suites.Suite { "ip/invalid/empty": { Message: &cases.StringIP{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ip_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ip"), + ConstraintId: proto.String("string.ip_empty"), + }, + ), }, "ipv4/valid": { Message: &cases.StringIPv4{Val: "192.168.0.1"}, @@ -457,7 +673,12 @@ func stringSuite() suites.Suite { "ipv4/invalid/empty": { Message: &cases.StringIPv4{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4"), + ConstraintId: proto.String("string.ipv4_empty"), + }, + ), }, "ipv4/invalid/not_checked/empty": { Message: &cases.StringNotIPv4{Val: ""}, @@ -470,17 +691,32 @@ func stringSuite() suites.Suite { "ipv4/invalid/malformed": { Message: &cases.StringIPv4{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4"), + ConstraintId: proto.String("string.ipv4"), + }, + ), }, "ipv4/invalid/erroneous": { Message: &cases.StringIPv4{Val: "256.0.0.0"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4"), + ConstraintId: proto.String("string.ipv4"), + }, + ), }, "ipv4/invalid/v6": { Message: &cases.StringIPv4{Val: "3e::99"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4"), + ConstraintId: proto.String("string.ipv4"), + }, + ), }, "ipv6/valid/expanded": { Message: &cases.StringIPv6{Val: "2001:0db8:85a3:0000:0000:8a2e:0370:7334"}, @@ -493,7 +729,12 @@ func stringSuite() suites.Suite { "ipv6/invalid/empty": { Message: &cases.StringIPv6{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6"), + ConstraintId: proto.String("string.ipv6_empty"), + }, + ), }, "ipv6/invalid/not_checked/empty": { Message: &cases.StringNotIPv6{Val: ""}, @@ -506,17 +747,32 @@ func stringSuite() suites.Suite { "ipv6/invalid/malformed": { Message: &cases.StringIPv6{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6"), + ConstraintId: proto.String("string.ipv6"), + }, + ), }, "ipv6/invalid/erroneous": { Message: &cases.StringIPv6{Val: "ff::fff::0b"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6"), + ConstraintId: proto.String("string.ipv6"), + }, + ), }, "ipv6/invalid/v4": { Message: &cases.StringIPv6{Val: "192.168.0.1"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6"), + ConstraintId: proto.String("string.ipv6"), + }, + ), }, "ip_with_prefixlen/valid/v4": { Message: &cases.StringIPWithPrefixLen{Val: "192.168.0.1/24"}, @@ -529,7 +785,12 @@ func stringSuite() suites.Suite { "ip_with_prefixlen/invalid": { Message: &cases.StringIPWithPrefixLen{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ip_with_prefixlen")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ip_with_prefixlen"), + ConstraintId: proto.String("string.ip_with_prefixlen"), + }, + ), }, "ip_with_prefixlen/invalid/not_checked/empty": { Message: &cases.StringNotIPWithPrefixLen{Val: ""}, @@ -542,7 +803,12 @@ func stringSuite() suites.Suite { "ip_with_prefixlen/invalid/empty": { Message: &cases.StringIPWithPrefixLen{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ip_with_prefixlen_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ip_with_prefixlen"), + ConstraintId: proto.String("string.ip_with_prefixlen_empty"), + }, + ), }, "ipv4_with_prefixlen/valid": { Message: &cases.StringIPv4WithPrefixLen{Val: "192.168.0.1/24"}, @@ -551,7 +817,12 @@ func stringSuite() suites.Suite { "ipv4_with_prefixlen/invalid/empty": { Message: &cases.StringIPv4WithPrefixLen{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4_with_prefixlen_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4_with_prefixlen"), + ConstraintId: proto.String("string.ipv4_with_prefixlen_empty"), + }, + ), }, "ipv4_with_prefixlen/invalid/not_checked/empty": { Message: &cases.StringNotIPv4WithPrefixLen{Val: ""}, @@ -564,12 +835,22 @@ func stringSuite() suites.Suite { "ipv4_with_prefixlen/invalid/malformed": { Message: &cases.StringIPv4WithPrefixLen{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4_with_prefixlen")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4_with_prefixlen"), + ConstraintId: proto.String("string.ipv4_with_prefixlen"), + }, + ), }, "ipv4_with_prefixlen/invalid/v6": { Message: &cases.StringIPv4WithPrefixLen{Val: "2001:db8:1::1/64"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4_with_prefixlen")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4_with_prefixlen"), + ConstraintId: proto.String("string.ipv4_with_prefixlen"), + }, + ), }, "ipv6_with_prefixlen/valid/v6": { Message: &cases.StringIPv6WithPrefixLen{Val: "2001:db8:1::1/64"}, @@ -578,7 +859,12 @@ func stringSuite() suites.Suite { "ipv6_with_prefixlen/invalid/invalid": { Message: &cases.StringIPv6WithPrefixLen{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6_with_prefixlen_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6_with_prefixlen"), + ConstraintId: proto.String("string.ipv6_with_prefixlen_empty"), + }, + ), }, "ipv6_with_prefixlen/invalid/not_checked/empty": { Message: &cases.StringNotIPv6WithPrefixLen{Val: ""}, @@ -591,12 +877,22 @@ func stringSuite() suites.Suite { "ipv6_with_prefixlen/invalid/malformed": { Message: &cases.StringIPv6WithPrefixLen{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6_with_prefixlen")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6_with_prefixlen"), + ConstraintId: proto.String("string.ipv6_with_prefixlen"), + }, + ), }, "ipv6_with_prefixlen/invalid/v4": { Message: &cases.StringIPv6WithPrefixLen{Val: "192.168.0.1/24"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6_with_prefixlen")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6_with_prefixlen"), + ConstraintId: proto.String("string.ipv6_with_prefixlen"), + }, + ), }, "ip_prefix/valid/v4": { Message: &cases.StringIPPrefix{Val: "192.168.0.0/24"}, @@ -609,7 +905,12 @@ func stringSuite() suites.Suite { "ip_prefix/invalid/empty": { Message: &cases.StringIPPrefix{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ip_prefix_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ip_prefix"), + ConstraintId: proto.String("string.ip_prefix_empty"), + }, + ), }, "ip_prefix/invalid/not_checked/empty": { Message: &cases.StringNotIPPrefix{Val: ""}, @@ -622,7 +923,12 @@ func stringSuite() suites.Suite { "ip_prefix/invalid/malformed": { Message: &cases.StringIPPrefix{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ip_prefix")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ip_prefix"), + ConstraintId: proto.String("string.ip_prefix"), + }, + ), }, "ipv4_prefix/valid": { Message: &cases.StringIPv4Prefix{Val: "192.168.0.0/24"}, @@ -631,7 +937,12 @@ func stringSuite() suites.Suite { "ipv4_prefix/invalid/empty": { Message: &cases.StringIPv4Prefix{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4_prefix_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4_prefix"), + ConstraintId: proto.String("string.ipv4_prefix_empty"), + }, + ), }, "ipv4_prefix/invalid/not_checked/empty": { Message: &cases.StringNotIPv4Prefix{Val: ""}, @@ -644,17 +955,32 @@ func stringSuite() suites.Suite { "ipv4_prefix/invalid/not_network_address": { Message: &cases.StringIPv4Prefix{Val: "192.168.0.1/24"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4_prefix")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4_prefix"), + ConstraintId: proto.String("string.ipv4_prefix"), + }, + ), }, "ipv4_prefix/invalid/malformed": { Message: &cases.StringIPv4Prefix{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4_prefix")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4_prefix"), + ConstraintId: proto.String("string.ipv4_prefix"), + }, + ), }, "ipv4_prefix/invalid/v6": { Message: &cases.StringIPv4Prefix{Val: "2001:db8:1::/48"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv4_prefix")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv4_prefix"), + ConstraintId: proto.String("string.ipv4_prefix"), + }, + ), }, "ipv6_prefix/valid/v6": { Message: &cases.StringIPv6Prefix{Val: "2001:db8:1::/48"}, @@ -663,7 +989,12 @@ func stringSuite() suites.Suite { "ipv6_prefix/invalid/empty": { Message: &cases.StringIPv6Prefix{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6_prefix_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6_prefix"), + ConstraintId: proto.String("string.ipv6_prefix_empty"), + }, + ), }, "ipv6_prefix/invalid/not_checked/empty": { Message: &cases.StringNotIPv6Prefix{Val: ""}, @@ -676,17 +1007,32 @@ func stringSuite() suites.Suite { "ipv6_prefix/invalid/not_network_address": { Message: &cases.StringIPv6Prefix{Val: "2001:db8:1::1/48"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6_prefix")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6_prefix"), + ConstraintId: proto.String("string.ipv6_prefix"), + }, + ), }, "ipv6_prefix/invalid/malformed": { Message: &cases.StringIPv6Prefix{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6_prefix")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6_prefix"), + ConstraintId: proto.String("string.ipv6_prefix"), + }, + ), }, "ipv6_prefix/invalid/v4": { Message: &cases.StringIPv6Prefix{Val: "192.168.0.0/24"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.ipv6_prefix")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.ipv6_prefix"), + ConstraintId: proto.String("string.ipv6_prefix"), + }, + ), }, "uri/valid": { Message: &cases.StringURI{Val: "https://example.com/foo/bar?baz=quux"}, @@ -695,7 +1041,12 @@ func stringSuite() suites.Suite { "uri/invalid/empty": { Message: &cases.StringURI{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.uri_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.uri"), + ConstraintId: proto.String("string.uri_empty"), + }, + ), }, "uri/invalid/not_checked/empty": { Message: &cases.StringNotURI{Val: ""}, @@ -708,12 +1059,22 @@ func stringSuite() suites.Suite { "uri/invalid/malformed": { Message: &cases.StringURI{Val: "!@#$%^&*"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.uri")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.uri"), + ConstraintId: proto.String("string.uri"), + }, + ), }, "uri/invalid/relative": { Message: &cases.StringURI{Val: "/foo/bar?baz=quux"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.uri")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.uri"), + ConstraintId: proto.String("string.uri"), + }, + ), }, "uri_ref/valid/absolute": { Message: &cases.StringURIRef{Val: "https://example.com/foo/bar?baz=quux"}, @@ -726,7 +1087,12 @@ func stringSuite() suites.Suite { "uri_ref/invalid": { Message: &cases.StringURIRef{Val: "!@#$%^&*"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.uri_ref")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.uri_ref"), + ConstraintId: proto.String("string.uri_ref"), + }, + ), }, "uri_ref/invalid/not_checked/empty": { Message: &cases.StringNotURIRef{Val: ""}, @@ -751,7 +1117,12 @@ func stringSuite() suites.Suite { "address/invalid/empty": { Message: &cases.StringAddress{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.address_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.address"), + ConstraintId: proto.String("string.address_empty"), + }, + ), }, "address/invalid/not_checked/empty": { Message: &cases.StringNotAddress{Val: ""}, @@ -764,12 +1135,22 @@ func stringSuite() suites.Suite { "address/invalid/hostname": { Message: &cases.StringAddress{Val: "-foo.bar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.address")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.address"), + ConstraintId: proto.String("string.address"), + }, + ), }, "address/invalid/ipv6": { Message: &cases.StringAddress{Val: "ff::fff::0b"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.address")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.address"), + ConstraintId: proto.String("string.address"), + }, + ), }, "uuid/valid/nil": { Message: &cases.StringUUID{Val: "00000000-0000-0000-0000-000000000000"}, @@ -818,7 +1199,12 @@ func stringSuite() suites.Suite { "uuid/invalid/empty": { Message: &cases.StringUUID{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.uuid_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.uuid"), + ConstraintId: proto.String("string.uuid_empty"), + }, + ), }, "uuid/invalid/not_checked/empty": { Message: &cases.StringNotUUID{Val: ""}, @@ -831,22 +1217,42 @@ func stringSuite() suites.Suite { "uuid/invalid/malformed": { Message: &cases.StringUUID{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.uuid")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.uuid"), + ConstraintId: proto.String("string.uuid"), + }, + ), }, "uuid/invalid/erroneous": { Message: &cases.StringUUID{Val: "ffffffff-ffff-ffff-ffff-fffffffffffff"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.uuid")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.uuid"), + ConstraintId: proto.String("string.uuid"), + }, + ), }, "uuid/invalid/dashless/uppercase": { Message: &cases.StringUUID{Val: "8B20830500E84460A4405E0DCD83BB0A"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.uuid")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.uuid"), + ConstraintId: proto.String("string.uuid"), + }, + ), }, "uuid/invalid/dashless/lowercase": { Message: &cases.StringUUID{Val: "8b20830500e84460a4405e0dcd83bb0a"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.uuid")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.uuid"), + ConstraintId: proto.String("string.uuid"), + }, + ), }, "tuuid/valid/nil": { Message: &cases.StringTUUID{Val: "00000000000000000000000000000000"}, @@ -895,7 +1301,12 @@ func stringSuite() suites.Suite { "tuuid/invalid/empty": { Message: &cases.StringTUUID{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.tuuid_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.tuuid"), + ConstraintId: proto.String("string.tuuid_empty"), + }, + ), }, "tuuid/invalid/not_checked/empty": { Message: &cases.StringNotTUUID{Val: ""}, @@ -908,22 +1319,42 @@ func stringSuite() suites.Suite { "tuuid/invalid/malformed": { Message: &cases.StringTUUID{Val: "foobar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.tuuid")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.tuuid"), + ConstraintId: proto.String("string.tuuid"), + }, + ), }, "tuuid/invalid/erroneous": { Message: &cases.StringTUUID{Val: "fffffffffffffffffffffffffffffffff"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.tuuid")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.tuuid"), + ConstraintId: proto.String("string.tuuid"), + }, + ), }, "tuuid/invalid/dashful/uppercase": { Message: &cases.StringTUUID{Val: "8B208305-00E8-4460-A440-5E0DCD83BB0A"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.tuuid")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.tuuid"), + ConstraintId: proto.String("string.tuuid"), + }, + ), }, "tuuid/invalid/dashful/lowercase": { Message: &cases.StringTUUID{Val: "8b208305-00e8-4460-a440-5e0dcd83bb0a"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.tuuid")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.tuuid"), + ConstraintId: proto.String("string.tuuid"), + }, + ), }, "well_known_regex/header_name/strict/valid/header": { Message: &cases.StringHttpHeaderName{Val: "clustername"}, @@ -948,47 +1379,92 @@ func stringSuite() suites.Suite { "well_known_regex/header_name/strict/invalid/empty": { Message: &cases.StringHttpHeaderName{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name_empty"), + }, + ), }, "well_known_regex/header_name/strict/invalid/solo_colon": { Message: &cases.StringHttpHeaderName{Val: ":"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name"), + }, + ), }, "well_known_regex/header_name/strict/invalid/trailing_colon": { Message: &cases.StringHttpHeaderName{Val: ":foo:"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name"), + }, + ), }, "well_known_regex/header_name/strict/invalid/space": { Message: &cases.StringHttpHeaderName{Val: "foo bar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name"), + }, + ), }, "well_known_regex/header_name/strict/invalid/cr": { Message: &cases.StringHttpHeaderName{Val: "foo\rbar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name"), + }, + ), }, "well_known_regex/header_name/strict/invalid/lf": { Message: &cases.StringHttpHeaderName{Val: "foo\nbar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name"), + }, + ), }, "well_known_regex/header_name/strict/invalid/tab": { Message: &cases.StringHttpHeaderName{Val: "foo\tbar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name"), + }, + ), }, "well_known_regex/header_name/strict/invalid/nul": { Message: &cases.StringHttpHeaderName{Val: "foo\000bar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name"), + }, + ), }, "well_known_regex/header_name/strict/invalid/slash": { Message: &cases.StringHttpHeaderName{Val: "foo/bar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name"), + }, + ), }, "well_known_regex/header_name/loose/valid/slash": { Message: &cases.StringHttpHeaderNameLoose{Val: "FOO/BAR"}, @@ -1005,17 +1481,32 @@ func stringSuite() suites.Suite { "well_known_regex/header_name/loose/invalid/empty": { Message: &cases.StringHttpHeaderNameLoose{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name_empty"), + }, + ), }, "well_known_regex/header_name/loose/invalid/cr": { Message: &cases.StringHttpHeaderNameLoose{Val: "foo\rbar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name"), + }, + ), }, "well_known_regex/header_name/loose/invalid/lf": { Message: &cases.StringHttpHeaderNameLoose{Val: "foo\nbar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_name")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_name"), + }, + ), }, "well_known_regex/header_value/strict/valid/empty": { Message: &cases.StringHttpHeaderValue{Val: ""}, @@ -1044,22 +1535,42 @@ func stringSuite() suites.Suite { "well_known_regex/header_value/strict/invalid/nul": { Message: &cases.StringHttpHeaderValue{Val: "foo\000bar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_value")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_value"), + }, + ), }, "well_known_regex/header_value/strict/invalid/del": { Message: &cases.StringHttpHeaderValue{Val: "foo\007bar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_value")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_value"), + }, + ), }, "well_known_regex/header_value/strict/invalid/cr": { Message: &cases.StringHttpHeaderValue{Val: "foo\rbar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_value")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_value"), + }, + ), }, "well_known_regex/header_value/strict/invalid/lf": { Message: &cases.StringHttpHeaderValue{Val: "foo\nbar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_value")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_value"), + }, + ), }, "well_known_regex/header_name/loose/valid/del": { Message: &cases.StringHttpHeaderNameLoose{Val: "FOO\007BAR"}, @@ -1068,17 +1579,32 @@ func stringSuite() suites.Suite { "well_known_regex/header_value/loose/invalid/nul": { Message: &cases.StringHttpHeaderValueLoose{Val: "\000"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_value")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_value"), + }, + ), }, "well_known_regex/header_value/loose/invalid/cr": { Message: &cases.StringHttpHeaderValueLoose{Val: "foo\rbar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_value")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_value"), + }, + ), }, "well_known_regex/header_value/loose/invalid/lf": { Message: &cases.StringHttpHeaderValueLoose{Val: "foo\nbar"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.well_known_regex.header_value")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.well_known_regex"), + ConstraintId: proto.String("string.well_known_regex.header_value"), + }, + ), }, "host_and_port/valid/hostname": { Message: &cases.StringHostAndPort{Val: "localhost:1234"}, @@ -1095,42 +1621,82 @@ func stringSuite() suites.Suite { "host_and_port/invalid/empty": { Message: &cases.StringHostAndPort{Val: ""}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port_empty")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.host_and_port"), + ConstraintId: proto.String("string.host_and_port_empty"), + }, + ), }, "host_and_port/invalid/missing_port": { Message: &cases.StringHostAndPort{Val: "localhost"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.host_and_port"), + ConstraintId: proto.String("string.host_and_port"), + }, + ), }, "host_and_port/invalid/whitespace": { Message: &cases.StringHostAndPort{Val: " localhost:8080 "}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.host_and_port"), + ConstraintId: proto.String("string.host_and_port"), + }, + ), }, "host_and_port/invalid/malformed_hostname": { Message: &cases.StringHostAndPort{Val: "abc#123:456"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.host_and_port"), + ConstraintId: proto.String("string.host_and_port"), + }, + ), }, "host_and_port/invalid/malformed_ipv4": { Message: &cases.StringHostAndPort{Val: "123.456.789.100:8080"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.host_and_port"), + ConstraintId: proto.String("string.host_and_port"), + }, + ), }, "host_and_port/invalid/malformed_ipv6": { Message: &cases.StringHostAndPort{Val: "[1::jk::3]:8080"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.host_and_port"), + ConstraintId: proto.String("string.host_and_port"), + }, + ), }, "host_and_port/invalid/unbracketed_ipv6": { Message: &cases.StringHostAndPort{Val: "::1:8080"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.host_and_port"), + ConstraintId: proto.String("string.host_and_port"), + }, + ), }, "host_and_port/invalid/port_out_of_range": { Message: &cases.StringHostAndPort{Val: "localhost:99999"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("string.host_and_port"), + ConstraintId: proto.String("string.host_and_port"), + }, + ), }, "host_and_port/optional_port/valid/hostname": { Message: &cases.StringHostAndOptionalPort{Val: "localhost"}, @@ -1159,17 +1725,29 @@ func stringSuite() suites.Suite { "host_and_port/optional_port/invalid/malformed_hostname": { Message: &cases.StringHostAndOptionalPort{Val: "abc#123"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port.optional_port")}), + &validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("string.host_and_port.optional_port"), + }, + ), }, "host_and_port/optional_port/invalid/malformed_ipv4": { Message: &cases.StringHostAndOptionalPort{Val: "123.456.789.100"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port.optional_port")}), + &validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("string.host_and_port.optional_port"), + }, + ), }, "host_and_port/optional_port/invalid/malformed_ipv6": { Message: &cases.StringHostAndOptionalPort{Val: "[1::jk::3]"}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("string.host_and_port.optional_port")}), + &validate.Violation{ + FieldPath: proto.String("val"), + ConstraintId: proto.String("string.host_and_port.optional_port"), + }, + ), }, "example/valid": { Message: &cases.StringExample{Val: "foobar"}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_timestamp.go b/tools/protovalidate-conformance/internal/cases/cases_timestamp.go index 510560ee..4289525e 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_timestamp.go +++ b/tools/protovalidate-conformance/internal/cases/cases_timestamp.go @@ -36,8 +36,12 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "required/invalid": { - Message: &cases.TimestampRequired{Val: nil}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required")}), + Message: &cases.TimestampRequired{Val: nil}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("required"), + ConstraintId: proto.String("required"), + }), }, "const/valid": { Message: &cases.TimestampConst{Val: ×tamppb.Timestamp{Seconds: 3, Nanos: 0}}, @@ -48,8 +52,12 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "const/invalid": { - Message: &cases.TimestampConst{Val: ×tamppb.Timestamp{Nanos: 3}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.const")}), + Message: &cases.TimestampConst{Val: ×tamppb.Timestamp{Nanos: 3}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.const"), + ConstraintId: proto.String("timestamp.const"), + }), }, "lt/valid": { Message: &cases.TimestampLT{Val: ×tamppb.Timestamp{Seconds: -1}}, @@ -60,12 +68,20 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "lt/invalid/equal": { - Message: &cases.TimestampLT{Val: ×tamppb.Timestamp{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.lt")}), + Message: &cases.TimestampLT{Val: ×tamppb.Timestamp{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.lt"), + ConstraintId: proto.String("timestamp.lt"), + }), }, "lt/invalid": { - Message: &cases.TimestampLT{Val: ×tamppb.Timestamp{Seconds: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.lt")}), + Message: &cases.TimestampLT{Val: ×tamppb.Timestamp{Seconds: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.lt"), + ConstraintId: proto.String("timestamp.lt"), + }), }, "lte/valid": { Message: &cases.TimestampLTE{Val: ×tamppb.Timestamp{}}, @@ -80,8 +96,12 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "lte/invalid": { - Message: &cases.TimestampLTE{Val: ×tamppb.Timestamp{Seconds: 1, Nanos: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.lte")}), + Message: &cases.TimestampLTE{Val: ×tamppb.Timestamp{Seconds: 1, Nanos: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.lte"), + ConstraintId: proto.String("timestamp.lte"), + }), }, "gt/valid": { Message: &cases.TimestampGT{Val: ×tamppb.Timestamp{Seconds: 1}}, @@ -92,12 +112,20 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "gt/invalid/equal": { - Message: &cases.TimestampGT{Val: ×tamppb.Timestamp{Nanos: 1000}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt")}), + Message: &cases.TimestampGT{Val: ×tamppb.Timestamp{Nanos: 1000}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt"), + ConstraintId: proto.String("timestamp.gt"), + }), }, "gt/invalid": { - Message: &cases.TimestampGT{Val: ×tamppb.Timestamp{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt")}), + Message: &cases.TimestampGT{Val: ×tamppb.Timestamp{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt"), + ConstraintId: proto.String("timestamp.gt"), + }), }, "gte/valid": { Message: &cases.TimestampGTE{Val: ×tamppb.Timestamp{Seconds: 3}}, @@ -112,8 +140,12 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "gte/invalid": { - Message: &cases.TimestampGTE{Val: ×tamppb.Timestamp{Seconds: -1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gte")}), + Message: &cases.TimestampGTE{Val: ×tamppb.Timestamp{Seconds: -1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gte"), + ConstraintId: proto.String("timestamp.gte"), + }), }, "gt_lt/valid": { Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{Nanos: 1000}}, @@ -124,20 +156,36 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "gt_lt/invalid/above": { - Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{Seconds: 1000}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt_lt")}), + Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{Seconds: 1000}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt"), + ConstraintId: proto.String("timestamp.gt_lt"), + }), }, "gt_lt/invalid/below": { - Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{Seconds: -1000}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt_lt")}), + Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{Seconds: -1000}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt"), + ConstraintId: proto.String("timestamp.gt_lt"), + }), }, "gt_lt/invalid/max": { - Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{Seconds: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt_lt")}), + Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{Seconds: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt"), + ConstraintId: proto.String("timestamp.gt_lt"), + }), }, "gt_lt/invalid/min": { - Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt_lt")}), + Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt"), + ConstraintId: proto.String("timestamp.gt_lt"), + }), }, "exclusive/gt_lt/valid/empty": { Message: &cases.TimestampExLTGT{}, @@ -152,16 +200,28 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "exclusive/gt_lt/invalid": { - Message: &cases.TimestampExLTGT{Val: ×tamppb.Timestamp{Nanos: 1000}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt_lt_exclusive")}), + Message: &cases.TimestampExLTGT{Val: ×tamppb.Timestamp{Nanos: 1000}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt"), + ConstraintId: proto.String("timestamp.gt_lt_exclusive"), + }), }, "exclusive/gt_lt/invalid/max": { - Message: &cases.TimestampExLTGT{Val: ×tamppb.Timestamp{Seconds: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt_lt_exclusive")}), + Message: &cases.TimestampExLTGT{Val: ×tamppb.Timestamp{Seconds: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt"), + ConstraintId: proto.String("timestamp.gt_lt_exclusive"), + }), }, "exclusive/gt_lt/invalid/min": { - Message: &cases.TimestampExLTGT{Val: ×tamppb.Timestamp{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt_lt_exclusive")}), + Message: &cases.TimestampExLTGT{Val: ×tamppb.Timestamp{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt"), + ConstraintId: proto.String("timestamp.gt_lt_exclusive"), + }), }, "gte_lte/valid": { Message: &cases.TimestampGTELTE{Val: ×tamppb.Timestamp{Seconds: 60, Nanos: 1}}, @@ -180,12 +240,20 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "gte_lte/invalid/above": { - Message: &cases.TimestampGTELTE{Val: ×tamppb.Timestamp{Seconds: 3600, Nanos: 1}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gte_lte")}), + Message: &cases.TimestampGTELTE{Val: ×tamppb.Timestamp{Seconds: 3600, Nanos: 1}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gte"), + ConstraintId: proto.String("timestamp.gte_lte"), + }), }, "gte_lte/invalid/below": { - Message: &cases.TimestampGTELTE{Val: ×tamppb.Timestamp{Seconds: 59}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gte_lte")}), + Message: &cases.TimestampGTELTE{Val: ×tamppb.Timestamp{Seconds: 59}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gte"), + ConstraintId: proto.String("timestamp.gte_lte"), + }), }, "exclusive/gte_lte/valid/empty": { Message: &cases.TimestampExGTELTE{}, @@ -208,8 +276,12 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "exclusive/gte_lte/invalid": { - Message: &cases.TimestampExGTELTE{Val: ×tamppb.Timestamp{Seconds: 61}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gte_lte_exclusive")}), + Message: &cases.TimestampExGTELTE{Val: ×tamppb.Timestamp{Seconds: 61}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gte"), + ConstraintId: proto.String("timestamp.gte_lte_exclusive"), + }), }, "lt_now/valid": { Message: &cases.TimestampLTNow{Val: ×tamppb.Timestamp{}}, @@ -220,8 +292,12 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "lt_now/invalid": { - Message: &cases.TimestampLTNow{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 7200}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.lt_now")}), + Message: &cases.TimestampLTNow{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 7200}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.lt_now"), + ConstraintId: proto.String("timestamp.lt_now"), + }), }, "lt_now/invalid/not_checked": { Message: &cases.TimestampNotLTNow{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 7200}}, @@ -236,8 +312,12 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "gt_now/invalid": { - Message: &cases.TimestampGTNow{Val: ×tamppb.Timestamp{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt_now")}), + Message: &cases.TimestampGTNow{Val: ×tamppb.Timestamp{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt_now"), + ConstraintId: proto.String("timestamp.gt_now"), + }), }, "gt_now/invalid/not_checked": { Message: &cases.TimestampNotGTNow{Val: ×tamppb.Timestamp{}}, @@ -252,12 +332,20 @@ func timestampSuite() suites.Suite { Expected: results.Success(true), }, "within/invalid/below": { - Message: &cases.TimestampWithin{Val: ×tamppb.Timestamp{}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.within")}), + Message: &cases.TimestampWithin{Val: ×tamppb.Timestamp{}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.within"), + ConstraintId: proto.String("timestamp.within"), + }), }, "within/invalid/above": { - Message: &cases.TimestampWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 7200}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.within")}), + Message: &cases.TimestampWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 7200}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.within"), + ConstraintId: proto.String("timestamp.within"), + }), }, "lt_now/within/valid": { Message: &cases.TimestampLTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() - 1800}}, @@ -270,11 +358,19 @@ func timestampSuite() suites.Suite { "lt_now/within/invalid/lt": { Message: &cases.TimestampLTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 1800}}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.lt_now")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.lt_now"), + ConstraintId: proto.String("timestamp.lt_now"), + }), }, "lt_now/within/invalid/within": { - Message: &cases.TimestampLTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() / 7200}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.within")}), + Message: &cases.TimestampLTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() / 7200}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.within"), + ConstraintId: proto.String("timestamp.within"), + }), }, "gt_now/within/valid": { Message: &cases.TimestampGTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 1800}}, @@ -287,13 +383,23 @@ func timestampSuite() suites.Suite { "gt_now/within/invalid/gt": { Message: &cases.TimestampGTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() / 1800}}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.gt_now")}, - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.within")}, + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.gt_now"), + ConstraintId: proto.String("timestamp.gt_now")}, + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.within"), + ConstraintId: proto.String("timestamp.within")}, ), }, "gt_now/within/invalid/within": { - Message: &cases.TimestampGTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 7200}}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("timestamp.within")}), + Message: &cases.TimestampGTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 7200}}, + Expected: results.Violations(&validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("timestamp.within"), + ConstraintId: proto.String("timestamp.within"), + }), }, "example/valid": { Message: &cases.TimestampExample{Val: ×tamppb.Timestamp{Seconds: 3, Nanos: 0}}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_uint32.go b/tools/protovalidate-conformance/internal/cases/cases_uint32.go index ff45a3bc..87341358 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_uint32.go +++ b/tools/protovalidate-conformance/internal/cases/cases_uint32.go @@ -35,7 +35,12 @@ func uint32Suite() suites.Suite { "const/invalid": { Message: &cases.UInt32Const{Val: 2}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.const"), + ConstraintId: proto.String("uint32.const"), + }, + ), }, "in/valid": { Message: &cases.UInt32In{Val: 3}, @@ -44,7 +49,12 @@ func uint32Suite() suites.Suite { "in/invalid": { Message: &cases.UInt32In{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.in"), + ConstraintId: proto.String("uint32.in"), + }, + ), }, "not_in/valid": { Message: &cases.UInt32NotIn{Val: 1}, @@ -53,7 +63,12 @@ func uint32Suite() suites.Suite { "not_in/invalid": { Message: &cases.UInt32NotIn{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.not_in"), + ConstraintId: proto.String("uint32.not_in"), + }, + ), }, "lt/valid/less": { Message: &cases.UInt32LT{Val: 4}, @@ -62,12 +77,22 @@ func uint32Suite() suites.Suite { "lt/invalid/equal": { Message: &cases.UInt32LT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.lt"), + ConstraintId: proto.String("uint32.lt"), + }, + ), }, "lt/invalid/greater": { Message: &cases.UInt32LT{Val: 6}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.lt"), + ConstraintId: proto.String("uint32.lt"), + }, + ), }, "lte/valid/less": { Message: &cases.UInt32LTE{Val: 63}, @@ -80,7 +105,12 @@ func uint32Suite() suites.Suite { "lte/invalid/greater": { Message: &cases.UInt32LTE{Val: 65}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.lte"), + ConstraintId: proto.String("uint32.lte"), + }, + ), }, "gt/valid/greater": { Message: &cases.UInt32GT{Val: 17}, @@ -89,12 +119,22 @@ func uint32Suite() suites.Suite { "gt/invalid/equal": { Message: &cases.UInt32GT{Val: 16}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gt"), + ConstraintId: proto.String("uint32.gt"), + }, + ), }, "gt/invalid/less": { Message: &cases.UInt32GT{Val: 15}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gt"), + ConstraintId: proto.String("uint32.gt"), + }, + ), }, "gte/valid/greater": { Message: &cases.UInt32GTE{Val: 9}, @@ -107,7 +147,12 @@ func uint32Suite() suites.Suite { "gte/invalid/less": { Message: &cases.UInt32GTE{Val: 7}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gte"), + ConstraintId: proto.String("uint32.gte"), + }, + ), }, "gt_lt/inclusive/valid/within": { Message: &cases.UInt32GTLT{Val: 6}, @@ -116,22 +161,42 @@ func uint32Suite() suites.Suite { "gt_lt/inclusive/invalid/above": { Message: &cases.UInt32GTLT{Val: 11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gt"), + ConstraintId: proto.String("uint32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/below": { Message: &cases.UInt32GTLT{Val: 4}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gt"), + ConstraintId: proto.String("uint32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/max": { Message: &cases.UInt32GTLT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gt"), + ConstraintId: proto.String("uint32.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/min": { Message: &cases.UInt32GTLT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gt"), + ConstraintId: proto.String("uint32.gt_lt"), + }, + ), }, "gt_lt/exclusive/valid/above": { Message: &cases.UInt32ExLTGT{Val: 11}, @@ -144,17 +209,32 @@ func uint32Suite() suites.Suite { "gt_lt/exclusive/invalid/within": { Message: &cases.UInt32ExLTGT{Val: 6}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gt"), + ConstraintId: proto.String("uint32.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/max": { Message: &cases.UInt32ExLTGT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gt"), + ConstraintId: proto.String("uint32.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/min": { Message: &cases.UInt32ExLTGT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gt"), + ConstraintId: proto.String("uint32.gt_lt_exclusive"), + }, + ), }, "gte_lte/inclusive/valid/within": { Message: &cases.UInt32GTELTE{Val: 200}, @@ -171,12 +251,22 @@ func uint32Suite() suites.Suite { "gte_lte/inclusive/invalid/above": { Message: &cases.UInt32GTELTE{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gte"), + ConstraintId: proto.String("uint32.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/below": { Message: &cases.UInt32GTELTE{Val: 100}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gte"), + ConstraintId: proto.String("uint32.gte_lte"), + }, + ), }, "gte_lte/exclusive/valid/above": { Message: &cases.UInt32ExGTELTE{Val: 300}, @@ -197,7 +287,12 @@ func uint32Suite() suites.Suite { "gte_lte/exclusive/invalid/within": { Message: &cases.UInt32ExGTELTE{Val: 200}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gte"), + ConstraintId: proto.String("uint32.gte_lte_exclusive"), + }, + ), }, "ignore_empty/valid/empty": { Message: &cases.UInt32Ignore{Val: 0}, @@ -210,7 +305,12 @@ func uint32Suite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.UInt32Ignore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint32.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gte"), + ConstraintId: proto.String("uint32.gte_lte"), + }, + ), }, "compilation/wrong_type": { Message: &cases.UInt32IncorrectType{Val: 123}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_uint64.go b/tools/protovalidate-conformance/internal/cases/cases_uint64.go index 8aa13231..1d529b7b 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_uint64.go +++ b/tools/protovalidate-conformance/internal/cases/cases_uint64.go @@ -35,7 +35,12 @@ func uint64Suite() suites.Suite { "const/invalid": { Message: &cases.UInt64Const{Val: 2}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.const")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.const"), + ConstraintId: proto.String("uint64.const"), + }, + ), }, "in/valid": { Message: &cases.UInt64In{Val: 3}, @@ -44,7 +49,12 @@ func uint64Suite() suites.Suite { "in/invalid": { Message: &cases.UInt64In{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.in"), + ConstraintId: proto.String("uint64.in"), + }, + ), }, "not_in/valid": { Message: &cases.UInt64NotIn{Val: 1}, @@ -53,7 +63,12 @@ func uint64Suite() suites.Suite { "not_in/invalid": { Message: &cases.UInt64NotIn{Val: 0}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.not_in")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.not_in"), + ConstraintId: proto.String("uint64.not_in"), + }, + ), }, "lt/valid/less": { Message: &cases.UInt64LT{Val: 4}, @@ -62,12 +77,22 @@ func uint64Suite() suites.Suite { "lt/invalid/equal": { Message: &cases.UInt64LT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.lt"), + ConstraintId: proto.String("uint64.lt"), + }, + ), }, "lt/invalid/greater": { Message: &cases.UInt64LT{Val: 6}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.lt"), + ConstraintId: proto.String("uint64.lt"), + }, + ), }, "lte/valid/less": { Message: &cases.UInt64LTE{Val: 63}, @@ -80,7 +105,12 @@ func uint64Suite() suites.Suite { "lte/invalid/greater": { Message: &cases.UInt64LTE{Val: 65}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.lte"), + ConstraintId: proto.String("uint64.lte"), + }, + ), }, "gt/valid/greater": { Message: &cases.UInt64GT{Val: 17}, @@ -89,12 +119,22 @@ func uint64Suite() suites.Suite { "gt/invalid/equal": { Message: &cases.UInt64GT{Val: 16}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gt"), + ConstraintId: proto.String("uint64.gt"), + }, + ), }, "gt/invalid/less": { Message: &cases.UInt64GT{Val: 15}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gt"), + ConstraintId: proto.String("uint64.gt"), + }, + ), }, "gte/valid/greater": { Message: &cases.UInt64GTE{Val: 9}, @@ -107,7 +147,12 @@ func uint64Suite() suites.Suite { "gte/invalid/less": { Message: &cases.UInt64GTE{Val: 7}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gte"), + ConstraintId: proto.String("uint64.gte"), + }, + ), }, "gt_lt/inclusive/valid/within": { Message: &cases.UInt64GTLT{Val: 6}, @@ -116,22 +161,42 @@ func uint64Suite() suites.Suite { "gt_lt/inclusive/invalid/above": { Message: &cases.UInt64GTLT{Val: 11}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gt"), + ConstraintId: proto.String("uint64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/below": { Message: &cases.UInt64GTLT{Val: 4}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gt"), + ConstraintId: proto.String("uint64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/max": { Message: &cases.UInt64GTLT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gt"), + ConstraintId: proto.String("uint64.gt_lt"), + }, + ), }, "gt_lt/inclusive/invalid/min": { Message: &cases.UInt64GTLT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gt_lt")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gt"), + ConstraintId: proto.String("uint64.gt_lt"), + }, + ), }, "gt_lt/exclusive/valid/above": { Message: &cases.UInt64ExLTGT{Val: 11}, @@ -144,17 +209,32 @@ func uint64Suite() suites.Suite { "gt_lt/exclusive/invalid/within": { Message: &cases.UInt64ExLTGT{Val: 6}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gt"), + ConstraintId: proto.String("uint64.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/max": { Message: &cases.UInt64ExLTGT{Val: 10}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gt"), + ConstraintId: proto.String("uint64.gt_lt_exclusive"), + }, + ), }, "gt_lt/exclusive/invalid/min": { Message: &cases.UInt64ExLTGT{Val: 5}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gt_lt_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gt"), + ConstraintId: proto.String("uint64.gt_lt_exclusive"), + }, + ), }, "gte_lte/inclusive/valid/within": { Message: &cases.UInt64GTELTE{Val: 200}, @@ -171,12 +251,22 @@ func uint64Suite() suites.Suite { "gte_lte/inclusive/invalid/above": { Message: &cases.UInt64GTELTE{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gte"), + ConstraintId: proto.String("uint64.gte_lte"), + }, + ), }, "gte_lte/inclusive/invalid/below": { Message: &cases.UInt64GTELTE{Val: 100}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gte"), + ConstraintId: proto.String("uint64.gte_lte"), + }, + ), }, "gte_lte/exclusive/valid/above": { Message: &cases.UInt64ExGTELTE{Val: 300}, @@ -197,7 +287,12 @@ func uint64Suite() suites.Suite { "gte_lte/exclusive/invalid/within": { Message: &cases.UInt64ExGTELTE{Val: 200}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gte_lte_exclusive")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gte"), + ConstraintId: proto.String("uint64.gte_lte_exclusive"), + }, + ), }, "ignore_empty/valid/empty": { Message: &cases.UInt64Ignore{Val: 0}, @@ -210,7 +305,12 @@ func uint64Suite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.UInt64Ignore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("uint64.gte_lte")}), + &validate.Violation{ + FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gte"), + ConstraintId: proto.String("uint64.gte_lte"), + }, + ), }, "compilation/wrong_type": { Message: &cases.UInt64IncorrectType{Val: 123}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_wrapper.go b/tools/protovalidate-conformance/internal/cases/cases_wrapper.go index b929f2d7..fb1c8a46 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_wrapper.go +++ b/tools/protovalidate-conformance/internal/cases/cases_wrapper.go @@ -45,6 +45,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperFloat{Val: &wrapperspb.FloatValue{Value: 0}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), ConstraintId: proto.String("float.gt"), Message: proto.String("value must be greater than 0"), }), @@ -61,6 +62,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperDouble{Val: &wrapperspb.DoubleValue{Value: 0}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("double.gt"), ConstraintId: proto.String("double.gt"), Message: proto.String("value must be greater than 0"), }), @@ -77,6 +79,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperInt64{Val: &wrapperspb.Int64Value{Value: 0}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }), @@ -93,6 +96,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperInt32{Val: &wrapperspb.Int32Value{Value: 0}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("int32.gt"), ConstraintId: proto.String("int32.gt"), Message: proto.String("value must be greater than 0"), }), @@ -109,6 +113,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperUInt64{Val: &wrapperspb.UInt64Value{Value: 0}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint64.gt"), ConstraintId: proto.String("uint64.gt"), Message: proto.String("value must be greater than 0"), }), @@ -125,6 +130,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperUInt32{Val: &wrapperspb.UInt32Value{Value: 0}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("uint32.gt"), ConstraintId: proto.String("uint32.gt"), Message: proto.String("value must be greater than 0"), }), @@ -141,6 +147,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperBool{Val: &wrapperspb.BoolValue{Value: false}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bool.const"), ConstraintId: proto.String("bool.const"), Message: proto.String("value must equal true"), }), @@ -157,6 +164,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperString{Val: &wrapperspb.StringValue{Value: "fizzbuzz"}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.suffix"), ConstraintId: proto.String("string.suffix"), Message: proto.String("value does not have suffix `bar`"), }), @@ -173,6 +181,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperBytes{Val: &wrapperspb.BytesValue{Value: []byte("x")}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("bytes.min_len"), ConstraintId: proto.String("bytes.min_len"), Message: proto.String("value length must be at least 3 bytes"), }), @@ -185,6 +194,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperRequiredString{Val: &wrapperspb.StringValue{Value: "foo"}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `bar`"), }), @@ -193,6 +203,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperRequiredString{}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }), @@ -205,13 +216,14 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperRequiredEmptyString{Val: &wrapperspb.StringValue{Value: "foo"}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal ``"), }), }, "required/empty/string/empty/invalid": { Message: &cases.WrapperRequiredEmptyString{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), ConstraintId: proto.String("required"), Message: proto.String("value is required")}), + Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required")}), }, "optional/string/uuid/valid": { Message: &cases.WrapperOptionalUuidString{Val: &wrapperspb.StringValue{Value: "8b72987b-024a-43b3-b4cf-647a1f925c5d"}}, @@ -225,6 +237,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperOptionalUuidString{Val: &wrapperspb.StringValue{Value: "foo"}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("string.uuid"), ConstraintId: proto.String("string.uuid"), Message: proto.String("value must be a valid UUID"), }), @@ -237,6 +250,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperRequiredFloat{Val: &wrapperspb.FloatValue{Value: -5}}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("float.gt"), ConstraintId: proto.String("float.gt"), Message: proto.String("value must be greater than 0"), }), @@ -245,6 +259,7 @@ func wrapperSuite() suites.Suite { Message: &cases.WrapperRequiredFloat{}, Expected: results.Violations(&validate.Violation{ FieldPath: proto.String("val"), + RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }), diff --git a/tools/protovalidate-conformance/internal/results/result.go b/tools/protovalidate-conformance/internal/results/result.go index 03da0582..dfc5a055 100644 --- a/tools/protovalidate-conformance/internal/results/result.go +++ b/tools/protovalidate-conformance/internal/results/result.go @@ -113,7 +113,11 @@ func (v violationsResult) String() string { if err.GetForKey() { forKey = " (key)" } - _, _ = fmt.Fprintf(bldr, "\n%s %2d. %s%s: %s", resultPadding, i+1, err.GetFieldPath(), forKey, err.GetConstraintId()) + rulePath := "" + if err.GetRulePath() != "" { + rulePath = " (" + err.GetRulePath() + ")" + } + _, _ = fmt.Fprintf(bldr, "\n%s %2d. %s%s: %s%s", resultPadding, i+1, err.GetFieldPath(), forKey, err.GetConstraintId(), rulePath) _, _ = fmt.Fprintf(bldr, "\n%s %s", resultPadding, err.GetMessage()) } return bldr.String() @@ -134,8 +138,9 @@ func (v violationsResult) IsSuccessWith(other Result, options *harness.ResultOpt } for i := range len(want) { matchingField := want[i].GetFieldPath() == got[i].GetFieldPath() && want[i].GetForKey() == got[i].GetForKey() + matchingRule := want[i].GetRulePath() == got[i].GetRulePath() matchingConstraint := want[i].GetConstraintId() == got[i].GetConstraintId() - if !matchingField || !matchingConstraint { + if !matchingField || !matchingRule || !matchingConstraint { return false } if options.GetStrictMessage() && len(want[i].GetMessage()) > 0 && From 432d9b8c512c0143a8b0e11688258ccbd4bc408e Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Wed, 6 Nov 2024 17:22:13 -0500 Subject: [PATCH 05/14] Structured field and rule paths --- .../protovalidate/buf/validate/validate.proto | 66 +- .../internal/gen/buf/validate/validate.pb.go | 592 ++++++++++---- .../internal/cases/cases_any.go | 16 +- .../internal/cases/cases_bool.go | 8 +- .../internal/cases/cases_bytes.go | 84 +- .../cases/cases_custom_constraints.go | 16 +- .../internal/cases/cases_double.go | 126 +-- .../internal/cases/cases_duration.go | 84 +- .../internal/cases/cases_enum.go | 36 +- .../internal/cases/cases_fixed32.go | 80 +- .../internal/cases/cases_fixed64.go | 80 +- .../internal/cases/cases_float.go | 132 ++-- .../internal/cases/cases_ignore.go | 736 +++++++++--------- .../internal/cases/cases_ignore_empty.go | 128 +-- .../internal/cases/cases_int32.go | 80 +- .../internal/cases/cases_int64.go | 80 +- .../internal/cases/cases_kitchensink.go | 186 +++-- .../internal/cases/cases_map.go | 48 +- .../internal/cases/cases_message.go | 31 +- .../internal/cases/cases_nested.go | 4 +- .../internal/cases/cases_oneof.go | 26 +- .../internal/cases/cases_predefined.go | 524 ++++++------- .../internal/cases/cases_repeated.go | 108 +-- .../internal/cases/cases_required.go | 96 +-- .../internal/cases/cases_sfixed32.go | 76 +- .../internal/cases/cases_sfixed64.go | 76 +- .../internal/cases/cases_sint32.go | 80 +- .../internal/cases/cases_sint64.go | 80 +- .../internal/cases/cases_strings.go | 462 +++++------ .../internal/cases/cases_timestamp.go | 108 +-- .../internal/cases/cases_uint32.go | 80 +- .../internal/cases/cases_uint64.go | 80 +- .../internal/cases/cases_wrapper.go | 62 +- .../internal/fieldpath/fieldpath.go | 268 +++++++ .../internal/results/result.go | 75 +- .../internal/suites/suite.go | 6 + 36 files changed, 2759 insertions(+), 2061 deletions(-) create mode 100644 tools/protovalidate-conformance/internal/fieldpath/fieldpath.go diff --git a/proto/protovalidate/buf/validate/validate.proto b/proto/protovalidate/buf/validate/validate.proto index b7ec1e7b..6b3b32c2 100644 --- a/proto/protovalidate/buf/validate/validate.proto +++ b/proto/protovalidate/buf/validate/validate.proto @@ -4770,14 +4770,20 @@ message Violations { // } // ``` message Violation { - // `field_path` is a machine-readable identifier that points to the specific field that failed the validation. + // `field` is a machine-readable path to the field that failed validation. // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. - optional string field_path = 1; + optional FieldPath field = 5; - // `rule_path` is a machine-readable identifier that points to the specific constraint rule that failed validation. + // `rule` is a machine-readable path that points to the specific constraint rule that failed validation. // This will be a nested field starting from the FieldConstraints of the field that failed validation. - // This value is not present when there is no corresponding rule field, e.g. for custom constraints. - optional string rule_path = 5; + // This field is not present when there is no corresponding rule field, e.g. for custom constraints. + optional FieldPath rule = 6; + + // `field_path` is a human-readable identifier that points to the specific field that failed the validation. + // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. + // + // Deprecated: use the `field` instead. + optional string field_path = 1; // `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. // This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated. @@ -4790,3 +4796,53 @@ message Violation { // `for_key` indicates whether the violation was caused by a map key, rather than a value. optional bool for_key = 4; } + +// `FieldPath` provides a path to a nested protobuf field. +// +// This message provides enough information to render a dotted field path even without protobuf descriptors. +// It also provides enough information to resolve a nested field through unknown wire data. +message FieldPath { + // `elements` contains each element of the path, starting from the root and recursing downward. + repeated FieldPathElement elements = 1; +} + +// `FieldPathElement` provides enough information to nest through a single protobuf field. +// +// If the selected field is a map or repeated field, the `subscript` value selects a specific element from it. +// A path that refers to a map or repeated field and not an element under it will not have a `subscript` value. +// The `field_type` field allows unambiguous resolution of a field even if descriptors are not available. +message FieldPathElement { + // `field_number` is the field number this path element refers to. + optional int32 field_number = 1; + + // `field_name` contains the field name this path element refers to. + // This can be used to display a human-readable path even if the field number is unknown. + optional string field_name = 2; + + // `field_type` specifies the type of this field. When using reflection, this value is not needed. + // + // This value is provided to make it possible to traverse unknown fields through wire data. + // When traversing wire data, be mindful of both packed and delimited encoding schemes. + optional google.protobuf.FieldDescriptorProto.Type field_type = 3; + + // `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. + oneof subscript { + // `index` specifies a 0-based index into a repeated field. + uint64 index = 4; + + // `bool_key` specifies a map key of type bool. + bool bool_key = 5; + + // `int_key` specifies a map key of type int32, int64, sfixed32 or sfixed64. + int64 int_key = 6; + + // `sint_key` specifies a map key of type sint32 or sint64. + sint64 sint_key = 7; + + // `uint_key` specifies a map key of type uint32, uint64, fixed32 or fixed64. + uint64 uint_key = 8; + + // `string_key` specifies a map key of type string. + string string_key = 9; + } +} diff --git a/tools/internal/gen/buf/validate/validate.pb.go b/tools/internal/gen/buf/validate/validate.pb.go index 4cc6a2d0..22e06ebf 100644 --- a/tools/internal/gen/buf/validate/validate.pb.go +++ b/tools/internal/gen/buf/validate/validate.pb.go @@ -6766,13 +6766,18 @@ type Violation struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // `field_path` is a machine-readable identifier that points to the specific field that failed the validation. + // `field` is a machine-readable path to the field that failed validation. // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. - FieldPath *string `protobuf:"bytes,1,opt,name=field_path,json=fieldPath" json:"field_path,omitempty"` - // `rule_path` is a machine-readable identifier that points to the specific constraint rule that failed validation. + Field *FieldPath `protobuf:"bytes,5,opt,name=field" json:"field,omitempty"` + // `rule` is a machine-readable path that points to the specific constraint rule that failed validation. // This will be a nested field starting from the FieldConstraints of the field that failed validation. - // This value is not present when there is no corresponding rule field, e.g. for custom constraints. - RulePath *string `protobuf:"bytes,5,opt,name=rule_path,json=rulePath" json:"rule_path,omitempty"` + // This field is not present when there is no corresponding rule field, e.g. for custom constraints. + Rule *FieldPath `protobuf:"bytes,6,opt,name=rule" json:"rule,omitempty"` + // `field_path` is a human-readable identifier that points to the specific field that failed the validation. + // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. + // + // Deprecated: use the `field` instead. + FieldPath *string `protobuf:"bytes,1,opt,name=field_path,json=fieldPath" json:"field_path,omitempty"` // `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. // This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated. ConstraintId *string `protobuf:"bytes,2,opt,name=constraint_id,json=constraintId" json:"constraint_id,omitempty"` @@ -6815,16 +6820,23 @@ func (*Violation) Descriptor() ([]byte, []int) { return file_buf_validate_validate_proto_rawDescGZIP(), []int{27} } -func (x *Violation) GetFieldPath() string { - if x != nil && x.FieldPath != nil { - return *x.FieldPath +func (x *Violation) GetField() *FieldPath { + if x != nil { + return x.Field } - return "" + return nil +} + +func (x *Violation) GetRule() *FieldPath { + if x != nil { + return x.Rule + } + return nil } -func (x *Violation) GetRulePath() string { - if x != nil && x.RulePath != nil { - return *x.RulePath +func (x *Violation) GetFieldPath() string { + if x != nil && x.FieldPath != nil { + return *x.FieldPath } return "" } @@ -6850,6 +6862,239 @@ func (x *Violation) GetForKey() bool { return false } +// `FieldPath` provides a path to a nested protobuf field. +// +// This message provides enough information to render a dotted field path even without protobuf descriptors. +// It also provides enough information to resolve a nested field through unknown wire data. +type FieldPath struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `elements` contains each element of the path, starting from the root and recursing downward. + Elements []*FieldPathElement `protobuf:"bytes,1,rep,name=elements" json:"elements,omitempty"` +} + +func (x *FieldPath) Reset() { + *x = FieldPath{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_validate_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FieldPath) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FieldPath) ProtoMessage() {} + +func (x *FieldPath) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_validate_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FieldPath.ProtoReflect.Descriptor instead. +func (*FieldPath) Descriptor() ([]byte, []int) { + return file_buf_validate_validate_proto_rawDescGZIP(), []int{28} +} + +func (x *FieldPath) GetElements() []*FieldPathElement { + if x != nil { + return x.Elements + } + return nil +} + +// `FieldPathElement` provides enough information to nest through a single protobuf field. +// +// If the selected field is a map or repeated field, the `subscript` value selects a specific element from it. +// A path that refers to a map or repeated field and not an element under it will not have a `subscript` value. +// The `field_type` field allows unambiguous resolution of a field even if descriptors are not available. +type FieldPathElement struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `field_number` is the field number this path element refers to. + FieldNumber *int32 `protobuf:"varint,1,opt,name=field_number,json=fieldNumber" json:"field_number,omitempty"` + // `field_name` contains the field name this path element refers to. + // This can be used to display a human-readable path even if the field number is unknown. + FieldName *string `protobuf:"bytes,2,opt,name=field_name,json=fieldName" json:"field_name,omitempty"` + // `field_type` specifies the type of this field. When using reflection, this value is not needed. + // + // This value is provided to make it possible to traverse unknown fields through wire data. + // When traversing wire data, be mindful of both packed and delimited encoding schemes. + FieldType *descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,3,opt,name=field_type,json=fieldType,enum=google.protobuf.FieldDescriptorProto_Type" json:"field_type,omitempty"` + // `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. + // + // Types that are assignable to Subscript: + // + // *FieldPathElement_Index + // *FieldPathElement_BoolKey + // *FieldPathElement_IntKey + // *FieldPathElement_SintKey + // *FieldPathElement_UintKey + // *FieldPathElement_StringKey + Subscript isFieldPathElement_Subscript `protobuf_oneof:"subscript"` +} + +func (x *FieldPathElement) Reset() { + *x = FieldPathElement{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_validate_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FieldPathElement) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FieldPathElement) ProtoMessage() {} + +func (x *FieldPathElement) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_validate_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FieldPathElement.ProtoReflect.Descriptor instead. +func (*FieldPathElement) Descriptor() ([]byte, []int) { + return file_buf_validate_validate_proto_rawDescGZIP(), []int{29} +} + +func (x *FieldPathElement) GetFieldNumber() int32 { + if x != nil && x.FieldNumber != nil { + return *x.FieldNumber + } + return 0 +} + +func (x *FieldPathElement) GetFieldName() string { + if x != nil && x.FieldName != nil { + return *x.FieldName + } + return "" +} + +func (x *FieldPathElement) GetFieldType() descriptorpb.FieldDescriptorProto_Type { + if x != nil && x.FieldType != nil { + return *x.FieldType + } + return descriptorpb.FieldDescriptorProto_Type(1) +} + +func (m *FieldPathElement) GetSubscript() isFieldPathElement_Subscript { + if m != nil { + return m.Subscript + } + return nil +} + +func (x *FieldPathElement) GetIndex() uint64 { + if x, ok := x.GetSubscript().(*FieldPathElement_Index); ok { + return x.Index + } + return 0 +} + +func (x *FieldPathElement) GetBoolKey() bool { + if x, ok := x.GetSubscript().(*FieldPathElement_BoolKey); ok { + return x.BoolKey + } + return false +} + +func (x *FieldPathElement) GetIntKey() int64 { + if x, ok := x.GetSubscript().(*FieldPathElement_IntKey); ok { + return x.IntKey + } + return 0 +} + +func (x *FieldPathElement) GetSintKey() int64 { + if x, ok := x.GetSubscript().(*FieldPathElement_SintKey); ok { + return x.SintKey + } + return 0 +} + +func (x *FieldPathElement) GetUintKey() uint64 { + if x, ok := x.GetSubscript().(*FieldPathElement_UintKey); ok { + return x.UintKey + } + return 0 +} + +func (x *FieldPathElement) GetStringKey() string { + if x, ok := x.GetSubscript().(*FieldPathElement_StringKey); ok { + return x.StringKey + } + return "" +} + +type isFieldPathElement_Subscript interface { + isFieldPathElement_Subscript() +} + +type FieldPathElement_Index struct { + // `index` specifies a 0-based index into a repeated field. + Index uint64 `protobuf:"varint,4,opt,name=index,oneof"` +} + +type FieldPathElement_BoolKey struct { + // `bool_key` specifies a map key of type bool. + BoolKey bool `protobuf:"varint,5,opt,name=bool_key,json=boolKey,oneof"` +} + +type FieldPathElement_IntKey struct { + // `int_key` specifies a map key of type int32, int64, sfixed32 or sfixed64. + IntKey int64 `protobuf:"varint,6,opt,name=int_key,json=intKey,oneof"` +} + +type FieldPathElement_SintKey struct { + // `sint_key` specifies a map key of type sint32 or sint64. + SintKey int64 `protobuf:"zigzag64,7,opt,name=sint_key,json=sintKey,oneof"` +} + +type FieldPathElement_UintKey struct { + // `uint_key` specifies a map key of type uint32, uint64, fixed32 or fixed64. + UintKey uint64 `protobuf:"varint,8,opt,name=uint_key,json=uintKey,oneof"` +} + +type FieldPathElement_StringKey struct { + // `string_key` specifies a map key of type string. + StringKey string `protobuf:"bytes,9,opt,name=string_key,json=stringKey,oneof"` +} + +func (*FieldPathElement_Index) isFieldPathElement_Subscript() {} + +func (*FieldPathElement_BoolKey) isFieldPathElement_Subscript() {} + +func (*FieldPathElement_IntKey) isFieldPathElement_Subscript() {} + +func (*FieldPathElement_SintKey) isFieldPathElement_Subscript() {} + +func (*FieldPathElement_UintKey) isFieldPathElement_Subscript() {} + +func (*FieldPathElement_StringKey) isFieldPathElement_Subscript() {} + var file_buf_validate_validate_proto_extTypes = []protoimpl.ExtensionInfo{ { ExtendedType: (*descriptorpb.MessageOptions)(nil), @@ -10228,68 +10473,98 @@ var file_buf_validate_validate_proto_rawDesc = []byte{ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x22, 0x9f, 0x01, 0x0a, 0x09, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, - 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, - 0x09, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x72, 0x75, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, - 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x49, 0x64, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x6f, 0x72, - 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x4b, - 0x65, 0x79, 0x2a, 0x9d, 0x01, 0x0a, 0x06, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x12, 0x16, 0x0a, - 0x12, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, - 0x49, 0x46, 0x5f, 0x55, 0x4e, 0x50, 0x4f, 0x50, 0x55, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, - 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x44, 0x45, - 0x46, 0x41, 0x55, 0x4c, 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x12, 0x11, 0x0a, - 0x0d, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x41, 0x4c, 0x57, 0x41, 0x59, 0x53, 0x10, 0x03, - 0x12, 0x14, 0x0a, 0x0c, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x45, 0x4d, 0x50, 0x54, 0x59, - 0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x16, 0x0a, 0x0e, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, - 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x02, 0x1a, 0x02, 0x08, 0x01, 0x1a, 0x02, - 0x10, 0x01, 0x2a, 0x6e, 0x0a, 0x0a, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x67, 0x65, 0x78, - 0x12, 0x1b, 0x0a, 0x17, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x20, 0x0a, - 0x1c, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x48, 0x54, 0x54, - 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, - 0x21, 0x0a, 0x1d, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x48, - 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, - 0x10, 0x02, 0x3a, 0x5c, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, - 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x73, - 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x3a, 0x54, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, - 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4f, - 0x6e, 0x65, 0x6f, 0x66, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, - 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x3a, 0x54, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, - 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, - 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x3a, 0x63, 0x0a, 0x0a, - 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x09, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, - 0x50, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, - 0x64, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x42, 0x0d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x66, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x74, 0x6f, 0x6f, 0x6c, 0x73, - 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x62, 0x75, - 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x42, 0x56, 0x58, - 0xaa, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xca, - 0x02, 0x0c, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xe2, 0x02, - 0x18, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x42, 0x75, 0x66, 0x3a, - 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x22, 0xde, 0x01, 0x0a, 0x09, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, + 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x2b, 0x0a, + 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x75, + 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x50, 0x61, 0x74, 0x68, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, + 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x18, + 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x6f, 0x72, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x4b, 0x65, + 0x79, 0x22, 0x47, 0x0a, 0x09, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x12, 0x3a, + 0x0a, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd7, 0x02, 0x0a, 0x10, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x21, 0x0a, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x05, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x05, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x6b, 0x65, 0x79, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x4b, 0x65, + 0x79, 0x12, 0x19, 0x0a, 0x07, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x03, 0x48, 0x00, 0x52, 0x06, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x08, + 0x73, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x12, 0x48, 0x00, + 0x52, 0x07, 0x73, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x08, 0x75, 0x69, 0x6e, + 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x07, 0x75, + 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x73, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x42, 0x0b, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x2a, 0x9d, 0x01, 0x0a, 0x06, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x12, + 0x16, 0x0a, 0x12, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x49, 0x47, 0x4e, 0x4f, 0x52, + 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x55, 0x4e, 0x50, 0x4f, 0x50, 0x55, 0x4c, 0x41, 0x54, 0x45, 0x44, + 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x49, 0x46, 0x5f, + 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x12, + 0x11, 0x0a, 0x0d, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x41, 0x4c, 0x57, 0x41, 0x59, 0x53, + 0x10, 0x03, 0x12, 0x14, 0x0a, 0x0c, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x45, 0x4d, 0x50, + 0x54, 0x59, 0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x16, 0x0a, 0x0e, 0x49, 0x47, 0x4e, 0x4f, + 0x52, 0x45, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x02, 0x1a, 0x02, 0x08, 0x01, + 0x1a, 0x02, 0x10, 0x01, 0x2a, 0x6e, 0x0a, 0x0a, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x67, + 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x17, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, + 0x58, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x20, 0x0a, 0x1c, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x48, + 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x10, + 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, + 0x5f, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x56, 0x41, 0x4c, + 0x55, 0x45, 0x10, 0x02, 0x3a, 0x5c, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, + 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x3a, 0x54, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x1d, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, + 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, + 0x73, 0x52, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x3a, 0x54, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x73, + 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x3a, 0x63, + 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x1d, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x09, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x73, + 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, + 0x6e, 0x65, 0x64, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x2e, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x42, 0x0d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x66, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x74, 0x6f, 0x6f, + 0x6c, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, + 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x42, + 0x56, 0x58, 0xaa, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0xca, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0xe2, 0x02, 0x18, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x42, 0x75, + 0x66, 0x3a, 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, } var ( @@ -10305,43 +10580,46 @@ func file_buf_validate_validate_proto_rawDescGZIP() []byte { } var file_buf_validate_validate_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_buf_validate_validate_proto_msgTypes = make([]protoimpl.MessageInfo, 28) +var file_buf_validate_validate_proto_msgTypes = make([]protoimpl.MessageInfo, 30) var file_buf_validate_validate_proto_goTypes = []any{ - (Ignore)(0), // 0: buf.validate.Ignore - (KnownRegex)(0), // 1: buf.validate.KnownRegex - (*Constraint)(nil), // 2: buf.validate.Constraint - (*MessageConstraints)(nil), // 3: buf.validate.MessageConstraints - (*OneofConstraints)(nil), // 4: buf.validate.OneofConstraints - (*FieldConstraints)(nil), // 5: buf.validate.FieldConstraints - (*PredefinedConstraints)(nil), // 6: buf.validate.PredefinedConstraints - (*FloatRules)(nil), // 7: buf.validate.FloatRules - (*DoubleRules)(nil), // 8: buf.validate.DoubleRules - (*Int32Rules)(nil), // 9: buf.validate.Int32Rules - (*Int64Rules)(nil), // 10: buf.validate.Int64Rules - (*UInt32Rules)(nil), // 11: buf.validate.UInt32Rules - (*UInt64Rules)(nil), // 12: buf.validate.UInt64Rules - (*SInt32Rules)(nil), // 13: buf.validate.SInt32Rules - (*SInt64Rules)(nil), // 14: buf.validate.SInt64Rules - (*Fixed32Rules)(nil), // 15: buf.validate.Fixed32Rules - (*Fixed64Rules)(nil), // 16: buf.validate.Fixed64Rules - (*SFixed32Rules)(nil), // 17: buf.validate.SFixed32Rules - (*SFixed64Rules)(nil), // 18: buf.validate.SFixed64Rules - (*BoolRules)(nil), // 19: buf.validate.BoolRules - (*StringRules)(nil), // 20: buf.validate.StringRules - (*BytesRules)(nil), // 21: buf.validate.BytesRules - (*EnumRules)(nil), // 22: buf.validate.EnumRules - (*RepeatedRules)(nil), // 23: buf.validate.RepeatedRules - (*MapRules)(nil), // 24: buf.validate.MapRules - (*AnyRules)(nil), // 25: buf.validate.AnyRules - (*DurationRules)(nil), // 26: buf.validate.DurationRules - (*TimestampRules)(nil), // 27: buf.validate.TimestampRules - (*Violations)(nil), // 28: buf.validate.Violations - (*Violation)(nil), // 29: buf.validate.Violation - (*durationpb.Duration)(nil), // 30: google.protobuf.Duration - (*timestamppb.Timestamp)(nil), // 31: google.protobuf.Timestamp - (*descriptorpb.MessageOptions)(nil), // 32: google.protobuf.MessageOptions - (*descriptorpb.OneofOptions)(nil), // 33: google.protobuf.OneofOptions - (*descriptorpb.FieldOptions)(nil), // 34: google.protobuf.FieldOptions + (Ignore)(0), // 0: buf.validate.Ignore + (KnownRegex)(0), // 1: buf.validate.KnownRegex + (*Constraint)(nil), // 2: buf.validate.Constraint + (*MessageConstraints)(nil), // 3: buf.validate.MessageConstraints + (*OneofConstraints)(nil), // 4: buf.validate.OneofConstraints + (*FieldConstraints)(nil), // 5: buf.validate.FieldConstraints + (*PredefinedConstraints)(nil), // 6: buf.validate.PredefinedConstraints + (*FloatRules)(nil), // 7: buf.validate.FloatRules + (*DoubleRules)(nil), // 8: buf.validate.DoubleRules + (*Int32Rules)(nil), // 9: buf.validate.Int32Rules + (*Int64Rules)(nil), // 10: buf.validate.Int64Rules + (*UInt32Rules)(nil), // 11: buf.validate.UInt32Rules + (*UInt64Rules)(nil), // 12: buf.validate.UInt64Rules + (*SInt32Rules)(nil), // 13: buf.validate.SInt32Rules + (*SInt64Rules)(nil), // 14: buf.validate.SInt64Rules + (*Fixed32Rules)(nil), // 15: buf.validate.Fixed32Rules + (*Fixed64Rules)(nil), // 16: buf.validate.Fixed64Rules + (*SFixed32Rules)(nil), // 17: buf.validate.SFixed32Rules + (*SFixed64Rules)(nil), // 18: buf.validate.SFixed64Rules + (*BoolRules)(nil), // 19: buf.validate.BoolRules + (*StringRules)(nil), // 20: buf.validate.StringRules + (*BytesRules)(nil), // 21: buf.validate.BytesRules + (*EnumRules)(nil), // 22: buf.validate.EnumRules + (*RepeatedRules)(nil), // 23: buf.validate.RepeatedRules + (*MapRules)(nil), // 24: buf.validate.MapRules + (*AnyRules)(nil), // 25: buf.validate.AnyRules + (*DurationRules)(nil), // 26: buf.validate.DurationRules + (*TimestampRules)(nil), // 27: buf.validate.TimestampRules + (*Violations)(nil), // 28: buf.validate.Violations + (*Violation)(nil), // 29: buf.validate.Violation + (*FieldPath)(nil), // 30: buf.validate.FieldPath + (*FieldPathElement)(nil), // 31: buf.validate.FieldPathElement + (*durationpb.Duration)(nil), // 32: google.protobuf.Duration + (*timestamppb.Timestamp)(nil), // 33: google.protobuf.Timestamp + (descriptorpb.FieldDescriptorProto_Type)(0), // 34: google.protobuf.FieldDescriptorProto.Type + (*descriptorpb.MessageOptions)(nil), // 35: google.protobuf.MessageOptions + (*descriptorpb.OneofOptions)(nil), // 36: google.protobuf.OneofOptions + (*descriptorpb.FieldOptions)(nil), // 37: google.protobuf.FieldOptions } var file_buf_validate_validate_proto_depIdxs = []int32{ 2, // 0: buf.validate.MessageConstraints.cel:type_name -> buf.validate.Constraint @@ -10373,35 +10651,39 @@ var file_buf_validate_validate_proto_depIdxs = []int32{ 5, // 26: buf.validate.RepeatedRules.items:type_name -> buf.validate.FieldConstraints 5, // 27: buf.validate.MapRules.keys:type_name -> buf.validate.FieldConstraints 5, // 28: buf.validate.MapRules.values:type_name -> buf.validate.FieldConstraints - 30, // 29: buf.validate.DurationRules.const:type_name -> google.protobuf.Duration - 30, // 30: buf.validate.DurationRules.lt:type_name -> google.protobuf.Duration - 30, // 31: buf.validate.DurationRules.lte:type_name -> google.protobuf.Duration - 30, // 32: buf.validate.DurationRules.gt:type_name -> google.protobuf.Duration - 30, // 33: buf.validate.DurationRules.gte:type_name -> google.protobuf.Duration - 30, // 34: buf.validate.DurationRules.in:type_name -> google.protobuf.Duration - 30, // 35: buf.validate.DurationRules.not_in:type_name -> google.protobuf.Duration - 30, // 36: buf.validate.DurationRules.example:type_name -> google.protobuf.Duration - 31, // 37: buf.validate.TimestampRules.const:type_name -> google.protobuf.Timestamp - 31, // 38: buf.validate.TimestampRules.lt:type_name -> google.protobuf.Timestamp - 31, // 39: buf.validate.TimestampRules.lte:type_name -> google.protobuf.Timestamp - 31, // 40: buf.validate.TimestampRules.gt:type_name -> google.protobuf.Timestamp - 31, // 41: buf.validate.TimestampRules.gte:type_name -> google.protobuf.Timestamp - 30, // 42: buf.validate.TimestampRules.within:type_name -> google.protobuf.Duration - 31, // 43: buf.validate.TimestampRules.example:type_name -> google.protobuf.Timestamp + 32, // 29: buf.validate.DurationRules.const:type_name -> google.protobuf.Duration + 32, // 30: buf.validate.DurationRules.lt:type_name -> google.protobuf.Duration + 32, // 31: buf.validate.DurationRules.lte:type_name -> google.protobuf.Duration + 32, // 32: buf.validate.DurationRules.gt:type_name -> google.protobuf.Duration + 32, // 33: buf.validate.DurationRules.gte:type_name -> google.protobuf.Duration + 32, // 34: buf.validate.DurationRules.in:type_name -> google.protobuf.Duration + 32, // 35: buf.validate.DurationRules.not_in:type_name -> google.protobuf.Duration + 32, // 36: buf.validate.DurationRules.example:type_name -> google.protobuf.Duration + 33, // 37: buf.validate.TimestampRules.const:type_name -> google.protobuf.Timestamp + 33, // 38: buf.validate.TimestampRules.lt:type_name -> google.protobuf.Timestamp + 33, // 39: buf.validate.TimestampRules.lte:type_name -> google.protobuf.Timestamp + 33, // 40: buf.validate.TimestampRules.gt:type_name -> google.protobuf.Timestamp + 33, // 41: buf.validate.TimestampRules.gte:type_name -> google.protobuf.Timestamp + 32, // 42: buf.validate.TimestampRules.within:type_name -> google.protobuf.Duration + 33, // 43: buf.validate.TimestampRules.example:type_name -> google.protobuf.Timestamp 29, // 44: buf.validate.Violations.violations:type_name -> buf.validate.Violation - 32, // 45: buf.validate.message:extendee -> google.protobuf.MessageOptions - 33, // 46: buf.validate.oneof:extendee -> google.protobuf.OneofOptions - 34, // 47: buf.validate.field:extendee -> google.protobuf.FieldOptions - 34, // 48: buf.validate.predefined:extendee -> google.protobuf.FieldOptions - 3, // 49: buf.validate.message:type_name -> buf.validate.MessageConstraints - 4, // 50: buf.validate.oneof:type_name -> buf.validate.OneofConstraints - 5, // 51: buf.validate.field:type_name -> buf.validate.FieldConstraints - 6, // 52: buf.validate.predefined:type_name -> buf.validate.PredefinedConstraints - 53, // [53:53] is the sub-list for method output_type - 53, // [53:53] is the sub-list for method input_type - 49, // [49:53] is the sub-list for extension type_name - 45, // [45:49] is the sub-list for extension extendee - 0, // [0:45] is the sub-list for field type_name + 30, // 45: buf.validate.Violation.field:type_name -> buf.validate.FieldPath + 30, // 46: buf.validate.Violation.rule:type_name -> buf.validate.FieldPath + 31, // 47: buf.validate.FieldPath.elements:type_name -> buf.validate.FieldPathElement + 34, // 48: buf.validate.FieldPathElement.field_type:type_name -> google.protobuf.FieldDescriptorProto.Type + 35, // 49: buf.validate.message:extendee -> google.protobuf.MessageOptions + 36, // 50: buf.validate.oneof:extendee -> google.protobuf.OneofOptions + 37, // 51: buf.validate.field:extendee -> google.protobuf.FieldOptions + 37, // 52: buf.validate.predefined:extendee -> google.protobuf.FieldOptions + 3, // 53: buf.validate.message:type_name -> buf.validate.MessageConstraints + 4, // 54: buf.validate.oneof:type_name -> buf.validate.OneofConstraints + 5, // 55: buf.validate.field:type_name -> buf.validate.FieldConstraints + 6, // 56: buf.validate.predefined:type_name -> buf.validate.PredefinedConstraints + 57, // [57:57] is the sub-list for method output_type + 57, // [57:57] is the sub-list for method input_type + 53, // [53:57] is the sub-list for extension type_name + 49, // [49:53] is the sub-list for extension extendee + 0, // [0:49] is the sub-list for field type_name } func init() { file_buf_validate_validate_proto_init() } @@ -10786,6 +11068,30 @@ func file_buf_validate_validate_proto_init() { return nil } } + file_buf_validate_validate_proto_msgTypes[28].Exporter = func(v any, i int) any { + switch v := v.(*FieldPath); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_validate_proto_msgTypes[29].Exporter = func(v any, i int) any { + switch v := v.(*FieldPathElement); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_buf_validate_validate_proto_msgTypes[3].OneofWrappers = []any{ (*FieldConstraints_Float)(nil), @@ -10921,13 +11227,21 @@ func file_buf_validate_validate_proto_init() { (*TimestampRules_Gte)(nil), (*TimestampRules_GtNow)(nil), } + file_buf_validate_validate_proto_msgTypes[29].OneofWrappers = []any{ + (*FieldPathElement_Index)(nil), + (*FieldPathElement_BoolKey)(nil), + (*FieldPathElement_IntKey)(nil), + (*FieldPathElement_SintKey)(nil), + (*FieldPathElement_UintKey)(nil), + (*FieldPathElement_StringKey)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_buf_validate_validate_proto_rawDesc, NumEnums: 2, - NumMessages: 28, + NumMessages: 30, NumExtensions: 4, NumServices: 0, }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_any.go b/tools/protovalidate-conformance/internal/cases/cases_any.go index e0439009..57f31c3c 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_any.go +++ b/tools/protovalidate-conformance/internal/cases/cases_any.go @@ -61,8 +61,8 @@ func anySuite() suites.Suite { Message: &cases.AnyIn{Val: tsAny}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("any.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("any.in"), ConstraintId: proto.String("any.in"), }, ), @@ -71,8 +71,8 @@ func anySuite() suites.Suite { Message: &cases.AnyIn{Val: fooAny}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("any.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("any.in"), ConstraintId: proto.String("any.in"), }, ), @@ -93,8 +93,8 @@ func anySuite() suites.Suite { Message: &cases.AnyNotIn{Val: tsAny}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("any.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("any.not_in"), ConstraintId: proto.String("any.not_in"), }, ), @@ -111,8 +111,8 @@ func anySuite() suites.Suite { Message: &cases.AnyRequired{}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_bool.go b/tools/protovalidate-conformance/internal/cases/cases_bool.go index 2151fcab..d4f875a3 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_bool.go +++ b/tools/protovalidate-conformance/internal/cases/cases_bool.go @@ -36,8 +36,8 @@ func boolSuite() suites.Suite { Message: &cases.BoolConstTrue{Val: false}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bool.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bool.const"), ConstraintId: proto.String("bool.const"), }, ), @@ -50,8 +50,8 @@ func boolSuite() suites.Suite { Message: &cases.BoolConstFalse{Val: true}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bool.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bool.const"), ConstraintId: proto.String("bool.const"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_bytes.go b/tools/protovalidate-conformance/internal/cases/cases_bytes.go index 6d1e625b..81ba93c0 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_bytes.go +++ b/tools/protovalidate-conformance/internal/cases/cases_bytes.go @@ -36,8 +36,8 @@ func bytesSuite() suites.Suite { Message: &cases.BytesConst{Val: []byte("bar")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.const"), ConstraintId: proto.String("bytes.const"), }, ), @@ -50,8 +50,8 @@ func bytesSuite() suites.Suite { Message: &cases.BytesIn{Val: []byte("quux")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.in"), ConstraintId: proto.String("bytes.in"), }, ), @@ -64,8 +64,8 @@ func bytesSuite() suites.Suite { Message: &cases.BytesNotIn{Val: []byte("fizz")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.not_in"), ConstraintId: proto.String("bytes.not_in"), }, ), @@ -78,8 +78,8 @@ func bytesSuite() suites.Suite { Message: &cases.BytesLen{Val: []byte("go")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.len"), ConstraintId: proto.String("bytes.len"), }, ), @@ -88,8 +88,8 @@ func bytesSuite() suites.Suite { Message: &cases.BytesLen{Val: []byte("fizz")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.len"), ConstraintId: proto.String("bytes.len"), }, ), @@ -105,8 +105,8 @@ func bytesSuite() suites.Suite { "min_len/invalid": { Message: &cases.BytesMinLen{Val: []byte("go")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.min_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.min_len"), ConstraintId: proto.String("bytes.min_len"), Message: proto.String("value length must be at least 3 bytes"), }), @@ -122,8 +122,8 @@ func bytesSuite() suites.Suite { "max_len/invalid": { Message: &cases.BytesMaxLen{Val: []byte("1234567890")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.max_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.max_len"), ConstraintId: proto.String("bytes.max_len"), Message: proto.String("value must be at most 5 bytes"), }), @@ -143,8 +143,8 @@ func bytesSuite() suites.Suite { "min/max_len/invalid/below": { Message: &cases.BytesMinMaxLen{Val: []byte("go")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.min_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.min_len"), ConstraintId: proto.String("bytes.min_len"), Message: proto.String("value length must be at least 3 bytes"), }), @@ -152,8 +152,8 @@ func bytesSuite() suites.Suite { "min/max_len/invalid/above": { Message: &cases.BytesMinMaxLen{Val: []byte("validate")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.max_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.max_len"), ConstraintId: proto.String("bytes.max_len"), Message: proto.String("value must be at most 5 bytes"), }), @@ -165,8 +165,8 @@ func bytesSuite() suites.Suite { "equal/min_len/max_len/invalid": { Message: &cases.BytesEqualMinMaxLen{Val: []byte("validate")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.max_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.max_len"), ConstraintId: proto.String("bytes.max_len"), Message: proto.String("value must be at most 5 bytes"), }), @@ -178,8 +178,8 @@ func bytesSuite() suites.Suite { "pattern/invalid": { Message: &cases.BytesPattern{Val: []byte("你好你好")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.pattern"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.pattern"), ConstraintId: proto.String("bytes.pattern"), Message: proto.String("value must match regex pattern `^[\\x00-\\x7F]+$`"), }), @@ -187,8 +187,8 @@ func bytesSuite() suites.Suite { "pattern/invalid/empty": { Message: &cases.BytesPattern{Val: []byte("")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.pattern"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.pattern"), ConstraintId: proto.String("bytes.pattern"), Message: proto.String("value must match regex pattern `^[\\x00-\\x7F]+$`"), }), @@ -208,8 +208,8 @@ func bytesSuite() suites.Suite { "prefix/invalid": { Message: &cases.BytesPrefix{Val: []byte("bar")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.prefix"), ConstraintId: proto.String("bytes.prefix"), Message: proto.String("value does not have prefix 99"), }), @@ -225,8 +225,8 @@ func bytesSuite() suites.Suite { "contains/invalid": { Message: &cases.BytesContains{Val: []byte("candy bazs")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.contains"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.contains"), ConstraintId: proto.String("bytes.contains"), Message: proto.String("value does not contain 626172"), }), @@ -242,8 +242,8 @@ func bytesSuite() suites.Suite { "suffix/invalid": { Message: &cases.BytesSuffix{Val: []byte("foobar")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.suffix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.suffix"), ConstraintId: proto.String("bytes.suffix"), Message: proto.String("value does not have suffix 62757a7a"), }), @@ -251,8 +251,8 @@ func bytesSuite() suites.Suite { "suffix/case_sensitive/invalid": { Message: &cases.BytesSuffix{Val: []byte("FooBaz")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.suffix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.suffix"), ConstraintId: proto.String("bytes.suffix"), Message: proto.String("value does not have suffix 62757a7a"), }), @@ -268,8 +268,8 @@ func bytesSuite() suites.Suite { "IP/invalid": { Message: &cases.BytesIP{Val: []byte("foobar")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.ip"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.ip"), ConstraintId: proto.String("bytes.ip"), Message: proto.String("value must be a valid IP address"), }), @@ -285,8 +285,8 @@ func bytesSuite() suites.Suite { "IPv4/invalid": { Message: &cases.BytesIPv4{Val: []byte("foobar")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.ipv4"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.ipv4"), ConstraintId: proto.String("bytes.ipv4"), Message: proto.String("value must be a valid IPv4 address"), }), @@ -298,8 +298,8 @@ func bytesSuite() suites.Suite { "IPv4/invalid/v6": { Message: &cases.BytesIPv4{Val: []byte("\x20\x01\x0D\xB8\x85\xA3\x00\x00\x00\x00\x8A\x2E\x03\x70\x73\x34")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.ipv4"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.ipv4"), ConstraintId: proto.String("bytes.ipv4"), Message: proto.String("value must be a valid IPv4 address"), }), @@ -311,8 +311,8 @@ func bytesSuite() suites.Suite { "IPv6/invalid": { Message: &cases.BytesIPv6{Val: []byte("fooar")}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.ipv6"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.ipv6"), ConstraintId: proto.String("bytes.ipv6"), Message: proto.String("value must be a valid IPv6 address"), }), @@ -324,8 +324,8 @@ func bytesSuite() suites.Suite { "IPv6/invalid/v4": { Message: &cases.BytesIPv6{Val: []byte{0xC0, 0xA8, 0x00, 0x01}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.ipv6"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.ipv6"), ConstraintId: proto.String("bytes.ipv6"), }), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go b/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go index da5cc959..576614b1 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go +++ b/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go @@ -80,11 +80,11 @@ func customSuite() suites.Suite { &validate.Violation{ConstraintId: proto.String("message_expression_enum")}, &validate.Violation{ConstraintId: proto.String("message_expression_embed")}, &validate.Violation{ - FieldPath: proto.String("e"), + Field: results.FieldPath("e"), ConstraintId: proto.String("message_expression_nested"), }, &validate.Violation{ - FieldPath: proto.String("f"), + Field: results.FieldPath("f"), ConstraintId: proto.String("message_expression_nested"), }, ), @@ -93,11 +93,11 @@ func customSuite() suites.Suite { Message: &custom_constraints.FieldExpressions{}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), + Field: results.FieldPath("a"), ConstraintId: proto.String("field_expression_scalar"), }, &validate.Violation{ - FieldPath: proto.String("b"), + Field: results.FieldPath("b"), ConstraintId: proto.String("field_expression_enum"), }, ), @@ -122,19 +122,19 @@ func customSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), + Field: results.FieldPath("a"), ConstraintId: proto.String("field_expression_scalar"), }, &validate.Violation{ - FieldPath: proto.String("b"), + Field: results.FieldPath("b"), ConstraintId: proto.String("field_expression_enum"), }, &validate.Violation{ - FieldPath: proto.String("c"), + Field: results.FieldPath("c"), ConstraintId: proto.String("field_expression_embed"), }, &validate.Violation{ - FieldPath: proto.String("c.a"), + Field: results.FieldPath("c.a"), ConstraintId: proto.String("field_expression_nested"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_double.go b/tools/protovalidate-conformance/internal/cases/cases_double.go index cf46d192..eb2ef61e 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_double.go +++ b/tools/protovalidate-conformance/internal/cases/cases_double.go @@ -38,8 +38,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleConst{Val: 4.56}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.const"), ConstraintId: proto.String("double.const"), }, ), @@ -48,8 +48,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleConst{Val: math.NaN()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.const"), ConstraintId: proto.String("double.const"), }, ), @@ -62,8 +62,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleIn{Val: 10.11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.in"), ConstraintId: proto.String("double.in"), }, ), @@ -72,8 +72,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleIn{Val: math.NaN()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.in"), ConstraintId: proto.String("double.in"), }, ), @@ -90,8 +90,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleNotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.not_in"), ConstraintId: proto.String("double.not_in"), }, ), @@ -104,8 +104,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleLT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.lt"), ConstraintId: proto.String("double.lt"), }, ), @@ -114,8 +114,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleLT{Val: 1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.lt"), ConstraintId: proto.String("double.lt"), }, ), @@ -124,8 +124,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleLT{Val: math.NaN()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.lt"), ConstraintId: proto.String("double.lt"), }, ), @@ -142,8 +142,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleLTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.lte"), ConstraintId: proto.String("double.lte"), }, ), @@ -152,8 +152,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleLTE{Val: math.NaN()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.lte"), ConstraintId: proto.String("double.lte"), }, ), @@ -166,8 +166,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt"), }, ), @@ -176,8 +176,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt"), }, ), @@ -186,8 +186,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGT{Val: math.NaN()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt"), }, ), @@ -204,8 +204,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gte"), ConstraintId: proto.String("double.gte"), }, ), @@ -214,8 +214,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGTE{Val: math.NaN()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gte"), ConstraintId: proto.String("double.gte"), }, ), @@ -228,8 +228,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt_lt"), }, ), @@ -238,8 +238,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGTLT{Val: -1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt_lt"), }, ), @@ -248,8 +248,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt_lt"), }, ), @@ -258,8 +258,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGTLT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt_lt"), }, ), @@ -276,8 +276,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt_lt_exclusive"), }, ), @@ -286,8 +286,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt_lt_exclusive"), }, ), @@ -296,8 +296,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleExLTGT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt_lt_exclusive"), }, ), @@ -306,8 +306,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleExLTGT{Val: math.NaN()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt_lt_exclusive"), }, ), @@ -328,8 +328,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gte"), ConstraintId: proto.String("double.gte_lte"), }, ), @@ -338,8 +338,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gte"), ConstraintId: proto.String("double.gte_lte"), }, ), @@ -348,8 +348,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleGTELTE{Val: math.NaN()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gte"), ConstraintId: proto.String("double.gte_lte"), }, ), @@ -374,8 +374,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gte"), ConstraintId: proto.String("double.gte_lte_exclusive"), }, ), @@ -384,8 +384,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleExGTELTE{Val: math.NaN()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gte"), ConstraintId: proto.String("double.gte_lte_exclusive"), }, ), @@ -398,8 +398,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleFinite{Val: math.NaN()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.finite"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.finite"), ConstraintId: proto.String("double.finite"), Message: proto.String("value must be finite"), }), @@ -408,8 +408,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleFinite{Val: math.Inf(1)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.finite"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.finite"), ConstraintId: proto.String("double.finite"), Message: proto.String("value must be finite")}), }, @@ -421,8 +421,8 @@ func doubleSuite() suites.Suite { Message: &cases.DoubleFinite{Val: math.Inf(-1)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.finite"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.finite"), ConstraintId: proto.String("double.finite"), Message: proto.String("value must be finite"), }, @@ -439,7 +439,7 @@ func doubleSuite() suites.Suite { "ignore_empty/invalid/above": { Message: &cases.DoubleIgnore{Val: 300}, Expected: results.Violations( - &validate.Violation{FieldPath: proto.String("val"), RulePath: proto.String("double.gte"), ConstraintId: proto.String("double.gte_lte")}), + &validate.Violation{Field: results.FieldPath("val"), Rule: results.FieldPath("double.gte"), ConstraintId: proto.String("double.gte_lte")}), }, "compilation/wrong_type": { Message: &cases.DoubleIncorrectType{Val: 123}, diff --git a/tools/protovalidate-conformance/internal/cases/cases_duration.go b/tools/protovalidate-conformance/internal/cases/cases_duration.go index aab6ea44..d6bd8594 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_duration.go +++ b/tools/protovalidate-conformance/internal/cases/cases_duration.go @@ -44,8 +44,8 @@ func durationSuite() suites.Suite { Val: nil, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }), @@ -68,8 +68,8 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.const"), ConstraintId: proto.String("duration.const"), Message: proto.String("value must equal 3s"), }), @@ -90,8 +90,8 @@ func durationSuite() suites.Suite { Val: &durationpb.Duration{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.in"), ConstraintId: proto.String("duration.in"), Message: proto.String(`value must be in list [duration("1s"), duration("0.000001s")]`), }), @@ -112,8 +112,8 @@ func durationSuite() suites.Suite { Val: &durationpb.Duration{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.not_in"), ConstraintId: proto.String("duration.not_in"), Message: proto.String(`value must not be in list [duration("0s")]`), }), @@ -134,8 +134,8 @@ func durationSuite() suites.Suite { Val: &durationpb.Duration{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.lt"), ConstraintId: proto.String("duration.lt"), Message: proto.String("value must be less than 0s"), }), @@ -147,8 +147,8 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.lt"), ConstraintId: proto.String("duration.lt"), Message: proto.String("value must be less than 0s"), }), @@ -177,8 +177,8 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.lte"), ConstraintId: proto.String("duration.lte"), Message: proto.String(""), }), @@ -201,8 +201,8 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gt"), ConstraintId: proto.String("duration.gt"), Message: proto.String(""), }), @@ -212,8 +212,8 @@ func durationSuite() suites.Suite { Val: &durationpb.Duration{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gt"), ConstraintId: proto.String("duration.gt"), Message: proto.String("value must be greater than 0.000001s"), }), @@ -242,8 +242,8 @@ func durationSuite() suites.Suite { Val: &durationpb.Duration{Seconds: -1}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gte"), ConstraintId: proto.String("duration.gte"), Message: proto.String("value must be greater than or equal to 0.001s"), }), @@ -266,8 +266,8 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gt"), ConstraintId: proto.String("duration.gt_lt"), Message: proto.String("value must be greater than 0s and less than 1s"), }), @@ -278,8 +278,8 @@ func durationSuite() suites.Suite { Nanos: -1000, }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gt"), ConstraintId: proto.String("duration.gt_lt"), Message: proto.String("value must be greater than 0s and less than 1s"), }), @@ -291,8 +291,8 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gt"), ConstraintId: proto.String("duration.gt_lt"), Message: proto.String("value must be greater than 0s and less than 1s"), }), @@ -302,8 +302,8 @@ func durationSuite() suites.Suite { Val: &durationpb.Duration{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gt"), ConstraintId: proto.String("duration.gt_lt"), Message: proto.String("value must be greater than 0s and less than 1s"), }), @@ -334,8 +334,8 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gt"), ConstraintId: proto.String("duration.gt_lt_exclusive"), Message: proto.String("value must be greater than 1s or less than 0s"), }), @@ -347,8 +347,8 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gt"), ConstraintId: proto.String("duration.gt_lt_exclusive"), Message: proto.String("value must be greater than 1s or less than 0s"), }), @@ -358,8 +358,8 @@ func durationSuite() suites.Suite { Val: &durationpb.Duration{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gt"), ConstraintId: proto.String("duration.gt_lt_exclusive"), Message: proto.String("value must be greater than 1s or less than 0s"), }), @@ -395,8 +395,8 @@ func durationSuite() suites.Suite { Val: &durationpb.Duration{Seconds: 3600, Nanos: 1}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gte"), ConstraintId: proto.String("duration.gte_lte"), Message: proto.String("value must be greater than or equal to 60s and less than or equal to 3600s"), }), @@ -408,8 +408,8 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gte"), ConstraintId: proto.String("duration.gte_lte"), Message: proto.String("value must be greater than or equal to 60s and less than or equal to 3600s"), }), @@ -452,8 +452,8 @@ func durationSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.gte"), ConstraintId: proto.String("duration.gte_lte_exclusive"), Message: proto.String("value must be greater than or equal to 3600s or less than or equal to 60s"), }), @@ -461,8 +461,8 @@ func durationSuite() suites.Suite { "fields_with_other_fields/invalid_other_field": { Message: &cases.DurationFieldWithOtherFields{DurationVal: nil, IntVal: 12}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("int_val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("int_val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), Message: proto.String("value must be greater than 16"), }), diff --git a/tools/protovalidate-conformance/internal/cases/cases_enum.go b/tools/protovalidate-conformance/internal/cases/cases_enum.go index b63b836a..4e6b9da8 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_enum.go +++ b/tools/protovalidate-conformance/internal/cases/cases_enum.go @@ -39,8 +39,8 @@ func enumSuite() suites.Suite { Message: &cases.EnumConst{Val: cases.TestEnum_TEST_ENUM_ONE}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.const"), ConstraintId: proto.String("enum.const"), }, ), @@ -53,8 +53,8 @@ func enumSuite() suites.Suite { Message: &cases.EnumAliasConst{Val: cases.TestEnumAlias_TEST_ENUM_ALIAS_GAMMA}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.const"), ConstraintId: proto.String("enum.const"), }, ), @@ -71,8 +71,8 @@ func enumSuite() suites.Suite { Message: &cases.EnumDefined{Val: math.MaxInt32}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.defined_only"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.defined_only"), ConstraintId: proto.String("enum.defined_only"), Message: proto.String("value must be one of the defined enum values"), }, @@ -90,8 +90,8 @@ func enumSuite() suites.Suite { Message: &cases.EnumAliasDefined{Val: math.MaxInt32}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.defined_only"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.defined_only"), ConstraintId: proto.String("enum.defined_only"), }, ), @@ -104,8 +104,8 @@ func enumSuite() suites.Suite { Message: &cases.EnumIn{Val: cases.TestEnum_TEST_ENUM_ONE}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.in"), ConstraintId: proto.String("enum.in"), }, ), @@ -118,8 +118,8 @@ func enumSuite() suites.Suite { Message: &cases.EnumAliasIn{Val: cases.TestEnumAlias_TEST_ENUM_ALIAS_A}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.in"), ConstraintId: proto.String("enum.in"), }, ), @@ -136,8 +136,8 @@ func enumSuite() suites.Suite { Message: &cases.EnumNotIn{Val: cases.TestEnum_TEST_ENUM_ONE}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.not_in"), ConstraintId: proto.String("enum.not_in"), }, ), @@ -150,8 +150,8 @@ func enumSuite() suites.Suite { Message: &cases.EnumAliasNotIn{Val: cases.TestEnumAlias_TEST_ENUM_ALIAS_A}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.not_in"), ConstraintId: proto.String("enum.not_in"), }, ), @@ -164,8 +164,8 @@ func enumSuite() suites.Suite { Message: &cases.EnumExternal{Val: math.MaxInt32}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.defined_only"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.defined_only"), ConstraintId: proto.String("enum.defined_only"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_fixed32.go b/tools/protovalidate-conformance/internal/cases/cases_fixed32.go index 8aff6be1..b785a484 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_fixed32.go +++ b/tools/protovalidate-conformance/internal/cases/cases_fixed32.go @@ -36,8 +36,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32Const{Val: 2}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.const"), ConstraintId: proto.String("fixed32.const"), }, ), @@ -50,8 +50,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32In{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.in"), ConstraintId: proto.String("fixed32.in"), }, ), @@ -64,8 +64,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32NotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.not_in"), ConstraintId: proto.String("fixed32.not_in"), }, ), @@ -78,8 +78,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32LT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.lt"), ConstraintId: proto.String("fixed32.lt"), }, ), @@ -88,8 +88,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32LT{Val: 6}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.lt"), ConstraintId: proto.String("fixed32.lt"), }, ), @@ -106,8 +106,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32LTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.lte"), ConstraintId: proto.String("fixed32.lte"), }, ), @@ -120,8 +120,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32GT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gt"), ConstraintId: proto.String("fixed32.gt"), }, ), @@ -130,8 +130,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32GT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gt"), ConstraintId: proto.String("fixed32.gt"), }, ), @@ -148,8 +148,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32GTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gte"), ConstraintId: proto.String("fixed32.gte"), }, ), @@ -162,8 +162,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32GTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gt"), ConstraintId: proto.String("fixed32.gt_lt"), }, ), @@ -172,8 +172,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32GTLT{Val: 4}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gt"), ConstraintId: proto.String("fixed32.gt_lt"), }, ), @@ -182,8 +182,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32GTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gt"), ConstraintId: proto.String("fixed32.gt_lt"), }, ), @@ -192,8 +192,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32GTLT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gt"), ConstraintId: proto.String("fixed32.gt_lt"), }, ), @@ -210,8 +210,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32ExLTGT{Val: 6}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gt"), ConstraintId: proto.String("fixed32.gt_lt_exclusive"), }, ), @@ -220,8 +220,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32ExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gt"), ConstraintId: proto.String("fixed32.gt_lt_exclusive"), }, ), @@ -230,8 +230,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32ExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gt"), ConstraintId: proto.String("fixed32.gt_lt_exclusive"), }, ), @@ -252,8 +252,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32GTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gte"), ConstraintId: proto.String("fixed32.gte_lte"), }, ), @@ -262,8 +262,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32GTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gte"), ConstraintId: proto.String("fixed32.gte_lte"), }, ), @@ -288,8 +288,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32ExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gte"), ConstraintId: proto.String("fixed32.gte_lte_exclusive"), }, ), @@ -306,8 +306,8 @@ func fixed32Suite() suites.Suite { Message: &cases.Fixed32Ignore{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.gte"), ConstraintId: proto.String("fixed32.gte_lte"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_fixed64.go b/tools/protovalidate-conformance/internal/cases/cases_fixed64.go index b7345fb8..ab94fc85 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_fixed64.go +++ b/tools/protovalidate-conformance/internal/cases/cases_fixed64.go @@ -36,8 +36,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64Const{Val: 2}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.const"), ConstraintId: proto.String("fixed64.const"), }, ), @@ -50,8 +50,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64In{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.in"), ConstraintId: proto.String("fixed64.in"), }, ), @@ -64,8 +64,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64NotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.not_in"), ConstraintId: proto.String("fixed64.not_in"), }, ), @@ -78,8 +78,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64LT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.lt"), ConstraintId: proto.String("fixed64.lt"), }, ), @@ -88,8 +88,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64LT{Val: 6}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.lt"), ConstraintId: proto.String("fixed64.lt"), }, ), @@ -106,8 +106,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64LTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.lte"), ConstraintId: proto.String("fixed64.lte"), }, ), @@ -120,8 +120,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64GT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gt"), ConstraintId: proto.String("fixed64.gt"), }, ), @@ -130,8 +130,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64GT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gt"), ConstraintId: proto.String("fixed64.gt"), }, ), @@ -148,8 +148,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64GTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gte"), ConstraintId: proto.String("fixed64.gte"), }, ), @@ -162,8 +162,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64GTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gt"), ConstraintId: proto.String("fixed64.gt_lt"), }, ), @@ -172,8 +172,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64GTLT{Val: 4}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gt"), ConstraintId: proto.String("fixed64.gt_lt"), }, ), @@ -182,8 +182,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64GTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gt"), ConstraintId: proto.String("fixed64.gt_lt"), }, ), @@ -192,8 +192,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64GTLT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gt"), ConstraintId: proto.String("fixed64.gt_lt"), }, ), @@ -210,8 +210,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64ExLTGT{Val: 6}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gt"), ConstraintId: proto.String("fixed64.gt_lt_exclusive"), }, ), @@ -220,8 +220,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64ExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gt"), ConstraintId: proto.String("fixed64.gt_lt_exclusive"), }, ), @@ -230,8 +230,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64ExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gt"), ConstraintId: proto.String("fixed64.gt_lt_exclusive"), }, ), @@ -252,8 +252,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64GTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gte"), ConstraintId: proto.String("fixed64.gte_lte"), }, ), @@ -262,8 +262,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64GTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gte"), ConstraintId: proto.String("fixed64.gte_lte"), }, ), @@ -288,8 +288,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64ExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gte"), ConstraintId: proto.String("fixed64.gte_lte_exclusive"), }, ), @@ -306,8 +306,8 @@ func fixed64Suite() suites.Suite { Message: &cases.Fixed64Ignore{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.gte"), ConstraintId: proto.String("fixed64.gte_lte"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_float.go b/tools/protovalidate-conformance/internal/cases/cases_float.go index edc6ac7d..3e4c069c 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_float.go +++ b/tools/protovalidate-conformance/internal/cases/cases_float.go @@ -38,8 +38,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatConst{Val: 4.56}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.const"), ConstraintId: proto.String("float.const"), }, ), @@ -48,8 +48,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatConst{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.const"), ConstraintId: proto.String("float.const"), }, ), @@ -62,8 +62,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatIn{Val: 10.11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.in"), ConstraintId: proto.String("float.in"), }, ), @@ -72,8 +72,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatIn{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.in"), ConstraintId: proto.String("float.in"), }, ), @@ -86,8 +86,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatNotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.not_in"), ConstraintId: proto.String("float.not_in"), }, ), @@ -104,8 +104,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatLT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.lt"), ConstraintId: proto.String("float.lt"), }, ), @@ -114,8 +114,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatLT{Val: 1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.lt"), ConstraintId: proto.String("float.lt"), }, ), @@ -124,8 +124,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatLT{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.lt"), ConstraintId: proto.String("float.lt"), }, ), @@ -142,8 +142,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatLTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.lte"), ConstraintId: proto.String("float.lte"), }, ), @@ -152,8 +152,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatLTE{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.lte"), ConstraintId: proto.String("float.lte"), }, ), @@ -166,8 +166,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt"), }, ), @@ -176,8 +176,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt"), }, ), @@ -186,8 +186,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGT{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt"), }, ), @@ -204,8 +204,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gte"), ConstraintId: proto.String("float.gte"), }, ), @@ -214,8 +214,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGTE{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gte"), ConstraintId: proto.String("float.gte"), }, ), @@ -228,8 +228,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt_lt"), }, ), @@ -238,8 +238,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGTLT{Val: -1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt_lt"), }, ), @@ -248,8 +248,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt_lt"), }, ), @@ -258,8 +258,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGTLT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt_lt"), }, ), @@ -268,8 +268,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGTLT{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt_lt"), }, ), @@ -286,8 +286,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt_lt_exclusive"), }, ), @@ -296,8 +296,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt_lt_exclusive"), }, ), @@ -306,8 +306,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatExLTGT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt_lt_exclusive"), }, ), @@ -316,8 +316,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatExLTGT{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt_lt_exclusive"), }, ), @@ -338,8 +338,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gte"), ConstraintId: proto.String("float.gte_lte"), }, ), @@ -348,8 +348,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gte"), ConstraintId: proto.String("float.gte_lte"), }, ), @@ -358,8 +358,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatGTELTE{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gte"), ConstraintId: proto.String("float.gte_lte"), }, ), @@ -384,8 +384,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gte"), ConstraintId: proto.String("float.gte_lte_exclusive"), }, ), @@ -394,8 +394,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatExGTELTE{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gte"), ConstraintId: proto.String("float.gte_lte_exclusive"), }, ), @@ -408,8 +408,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatFinite{Val: float32(math.NaN())}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.finite"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.finite"), ConstraintId: proto.String("float.finite"), Message: proto.String("value must be finite"), }), @@ -418,8 +418,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatFinite{Val: float32(math.Inf(1))}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.finite"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.finite"), ConstraintId: proto.String("float.finite"), Message: proto.String("value must be finite"), }, @@ -433,8 +433,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatFinite{Val: float32(math.Inf(-1))}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.finite"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.finite"), ConstraintId: proto.String("float.finite"), Message: proto.String("value must be finite"), }, @@ -452,8 +452,8 @@ func floatSuite() suites.Suite { Message: &cases.FloatIgnore{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gte"), ConstraintId: proto.String("float.gte_lte"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_ignore.go b/tools/protovalidate-conformance/internal/cases/cases_ignore.go index f8ee4428..8b7981c6 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_ignore.go +++ b/tools/protovalidate-conformance/internal/cases/cases_ignore.go @@ -35,16 +35,16 @@ func ignoreSuite() suites.Suite { "proto2/scalar/optional/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreUnspecified{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/optional/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreUnspecified{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -59,24 +59,24 @@ func ignoreSuite() suites.Suite { "proto2/scalar/optional_with_default/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/optional_with_default/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/optional_with_default/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -91,16 +91,16 @@ func ignoreSuite() suites.Suite { "proto2/scalar/optional/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreEmpty{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/optional/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreEmpty{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -115,24 +115,24 @@ func ignoreSuite() suites.Suite { "proto2/scalar/optional_with_default/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/optional_with_default/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/optional_with_default/ignore_empty/invalid/zero": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreEmptyWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -147,8 +147,8 @@ func ignoreSuite() suites.Suite { "proto2/scalar/optional/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -171,16 +171,16 @@ func ignoreSuite() suites.Suite { "proto2/scalar/optional_with_default/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/optional_with_default/ignore_default/invalid/zero": suites.Case{ Message: &cases.Proto2ScalarOptionalIgnoreDefaultWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -191,16 +191,16 @@ func ignoreSuite() suites.Suite { "proto2/scalar/required/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreUnspecified{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/required/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreUnspecified{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -211,24 +211,24 @@ func ignoreSuite() suites.Suite { "proto2/scalar/required_with_default/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/required_with_default/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/required_with_default/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -239,16 +239,16 @@ func ignoreSuite() suites.Suite { "proto2/scalar/required/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreEmpty{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/required/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreEmpty{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -259,24 +259,24 @@ func ignoreSuite() suites.Suite { "proto2/scalar/required_with_default/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/required_with_default/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/required_with_default/ignore_empty/invalid/zero": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreEmptyWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -287,8 +287,8 @@ func ignoreSuite() suites.Suite { "proto2/scalar/required/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -307,16 +307,16 @@ func ignoreSuite() suites.Suite { "proto2/scalar/required_with_default/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/required_with_default/ignore_default/invalid/zero": suites.Case{ Message: &cases.Proto2ScalarRequiredIgnoreDefaultWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -335,7 +335,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto2MessageOptionalIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -344,7 +344,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto2MessageOptionalIgnoreUnspecified_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -363,7 +363,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto2MessageOptionalIgnoreEmpty_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -372,7 +372,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto2MessageOptionalIgnoreEmpty_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -391,7 +391,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto2MessageOptionalIgnoreDefault_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -412,7 +412,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto2MessageRequiredIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -421,7 +421,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto2MessageRequiredIgnoreUnspecified_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -436,7 +436,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto2MessageRequiredIgnoreEmpty_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -445,7 +445,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto2MessageRequiredIgnoreEmpty_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -460,7 +460,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto2MessageRequiredIgnoreDefault_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -485,8 +485,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreUnspecified_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -495,8 +495,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreUnspecified_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -515,8 +515,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreUnspecifiedWithDefault_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -525,8 +525,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreUnspecifiedWithDefault_Val{Val: -42}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -535,8 +535,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreUnspecifiedWithDefault_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -555,8 +555,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreEmpty_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -565,8 +565,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreEmpty_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -585,8 +585,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreEmptyWithDefault_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -595,8 +595,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreEmptyWithDefault_Val{Val: -42}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -605,8 +605,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreEmptyWithDefault_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -625,8 +625,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreDefault_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -651,8 +651,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreDefaultWithDefault_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -667,24 +667,24 @@ func ignoreSuite() suites.Suite { O: &cases.Proto2OneofIgnoreDefaultWithDefault_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/repeated/ignore_unspecified/invalid/unpopulated": suites.Case{ Message: &cases.Proto2RepeatedIgnoreUnspecified{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, "proto2/repeated/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto2RepeatedIgnoreUnspecified{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -699,8 +699,8 @@ func ignoreSuite() suites.Suite { "proto2/repeated/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto2RepeatedIgnoreEmpty{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -715,8 +715,8 @@ func ignoreSuite() suites.Suite { "proto2/repeated/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto2RepeatedIgnoreDefault{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -727,16 +727,16 @@ func ignoreSuite() suites.Suite { "proto2/map/ignore_unspecified/invalid/unpopulated": suites.Case{ Message: &cases.Proto2MapIgnoreUnspecified{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, "proto2/map/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto2MapIgnoreUnspecified{Val: map[int32]int32{1: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -751,8 +751,8 @@ func ignoreSuite() suites.Suite { "proto2/map/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto2MapIgnoreEmpty{Val: map[int32]int32{1: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -767,8 +767,8 @@ func ignoreSuite() suites.Suite { "proto2/map/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto2MapIgnoreDefault{Val: map[int32]int32{1: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -783,16 +783,16 @@ func ignoreSuite() suites.Suite { "proto2/repeated/items/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto2RepeatedItemIgnoreUnspecified{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/repeated/items/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.Proto2RepeatedItemIgnoreUnspecified{Val: []int32{0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -803,8 +803,8 @@ func ignoreSuite() suites.Suite { "proto2/repeated/items/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto2RepeatedItemIgnoreEmpty{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -819,8 +819,8 @@ func ignoreSuite() suites.Suite { "proto2/repeated/items/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto2RepeatedItemIgnoreDefault{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -835,16 +835,16 @@ func ignoreSuite() suites.Suite { "proto2/map/keys/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto2MapKeyIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[-42]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/map/keys/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.Proto2MapKeyIgnoreUnspecified{Val: map[int32]int32{0: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[0]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -855,8 +855,8 @@ func ignoreSuite() suites.Suite { "proto2/map/keys/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto2MapKeyIgnoreEmpty{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[-42]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -871,8 +871,8 @@ func ignoreSuite() suites.Suite { "proto2/map/keys/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto2MapKeyIgnoreDefault{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[-42]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -887,16 +887,16 @@ func ignoreSuite() suites.Suite { "proto2/map/values/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto2MapValueIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[-42]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/map/values/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.Proto2MapValueIgnoreUnspecified{Val: map[int32]int32{0: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -907,8 +907,8 @@ func ignoreSuite() suites.Suite { "proto2/map/values/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto2MapValueIgnoreEmpty{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[-42]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -923,8 +923,8 @@ func ignoreSuite() suites.Suite { "proto2/map/values/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto2MapValueIgnoreDefault{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[-42]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -943,16 +943,16 @@ func ignoreSuite() suites.Suite { "proto3/scalar/optional/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto3ScalarOptionalIgnoreUnspecified{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto3/scalar/optional/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto3ScalarOptionalIgnoreUnspecified{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -967,16 +967,16 @@ func ignoreSuite() suites.Suite { "proto3/scalar/optional/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto3ScalarOptionalIgnoreEmpty{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto3/scalar/optional/ignore_empty/invalid/default": suites.Case{ Message: &cases.Proto3ScalarOptionalIgnoreEmpty{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -991,8 +991,8 @@ func ignoreSuite() suites.Suite { "proto3/scalar/optional/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto3ScalarOptionalIgnoreDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1007,16 +1007,16 @@ func ignoreSuite() suites.Suite { "proto3/scalar/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto3ScalarIgnoreUnspecified{Val: -123}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto3/scalar/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.Proto3ScalarIgnoreUnspecified{Val: 0}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1027,8 +1027,8 @@ func ignoreSuite() suites.Suite { "proto3/scalar/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto3ScalarIgnoreEmpty{Val: -123}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1043,8 +1043,8 @@ func ignoreSuite() suites.Suite { "proto3/scalar/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto3ScalarIgnoreDefault{Val: -123}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1067,7 +1067,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto3MessageOptionalIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1076,7 +1076,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto3MessageOptionalIgnoreUnspecified_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1095,7 +1095,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto3MessageOptionalIgnoreEmpty_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1104,7 +1104,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto3MessageOptionalIgnoreEmpty_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1123,7 +1123,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto3MessageOptionalIgnoreDefault_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1144,7 +1144,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto3MessageIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1153,7 +1153,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto3MessageIgnoreUnspecified_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1168,7 +1168,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto3MessageIgnoreEmpty_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1177,7 +1177,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto3MessageIgnoreEmpty_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1192,7 +1192,7 @@ func ignoreSuite() suites.Suite { Val: &cases.Proto3MessageIgnoreDefault_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1217,8 +1217,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto3OneofIgnoreUnspecified_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1227,8 +1227,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto3OneofIgnoreUnspecified_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1247,8 +1247,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto3OneofIgnoreEmpty_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1257,8 +1257,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto3OneofIgnoreEmpty_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1277,8 +1277,8 @@ func ignoreSuite() suites.Suite { O: &cases.Proto3OneofIgnoreDefault_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1291,16 +1291,16 @@ func ignoreSuite() suites.Suite { "proto3/repeated/ignore_unspecified/invalid/unpopulated": suites.Case{ Message: &cases.Proto3RepeatedIgnoreUnspecified{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, "proto3/repeated/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto3RepeatedIgnoreUnspecified{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -1315,8 +1315,8 @@ func ignoreSuite() suites.Suite { "proto3/repeated/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto3RepeatedIgnoreEmpty{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -1331,8 +1331,8 @@ func ignoreSuite() suites.Suite { "proto3/repeated/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto3RepeatedIgnoreDefault{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -1343,16 +1343,16 @@ func ignoreSuite() suites.Suite { "proto3/map/ignore_unspecified/invalid/unpopulated": suites.Case{ Message: &cases.Proto3MapIgnoreUnspecified{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, "proto3/map/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto3MapIgnoreUnspecified{Val: map[int32]int32{1: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -1367,8 +1367,8 @@ func ignoreSuite() suites.Suite { "proto3/map/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto3MapIgnoreEmpty{Val: map[int32]int32{1: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -1383,8 +1383,8 @@ func ignoreSuite() suites.Suite { "proto3/map/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto3MapIgnoreDefault{Val: map[int32]int32{1: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -1399,16 +1399,16 @@ func ignoreSuite() suites.Suite { "proto3/repeated/items/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto3RepeatedItemIgnoreUnspecified{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto3/repeated/items/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.Proto3RepeatedItemIgnoreUnspecified{Val: []int32{0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1419,8 +1419,8 @@ func ignoreSuite() suites.Suite { "proto3/repeated/items/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto3RepeatedItemIgnoreEmpty{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1435,8 +1435,8 @@ func ignoreSuite() suites.Suite { "proto3/repeated/items/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto3RepeatedItemIgnoreDefault{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1451,16 +1451,16 @@ func ignoreSuite() suites.Suite { "proto3/map/keys/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto3MapKeyIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[-42]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto3/map/keys/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.Proto3MapKeyIgnoreUnspecified{Val: map[int32]int32{0: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[0]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1471,8 +1471,8 @@ func ignoreSuite() suites.Suite { "proto3/map/keys/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto3MapKeyIgnoreEmpty{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[-42]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1487,8 +1487,8 @@ func ignoreSuite() suites.Suite { "proto3/map/keys/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto3MapKeyIgnoreDefault{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[-42]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1503,16 +1503,16 @@ func ignoreSuite() suites.Suite { "proto3/map/values/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.Proto3MapValueIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[-42]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto3/map/values/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.Proto3MapValueIgnoreUnspecified{Val: map[int32]int32{0: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1523,8 +1523,8 @@ func ignoreSuite() suites.Suite { "proto3/map/values/ignore_empty/invalid/populated": suites.Case{ Message: &cases.Proto3MapValueIgnoreEmpty{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[-42]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1539,8 +1539,8 @@ func ignoreSuite() suites.Suite { "proto3/map/values/ignore_default/invalid/populated": suites.Case{ Message: &cases.Proto3MapValueIgnoreDefault{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[-42]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1559,16 +1559,16 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/explicit_presence/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecified{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/explicit_presence/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecified{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1583,24 +1583,24 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/explicit_presence_with_default/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1615,16 +1615,16 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/explicit_presence/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreEmpty{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/explicit_presence/ignore_empty/invalid/default": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreEmpty{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1639,24 +1639,24 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/explicit_presence_with_default/ignore_empty/invalid/default": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_empty/invalid/zero": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreEmptyWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1671,8 +1671,8 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/explicit_presence/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1695,16 +1695,16 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/explicit_presence_with_default/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/explicit_presence_with_default/ignore_default/invalid/zero": suites.Case{ Message: &cases.EditionsScalarExplicitPresenceIgnoreDefaultWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1715,16 +1715,16 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/implicit_presence/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsScalarImplicitPresenceIgnoreUnspecified{Val: -123}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/implicit_presence/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsScalarImplicitPresenceIgnoreUnspecified{Val: 0}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1735,8 +1735,8 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/implicit_presence/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsScalarImplicitPresenceIgnoreEmpty{Val: -123}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1751,8 +1751,8 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/implicit_presence/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsScalarImplicitPresenceIgnoreDefault{Val: -123}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1767,16 +1767,16 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/legacy_required/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecified{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/legacy_required/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecified{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1787,24 +1787,24 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/required_with_default/ignore_unspecified/invalid/default": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/required_with_default/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/required_with_default/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreUnspecifiedWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1815,16 +1815,16 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/legacy_required/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreEmpty{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/legacy_required/ignore_empty/invalid/default": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreEmpty{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1835,24 +1835,24 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/required_with_default/ignore_empty/invalid/default": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/required_with_default/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreEmptyWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/required_with_default/ignore_empty/invalid/zero": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreEmptyWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1863,8 +1863,8 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/legacy_required/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1883,16 +1883,16 @@ func ignoreSuite() suites.Suite { "proto/2023/scalar/required_with_default/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreDefaultWithDefault{Val: proto.Int32(-123)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/required_with_default/ignore_default/invalid/zero": suites.Case{ Message: &cases.EditionsScalarLegacyRequiredIgnoreDefaultWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -1911,7 +1911,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageExplicitPresenceIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1920,7 +1920,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageExplicitPresenceIgnoreUnspecified_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1939,7 +1939,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1948,7 +1948,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreUnspecified_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1967,7 +1967,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageExplicitPresenceIgnoreEmpty_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1976,7 +1976,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageExplicitPresenceIgnoreEmpty_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1995,7 +1995,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreEmpty_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2004,7 +2004,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreEmpty_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2023,7 +2023,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageExplicitPresenceIgnoreDefault_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2048,7 +2048,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageExplicitPresenceDelimitedIgnoreDefault_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2069,7 +2069,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageLegacyRequiredIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2078,7 +2078,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageLegacyRequiredIgnoreUnspecified_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2093,7 +2093,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreUnspecified_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2102,7 +2102,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreUnspecified_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2117,7 +2117,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageLegacyRequiredIgnoreEmpty_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2126,7 +2126,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageLegacyRequiredIgnoreEmpty_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2141,7 +2141,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreEmpty_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2150,7 +2150,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreEmpty_Msg{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2165,7 +2165,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageLegacyRequiredIgnoreDefault_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2186,7 +2186,7 @@ func ignoreSuite() suites.Suite { Val: &cases.EditionsMessageLegacyRequiredDelimitedIgnoreDefault_Msg{Val: proto.String("bar")}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2211,8 +2211,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreUnspecified_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2221,8 +2221,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreUnspecified_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2241,8 +2241,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreUnspecifiedWithDefault_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2251,8 +2251,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreUnspecifiedWithDefault_Val{Val: -42}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2261,8 +2261,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreUnspecifiedWithDefault_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2281,8 +2281,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreEmpty_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2291,8 +2291,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreEmpty_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2311,8 +2311,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreEmptyWithDefault_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2321,8 +2321,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreEmptyWithDefault_Val{Val: -42}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2331,8 +2331,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreEmptyWithDefault_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2351,8 +2351,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreDefault_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2377,8 +2377,8 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreDefaultWithDefault_Val{Val: -123}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2393,24 +2393,24 @@ func ignoreSuite() suites.Suite { O: &cases.EditionsOneofIgnoreDefaultWithDefault_Val{}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/repeated/compact/ignore_unspecified/invalid/unpopulated": suites.Case{ Message: &cases.EditionsRepeatedIgnoreUnspecified{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, "proto/2023/repeated/compact/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedIgnoreUnspecified{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -2421,16 +2421,16 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/expanded/ignore_unspecified/invalid/unpopulated": suites.Case{ Message: &cases.EditionsRepeatedExpandedIgnoreUnspecified{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, "proto/2023/repeated/expanded/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedExpandedIgnoreUnspecified{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -2445,8 +2445,8 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/compact/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedIgnoreEmpty{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -2461,8 +2461,8 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/expanded/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedExpandedIgnoreEmpty{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -2477,8 +2477,8 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/compact/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedIgnoreDefault{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -2493,8 +2493,8 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/expanded/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedExpandedIgnoreDefault{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -2505,16 +2505,16 @@ func ignoreSuite() suites.Suite { "proto/2023/map/ignore_unspecified/invalid/unpopulated": suites.Case{ Message: &cases.EditionsMapIgnoreUnspecified{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, "proto/2023/map/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsMapIgnoreUnspecified{Val: map[int32]int32{1: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -2529,8 +2529,8 @@ func ignoreSuite() suites.Suite { "proto/2023/map/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsMapIgnoreEmpty{Val: map[int32]int32{1: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -2545,8 +2545,8 @@ func ignoreSuite() suites.Suite { "proto/2023/map/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsMapIgnoreDefault{Val: map[int32]int32{1: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -2561,16 +2561,16 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/compact/items/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedItemIgnoreUnspecified{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/repeated/compact/items/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.EditionsRepeatedItemIgnoreUnspecified{Val: []int32{0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2581,16 +2581,16 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/expanded/items/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedExpandedItemIgnoreUnspecified{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/repeated/expanded/items/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.EditionsRepeatedExpandedItemIgnoreUnspecified{Val: []int32{0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2601,8 +2601,8 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/compact/items/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedItemIgnoreEmpty{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2617,8 +2617,8 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/expanded/items/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedExpandedItemIgnoreEmpty{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2633,8 +2633,8 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/compact/items/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedItemIgnoreDefault{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2649,8 +2649,8 @@ func ignoreSuite() suites.Suite { "proto/2023/repeated/expanded/items/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsRepeatedExpandedItemIgnoreDefault{Val: []int32{-42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2665,16 +2665,16 @@ func ignoreSuite() suites.Suite { "proto/2023/map/keys/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsMapKeyIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[-42]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/map/keys/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.EditionsMapKeyIgnoreUnspecified{Val: map[int32]int32{0: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[0]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2685,8 +2685,8 @@ func ignoreSuite() suites.Suite { "proto/2023/map/keys/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsMapKeyIgnoreEmpty{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[-42]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2701,8 +2701,8 @@ func ignoreSuite() suites.Suite { "proto/2023/map/keys/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsMapKeyIgnoreDefault{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.int32.gt"), + Field: results.FieldPath("val[-42]"), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2717,16 +2717,16 @@ func ignoreSuite() suites.Suite { "proto/2023/map/values/ignore_unspecified/invalid/populated": suites.Case{ Message: &cases.EditionsMapValueIgnoreUnspecified{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[-42]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/map/values/ignore_unspecified/invalid/zero": suites.Case{ Message: &cases.EditionsMapValueIgnoreUnspecified{Val: map[int32]int32{0: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2737,8 +2737,8 @@ func ignoreSuite() suites.Suite { "proto/2023/map/values/ignore_empty/invalid/populated": suites.Case{ Message: &cases.EditionsMapValueIgnoreEmpty{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[-42]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -2753,8 +2753,8 @@ func ignoreSuite() suites.Suite { "proto/2023/map/values/ignore_default/invalid/populated": suites.Case{ Message: &cases.EditionsMapValueIgnoreDefault{Val: map[int32]int32{-42: -42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[-42]"), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath("val[-42]"), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go b/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go index 1dfee591..7aaaf631 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go +++ b/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go @@ -31,16 +31,16 @@ func ignoreEmptySuite() suites.Suite { "proto2/scalar/optional/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyProto2ScalarOptional{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/optional/zero": suites.Case{ Message: &cases.IgnoreEmptyProto2ScalarOptional{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -55,16 +55,16 @@ func ignoreEmptySuite() suites.Suite { "proto2/scalar/optional_with_default/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/optional_with_default/zero": suites.Case{ Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -83,16 +83,16 @@ func ignoreEmptySuite() suites.Suite { "proto2/scalar/required/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyProto2ScalarRequired{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto2/scalar/required/zero": suites.Case{ Message: &cases.IgnoreEmptyProto2ScalarRequired{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -103,7 +103,7 @@ func ignoreEmptySuite() suites.Suite { "proto2/message/zero": suites.Case{ Message: &cases.IgnoreEmptyProto2Message{Val: &cases.IgnoreEmptyProto2Message_Msg{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("ignore_empty.proto2.message"), }), }, @@ -118,8 +118,8 @@ func ignoreEmptySuite() suites.Suite { "proto2/oneof/zero": suites.Case{ Message: &cases.IgnoreEmptyProto2Oneof{O: &cases.IgnoreEmptyProto2Oneof_Val{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -134,8 +134,8 @@ func ignoreEmptySuite() suites.Suite { "proto2/repeated/noempty/invalid": suites.Case{ Message: &cases.IgnoreEmptyProto2Repeated{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -150,8 +150,8 @@ func ignoreEmptySuite() suites.Suite { "proto2/map/nonempty/invalid": suites.Case{ Message: &cases.IgnoreEmptyProto2Map{Val: map[int32]int32{0: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -166,8 +166,8 @@ func ignoreEmptySuite() suites.Suite { "proto3/scalar/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyProto3Scalar{Val: -42}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -182,8 +182,8 @@ func ignoreEmptySuite() suites.Suite { "proto3/scalar/optional/zero": suites.Case{ Message: &cases.IgnoreEmptyProto3OptionalScalar{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -198,7 +198,7 @@ func ignoreEmptySuite() suites.Suite { "proto3/message/zero": suites.Case{ Message: &cases.IgnoreEmptyProto3Message{Val: &cases.IgnoreEmptyProto3Message_Msg{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("ignore_empty.proto3.message"), }), }, @@ -213,8 +213,8 @@ func ignoreEmptySuite() suites.Suite { "proto3/oneof/zero": suites.Case{ Message: &cases.IgnoreEmptyProto3Oneof{O: &cases.IgnoreEmptyProto3Oneof_Val{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -229,8 +229,8 @@ func ignoreEmptySuite() suites.Suite { "proto3/repeated/noempty/invalid": suites.Case{ Message: &cases.IgnoreEmptyProto3Repeated{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -245,8 +245,8 @@ func ignoreEmptySuite() suites.Suite { "proto3/map/nonempty/invalid": suites.Case{ Message: &cases.IgnoreEmptyProto3Map{Val: map[int32]int32{0: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, @@ -265,8 +265,8 @@ func ignoreEmptySuite() suites.Suite { "proto3/repeated/items/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyRepeatedItems{Val: []int32{-1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.int32.gt"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -281,8 +281,8 @@ func ignoreEmptySuite() suites.Suite { "proto3/map/keys/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyMapPairs{Val: map[string]int32{"x": 42}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String(`val["x"]`), ForKey: proto.Bool(true), - RulePath: proto.String("map.keys.string.min_len"), + Field: results.FieldPath(`val["x"]`), ForKey: proto.Bool(true), + Rule: results.FieldPath("map.keys.string.min_len"), ConstraintId: proto.String("string.min_len"), }), }, @@ -297,8 +297,8 @@ func ignoreEmptySuite() suites.Suite { "proto3/map/values/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyMapPairs{Val: map[string]int32{"foo": -1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String(`val["foo"]`), - RulePath: proto.String("map.values.int32.gt"), + Field: results.FieldPath(`val["foo"]`), + Rule: results.FieldPath("map.values.int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -309,16 +309,16 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/scalar/explicit_presence/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarExplicitPresence{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/explicit_presence/zero": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarExplicitPresence{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -333,16 +333,16 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/scalar/explicit_presence_with_default/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarExplicitPresenceWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/explicit_presence_with_default/zero": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarExplicitPresenceWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -361,8 +361,8 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/scalar/implicit_presence/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarImplicitPresence{Val: -42}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -377,16 +377,16 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/scalar/legacy_required/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarLegacyRequired{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/legacy_required/zero": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarLegacyRequired{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -397,16 +397,16 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/scalar/legacy_required_with_default/nonzero/invalid": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarLegacyRequiredWithDefault{Val: proto.Int32(-42)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "proto/2023/scalar/legacy_required_with_default/zero": suites.Case{ Message: &cases.IgnoreEmptyEditionsScalarLegacyRequiredWithDefault{Val: proto.Int32(0)}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -417,7 +417,7 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/message/explicit_presence/length_prefixed/zero": suites.Case{ Message: &cases.IgnoreEmptyEditionsMessageExplicitPresence{Val: &cases.IgnoreEmptyEditionsMessageExplicitPresence_Msg{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("ignore_empty.editions.message"), }), }, @@ -432,7 +432,7 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/message/explicit_presence/delimited/zero": suites.Case{ Message: &cases.IgnoreEmptyEditionsMessageExplicitPresenceDelimited{Val: &cases.IgnoreEmptyEditionsMessageExplicitPresenceDelimited_Msg{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("ignore_empty.editions.message"), }), }, @@ -447,8 +447,8 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/oneof/zero": suites.Case{ Message: &cases.IgnoreEmptyEditionsOneof{O: &cases.IgnoreEmptyEditionsOneof_Val{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, @@ -463,8 +463,8 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/repeated/compact/noempty/invalid": suites.Case{ Message: &cases.IgnoreEmptyEditionsRepeated{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -479,8 +479,8 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/repeated/expanded/noempty/invalid": suites.Case{ Message: &cases.IgnoreEmptyEditionsRepeatedExpanded{Val: []int32{1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), }), }, @@ -495,8 +495,8 @@ func ignoreEmptySuite() suites.Suite { "proto/2023/map/nonempty/invalid": suites.Case{ Message: &cases.IgnoreEmptyEditionsMap{Val: map[int32]int32{0: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), }), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_int32.go b/tools/protovalidate-conformance/internal/cases/cases_int32.go index 2891c9c6..cbeba3ed 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_int32.go +++ b/tools/protovalidate-conformance/internal/cases/cases_int32.go @@ -36,8 +36,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32Const{Val: 2}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.const"), ConstraintId: proto.String("int32.const"), }, ), @@ -50,8 +50,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32In{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.in"), ConstraintId: proto.String("int32.in"), }, ), @@ -64,8 +64,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32NotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.not_in"), ConstraintId: proto.String("int32.not_in"), }, ), @@ -78,8 +78,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32LT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.lt"), ConstraintId: proto.String("int32.lt"), }, ), @@ -88,8 +88,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32LT{Val: 1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.lt"), ConstraintId: proto.String("int32.lt"), }, ), @@ -106,8 +106,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32LTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.lte"), ConstraintId: proto.String("int32.lte"), }, ), @@ -120,8 +120,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32GT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }, ), @@ -130,8 +130,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32GT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }, ), @@ -148,8 +148,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32GTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gte"), ConstraintId: proto.String("int32.gte"), }, ), @@ -162,8 +162,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32GTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt_lt"), }, ), @@ -172,8 +172,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32GTLT{Val: -1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt_lt"), }, ), @@ -182,8 +182,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32GTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt_lt"), }, ), @@ -192,8 +192,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32GTLT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt_lt"), }, ), @@ -210,8 +210,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32ExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt_lt_exclusive"), }, ), @@ -220,8 +220,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32ExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt_lt_exclusive"), }, ), @@ -230,8 +230,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32ExLTGT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt_lt_exclusive"), }, ), @@ -252,8 +252,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32GTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gte"), ConstraintId: proto.String("int32.gte_lte"), }, ), @@ -262,8 +262,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32GTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gte"), ConstraintId: proto.String("int32.gte_lte"), }, ), @@ -288,8 +288,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32ExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gte"), ConstraintId: proto.String("int32.gte_lte_exclusive"), }, ), @@ -306,8 +306,8 @@ func int32Suite() suites.Suite { Message: &cases.Int32Ignore{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gte"), ConstraintId: proto.String("int32.gte_lte"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_int64.go b/tools/protovalidate-conformance/internal/cases/cases_int64.go index 1674a218..ec41980f 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_int64.go +++ b/tools/protovalidate-conformance/internal/cases/cases_int64.go @@ -36,8 +36,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64Const{Val: 2}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.const"), ConstraintId: proto.String("int64.const"), }, ), @@ -50,8 +50,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64In{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.in"), ConstraintId: proto.String("int64.in"), }, ), @@ -64,8 +64,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64NotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.not_in"), ConstraintId: proto.String("int64.not_in"), }, ), @@ -78,8 +78,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64LT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.lt"), ConstraintId: proto.String("int64.lt"), }, ), @@ -88,8 +88,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64LT{Val: 1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.lt"), ConstraintId: proto.String("int64.lt"), }, ), @@ -106,8 +106,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64LTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.lte"), ConstraintId: proto.String("int64.lte"), }, ), @@ -120,8 +120,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64GT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt"), }, ), @@ -130,8 +130,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64GT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt"), }, ), @@ -148,8 +148,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64GTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gte"), ConstraintId: proto.String("int64.gte"), }, ), @@ -162,8 +162,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64GTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt_lt"), }, ), @@ -172,8 +172,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64GTLT{Val: -1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt_lt"), }, ), @@ -182,8 +182,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64GTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt_lt"), }, ), @@ -192,8 +192,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64GTLT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt_lt"), }, ), @@ -210,8 +210,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64ExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt_lt_exclusive"), }, ), @@ -220,8 +220,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64ExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt_lt_exclusive"), }, ), @@ -230,8 +230,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64ExLTGT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt_lt_exclusive"), }, ), @@ -252,8 +252,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64GTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gte"), ConstraintId: proto.String("int64.gte_lte"), }, ), @@ -262,8 +262,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64GTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gte"), ConstraintId: proto.String("int64.gte_lte"), }, ), @@ -288,8 +288,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64ExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gte"), ConstraintId: proto.String("int64.gte_lte_exclusive"), }, ), @@ -306,8 +306,8 @@ func int64Suite() suites.Suite { Message: &cases.Int64Ignore{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gte"), ConstraintId: proto.String("int64.gte_lte"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_kitchensink.go b/tools/protovalidate-conformance/internal/cases/cases_kitchensink.go index 35f80d06..354b3fa4 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_kitchensink.go +++ b/tools/protovalidate-conformance/internal/cases/cases_kitchensink.go @@ -40,44 +40,43 @@ func kitchenSinkSuite() suites.Suite { Message: &cases.KitchenSinkMessage{Val: &cases.ComplexTestMsg{}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val.bytes_val"), - RulePath: proto.String("bytes.const"), + Field: results.FieldPath("val.bytes_val"), + Rule: results.FieldPath("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ - FieldPath: proto.String("val.double_in"), - RulePath: proto.String("double.in"), + Field: results.FieldPath("val.double_in"), + Rule: results.FieldPath("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ - FieldPath: proto.String("val.enum_const"), - RulePath: proto.String("enum.const"), + Field: results.FieldPath("val.enum_const"), + Rule: results.FieldPath("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ - FieldPath: proto.String("val.int_const"), - RulePath: proto.String("int32.const"), + Field: results.FieldPath("val.int_const"), + Rule: results.FieldPath("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ - FieldPath: proto.String("val.o"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.o"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ - FieldPath: proto.String("val.dur_val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.dur_val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ - FieldPath: proto.String("val.const"), - RulePath: proto.String("string.const"), + Field: results.FieldPath("val.const"), + Rule: results.FieldPath("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `abcd`"), }, @@ -87,86 +86,84 @@ func kitchenSinkSuite() suites.Suite { Message: &cases.KitchenSinkMessage{Val: &cases.ComplexTestMsg{Another: &cases.ComplexTestMsg{}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val.another.bytes_val"), - RulePath: proto.String("bytes.const"), + Field: results.FieldPath("val.another.bytes_val"), + Rule: results.FieldPath("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ - FieldPath: proto.String("val.bytes_val"), - RulePath: proto.String("bytes.const"), + Field: results.FieldPath("val.bytes_val"), + Rule: results.FieldPath("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ - FieldPath: proto.String("val.another.double_in"), - RulePath: proto.String("double.in"), + Field: results.FieldPath("val.another.double_in"), + Rule: results.FieldPath("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ - FieldPath: proto.String("val.double_in"), - RulePath: proto.String("double.in"), + Field: results.FieldPath("val.double_in"), + Rule: results.FieldPath("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ - FieldPath: proto.String("val.another.enum_const"), - RulePath: proto.String("enum.const"), + Field: results.FieldPath("val.another.enum_const"), + Rule: results.FieldPath("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ - FieldPath: proto.String("val.enum_const"), - RulePath: proto.String("enum.const"), + Field: results.FieldPath("val.enum_const"), + Rule: results.FieldPath("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ - FieldPath: proto.String("val.another.int_const"), - RulePath: proto.String("int32.const"), + Field: results.FieldPath("val.another.int_const"), + Rule: results.FieldPath("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ - FieldPath: proto.String("val.int_const"), - RulePath: proto.String("int32.const"), + Field: results.FieldPath("val.int_const"), + Rule: results.FieldPath("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ - FieldPath: proto.String("val.o"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.o"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ - FieldPath: proto.String("val.another.o"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.another.o"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ - FieldPath: proto.String("val.another.dur_val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.another.dur_val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ - FieldPath: proto.String("val.dur_val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.dur_val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ - FieldPath: proto.String("val.another.const"), - RulePath: proto.String("string.const"), + Field: results.FieldPath("val.another.const"), + Rule: results.FieldPath("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `abcd`"), }, &validate.Violation{ - FieldPath: proto.String("val.const"), - RulePath: proto.String("string.const"), + Field: results.FieldPath("val.const"), + Rule: results.FieldPath("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `abcd`"), }, @@ -176,86 +173,84 @@ func kitchenSinkSuite() suites.Suite { Message: &cases.KitchenSinkMessage{Val: &cases.ComplexTestMsg{Const: "abcd", BoolConst: true, Nested: &cases.ComplexTestMsg{}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val.bool_const"), - RulePath: proto.String("bool.const"), + Field: results.FieldPath("val.bool_const"), + Rule: results.FieldPath("bool.const"), ConstraintId: proto.String("bool.const"), Message: proto.String("value must equal false"), }, &validate.Violation{ - FieldPath: proto.String("val.bytes_val"), - RulePath: proto.String("bytes.const"), + Field: results.FieldPath("val.bytes_val"), + Rule: results.FieldPath("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ - FieldPath: proto.String("val.nested.bytes_val"), - RulePath: proto.String("bytes.const"), + Field: results.FieldPath("val.nested.bytes_val"), + Rule: results.FieldPath("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ - FieldPath: proto.String("val.double_in"), - RulePath: proto.String("double.in"), + Field: results.FieldPath("val.double_in"), + Rule: results.FieldPath("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ - FieldPath: proto.String("val.nested.double_in"), - RulePath: proto.String("double.in"), + Field: results.FieldPath("val.nested.double_in"), + Rule: results.FieldPath("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ - FieldPath: proto.String("val.enum_const"), - RulePath: proto.String("enum.const"), + Field: results.FieldPath("val.enum_const"), + Rule: results.FieldPath("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ - FieldPath: proto.String("val.nested.enum_const"), - RulePath: proto.String("enum.const"), + Field: results.FieldPath("val.nested.enum_const"), + Rule: results.FieldPath("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ - FieldPath: proto.String("val.int_const"), - RulePath: proto.String("int32.const"), + Field: results.FieldPath("val.int_const"), + Rule: results.FieldPath("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ - FieldPath: proto.String("val.nested.int_const"), - RulePath: proto.String("int32.const"), + Field: results.FieldPath("val.nested.int_const"), + Rule: results.FieldPath("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ - FieldPath: proto.String("val.o"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.o"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ - FieldPath: proto.String("val.dur_val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.dur_val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ - FieldPath: proto.String("val.nested.o"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.nested.o"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ - FieldPath: proto.String("val.nested.dur_val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.nested.dur_val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ - FieldPath: proto.String("val.nested.const"), - RulePath: proto.String("string.const"), + Field: results.FieldPath("val.nested.const"), + Rule: results.FieldPath("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `abcd`"), }, @@ -265,80 +260,79 @@ func kitchenSinkSuite() suites.Suite { Message: &cases.KitchenSinkMessage{Val: &cases.ComplexTestMsg{BoolConst: true, FloatVal: &wrapperspb.FloatValue{}, TsVal: ×tamppb.Timestamp{}, FloatConst: 8, AnyVal: &anypb.Any{TypeUrl: "asdf"}, RepTsVal: []*timestamppb.Timestamp{{Nanos: 1}}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val.any_val"), - RulePath: proto.String("any.in"), + Field: results.FieldPath("val.any_val"), + Rule: results.FieldPath("any.in"), ConstraintId: proto.String("any.in"), Message: proto.String("type URL must be in the allow list"), }, &validate.Violation{ - FieldPath: proto.String("val.bool_const"), - RulePath: proto.String("bool.const"), + Field: results.FieldPath("val.bool_const"), + Rule: results.FieldPath("bool.const"), ConstraintId: proto.String("bool.const"), Message: proto.String("value must equal false"), }, &validate.Violation{ - FieldPath: proto.String("val.bytes_val"), - RulePath: proto.String("bytes.const"), + Field: results.FieldPath("val.bytes_val"), + Rule: results.FieldPath("bytes.const"), ConstraintId: proto.String("bytes.const"), Message: proto.String("value must be 0099"), }, &validate.Violation{ - FieldPath: proto.String("val.double_in"), - RulePath: proto.String("double.in"), + Field: results.FieldPath("val.double_in"), + Rule: results.FieldPath("double.in"), ConstraintId: proto.String("double.in"), Message: proto.String("value must be in list [456.789000, 123.000000]"), }, &validate.Violation{ - FieldPath: proto.String("val.enum_const"), - RulePath: proto.String("enum.const"), + Field: results.FieldPath("val.enum_const"), + Rule: results.FieldPath("enum.const"), ConstraintId: proto.String("enum.const"), Message: proto.String("value must equal 2"), }, &validate.Violation{ - FieldPath: proto.String("val.float_val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val.float_val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt"), Message: proto.String("value must be greater than 0"), }, &validate.Violation{ - FieldPath: proto.String("val.float_const"), - RulePath: proto.String("float.lt"), + Field: results.FieldPath("val.float_const"), + Rule: results.FieldPath("float.lt"), ConstraintId: proto.String("float.lt"), Message: proto.String("value must be less than 8"), }, &validate.Violation{ - FieldPath: proto.String("val.int_const"), - RulePath: proto.String("int32.const"), + Field: results.FieldPath("val.int_const"), + Rule: results.FieldPath("int32.const"), ConstraintId: proto.String("int32.const"), Message: proto.String("value must equal 5"), }, &validate.Violation{ - FieldPath: proto.String("val.o"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.o"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ - FieldPath: proto.String("val.dur_val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val.dur_val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, &validate.Violation{ - FieldPath: proto.String("val.const"), - RulePath: proto.String("string.const"), + Field: results.FieldPath("val.const"), + Rule: results.FieldPath("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `abcd`"), }, &validate.Violation{ - FieldPath: proto.String("val.ts_val"), - RulePath: proto.String("timestamp.gt"), + Field: results.FieldPath("val.ts_val"), + Rule: results.FieldPath("timestamp.gt"), ConstraintId: proto.String("timestamp.gt"), Message: proto.String("value must be greater than 1970-01-01T00:00:07Z"), }, &validate.Violation{ - FieldPath: proto.String("val.rep_ts_val[0]"), - RulePath: proto.String("repeated.items.timestamp.gte"), + Field: results.FieldPath("val.rep_ts_val[0]"), + Rule: results.FieldPath("repeated.items.timestamp.gte"), ConstraintId: proto.String("timestamp.gte"), Message: proto.String("value must be greater than or equal to 1970-01-01T00:00:00.001Z"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_map.go b/tools/protovalidate-conformance/internal/cases/cases_map.go index 6ae7b63b..d482b8ed 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_map.go +++ b/tools/protovalidate-conformance/internal/cases/cases_map.go @@ -40,8 +40,8 @@ func mapSuite() suites.Suite { Message: &cases.MapMin{Val: map[int32]float32{1: 2}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), Message: proto.String("map must be at least 2 entries"), }, @@ -59,8 +59,8 @@ func mapSuite() suites.Suite { Message: &cases.MapMax{Val: map[int64]float64{1: 2, 3: 4, 5: 6, 7: 8}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.max_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.max_pairs"), ConstraintId: proto.String("map.max_pairs"), Message: proto.String("map must be at most 3 entries"), }, @@ -82,8 +82,8 @@ func mapSuite() suites.Suite { Message: &cases.MapMinMax{Val: map[string]bool{}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), Message: proto.String("map must be at least 2 entries"), }, @@ -93,8 +93,8 @@ func mapSuite() suites.Suite { Message: &cases.MapMinMax{Val: map[string]bool{"a": true, "b": false, "c": true, "d": false, "e": true}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.max_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.max_pairs"), ConstraintId: proto.String("map.max_pairs"), Message: proto.String("map must be at most 4 entries"), }, @@ -108,8 +108,8 @@ func mapSuite() suites.Suite { Message: &cases.MapExact{Val: map[uint64]string{1: "a", 2: "b"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.min_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.min_pairs"), ConstraintId: proto.String("map.min_pairs"), Message: proto.String("map must be at least 3 entries"), }, @@ -119,8 +119,8 @@ func mapSuite() suites.Suite { Message: &cases.MapExact{Val: map[uint64]string{1: "a", 2: "b", 3: "c", 4: "d"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.max_pairs"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.max_pairs"), ConstraintId: proto.String("map.max_pairs"), Message: proto.String("map must be at most 3 entries"), }, @@ -142,8 +142,8 @@ func mapSuite() suites.Suite { Message: &cases.MapKeys{Val: map[int64]string{1: "a"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("map.keys.sint64.lt"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("map.keys.sint64.lt"), ConstraintId: proto.String("sint64.lt"), Message: proto.String("value must be less than 0"), ForKey: proto.Bool(true), @@ -154,8 +154,8 @@ func mapSuite() suites.Suite { Message: &cases.MapKeysPattern{Val: map[string]string{"A": "a", "!@#$%^&*()": "b"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[\"!@#$%^&*()\"]"), - RulePath: proto.String("map.keys.string.pattern"), + Field: results.FieldPath("val[\"!@#$%^&*()\"]"), + Rule: results.FieldPath("map.keys.string.pattern"), ConstraintId: proto.String("string.pattern"), Message: proto.String("value does not match regex pattern `(?i)^[a-z0-9]+$`"), ForKey: proto.Bool(true), @@ -178,14 +178,14 @@ func mapSuite() suites.Suite { Message: &cases.MapValues{Val: map[string]string{"a": "A", "b": "B"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[\"a\"]"), - RulePath: proto.String("map.values.string.min_len"), + Field: results.FieldPath("val[\"a\"]"), + Rule: results.FieldPath("map.values.string.min_len"), ConstraintId: proto.String("string.min_len"), Message: proto.String("value length must be at least 3 characters"), }, &validate.Violation{ - FieldPath: proto.String("val[\"b\"]"), - RulePath: proto.String("map.values.string.min_len"), + Field: results.FieldPath("val[\"b\"]"), + Rule: results.FieldPath("map.values.string.min_len"), ConstraintId: proto.String("string.min_len"), Message: proto.String("value length must be at least 3 characters"), }, @@ -195,8 +195,8 @@ func mapSuite() suites.Suite { Message: &cases.MapValuesPattern{Val: map[string]string{"a": "A", "b": "!@#$%^&*()"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[\"b\"]"), - RulePath: proto.String("map.values.string.pattern"), + Field: results.FieldPath("val[\"b\"]"), + Rule: results.FieldPath("map.values.string.pattern"), ConstraintId: proto.String("string.pattern"), Message: proto.String("value does not match regex pattern `(?i)^[a-z0-9]+$`"), }, @@ -210,8 +210,8 @@ func mapSuite() suites.Suite { Message: &cases.MapRecursive{Val: map[uint32]*cases.MapRecursive_Msg{1: {}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1].val"), - RulePath: proto.String("string.min_len"), + Field: results.FieldPath("val[1].val"), + Rule: results.FieldPath("string.min_len"), ConstraintId: proto.String("string.min_len"), Message: proto.String("value length must be at least 3 characters"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_message.go b/tools/protovalidate-conformance/internal/cases/cases_message.go index 64a933a3..0bc83753 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_message.go +++ b/tools/protovalidate-conformance/internal/cases/cases_message.go @@ -53,8 +53,8 @@ func messageSuite() suites.Suite { Message: &cases.Message{Val: &cases.TestMsg{}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val.const"), - RulePath: proto.String("string.const"), + Field: results.FieldPath("val.const"), + Rule: results.FieldPath("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `foo`"), }, @@ -64,8 +64,8 @@ func messageSuite() suites.Suite { Message: &cases.Message{Val: &cases.TestMsg{Const: "foo", Nested: &cases.TestMsg{}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val.nested.const"), - RulePath: proto.String("string.const"), + Field: results.FieldPath("val.nested.const"), + Rule: results.FieldPath("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `foo`"), }, @@ -87,8 +87,8 @@ func messageSuite() suites.Suite { Message: &cases.MessageRequired{}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, @@ -98,14 +98,13 @@ func messageSuite() suites.Suite { Message: &cases.MessageRequiredOneof{}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("one"), - RulePath: proto.String("required"), + Field: results.FieldPath("one"), ConstraintId: proto.String("required"), Message: proto.String("exactly one field is required in oneof"), }, &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, @@ -119,8 +118,8 @@ func messageSuite() suites.Suite { Message: &cases.MessageRequiredButOptional{}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }, @@ -138,8 +137,8 @@ func messageSuite() suites.Suite { Message: &cases.MessageCrossPackage{Val: &other_package.Embed{}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val.val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val.val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }, @@ -149,8 +148,8 @@ func messageSuite() suites.Suite { Message: &cases.MessageCrossPackage{Val: &other_package.Embed{Val: -1}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val.val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val.val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_nested.go b/tools/protovalidate-conformance/internal/cases/cases_nested.go index 3792bc94..74c2af76 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_nested.go +++ b/tools/protovalidate-conformance/internal/cases/cases_nested.go @@ -43,8 +43,8 @@ func nestedSuite() suites.Suite { }, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("two.three.uuid"), - RulePath: proto.String("string.uuid"), + Field: results.FieldPath("two.three.uuid"), + Rule: results.FieldPath("string.uuid"), ConstraintId: proto.String("string.uuid"), }), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_oneof.go b/tools/protovalidate-conformance/internal/cases/cases_oneof.go index ed10f9a9..2cc843ef 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_oneof.go +++ b/tools/protovalidate-conformance/internal/cases/cases_oneof.go @@ -51,24 +51,24 @@ func oneofSuite() suites.Suite { "field/X/invalid": { Message: &cases.Oneof{O: &cases.Oneof_X{X: "fizzbuzz"}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("x"), - RulePath: proto.String("string.prefix"), + Field: results.FieldPath("x"), + Rule: results.FieldPath("string.prefix"), ConstraintId: proto.String("string.prefix"), }), }, "field/Y/invalid": { Message: &cases.Oneof{O: &cases.Oneof_Y{Y: -1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("y"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("y"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), }), }, "filed/Z/invalid": { Message: &cases.Oneof{O: &cases.Oneof_Z{Z: &cases.TestOneofMsg{}}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("z.val"), - RulePath: proto.String("bool.const"), + Field: results.FieldPath("z.val"), + Rule: results.FieldPath("bool.const"), ConstraintId: proto.String("bool.const"), }), }, @@ -83,8 +83,7 @@ func oneofSuite() suites.Suite { "required/invalid": { Message: &cases.OneofRequired{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("o"), - RulePath: proto.String("required"), + Field: results.FieldPath("o"), ConstraintId: proto.String("required"), }), }, @@ -105,8 +104,8 @@ func oneofSuite() suites.Suite { O: &cases.OneofRequiredWithRequiredField_B{B: "foo"}, }, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("required"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -114,13 +113,12 @@ func oneofSuite() suites.Suite { Message: &cases.OneofRequiredWithRequiredField{}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("o"), - RulePath: proto.String("required"), + Field: results.FieldPath("o"), ConstraintId: proto.String("required"), }, &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("required"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_predefined.go b/tools/protovalidate-conformance/internal/cases/cases_predefined.go index e6e137f6..770f6549 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_predefined.go +++ b/tools/protovalidate-conformance/internal/cases/cases_predefined.go @@ -37,8 +37,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedFloatRuleProto2{Val: proto.Float32(-2.0)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -52,8 +52,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedDoubleRuleProto2{Val: proto.Float64(-2.0)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -67,8 +67,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedInt32RuleProto2{Val: proto.Int32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -82,8 +82,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedInt64RuleProto2{Val: proto.Int64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), ConstraintId: proto.String("int64.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -97,8 +97,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedUInt32RuleProto2{Val: proto.Uint32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -112,8 +112,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedUInt64RuleProto2{Val: proto.Uint64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -127,8 +127,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSInt32RuleProto2{Val: proto.Int32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, @@ -142,8 +142,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSInt64RuleProto2{Val: proto.Int64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.[buf.validate.conformance.cases.sint64_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.[buf.validate.conformance.cases.sint64_even_proto2]"), ConstraintId: proto.String("sint64.even.proto2"), Message: proto.String("sint64 value is not even"), }, @@ -157,8 +157,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedFixed32RuleProto2{Val: proto.Uint32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.[buf.validate.conformance.cases.fixed32_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.[buf.validate.conformance.cases.fixed32_even_proto2]"), ConstraintId: proto.String("fixed32.even.proto2"), Message: proto.String("fixed32 value is not even"), }, @@ -172,8 +172,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedFixed64RuleProto2{Val: proto.Uint64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.[buf.validate.conformance.cases.fixed64_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.[buf.validate.conformance.cases.fixed64_even_proto2]"), ConstraintId: proto.String("fixed64.even.proto2"), Message: proto.String("fixed64 value is not even"), }, @@ -187,8 +187,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSFixed32RuleProto2{Val: proto.Int32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.[buf.validate.conformance.cases.sfixed32_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.[buf.validate.conformance.cases.sfixed32_even_proto2]"), ConstraintId: proto.String("sfixed32.even.proto2"), Message: proto.String("sfixed32 value is not even"), }, @@ -202,8 +202,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSFixed64RuleProto2{Val: proto.Int64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.[buf.validate.conformance.cases.sfixed64_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.[buf.validate.conformance.cases.sfixed64_even_proto2]"), ConstraintId: proto.String("sfixed64.even.proto2"), Message: proto.String("sfixed64 value is not even"), }, @@ -217,8 +217,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedBoolRuleProto2{Val: proto.Bool(true)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -232,8 +232,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedStringRuleProto2{Val: proto.String("../invalid/path")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -247,8 +247,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedBytesRuleProto2{Val: []byte("../invalid/path")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -262,8 +262,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedEnumRuleProto2{Val: cases.PredefinedEnumRuleProto2_ENUM_PROTO2_ZERO_UNSPECIFIED.Enum()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.[buf.validate.conformance.cases.enum_non_zero_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.[buf.validate.conformance.cases.enum_non_zero_proto2]"), ConstraintId: proto.String("enum.non_zero.proto2"), Message: proto.String("enum value is not non-zero"), }, @@ -277,8 +277,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedRepeatedRuleProto2{Val: []uint64{1, 2, 3}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.[buf.validate.conformance.cases.repeated_at_least_five_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.[buf.validate.conformance.cases.repeated_at_least_five_proto2]"), ConstraintId: proto.String("repeated.at_least_five.proto2"), Message: proto.String("repeated field must have at least five values"), }, @@ -292,8 +292,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedDurationRuleProto2{Val: durationpb.New(15 * time.Second)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.[buf.validate.conformance.cases.duration_too_long_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.[buf.validate.conformance.cases.duration_too_long_proto2]"), ConstraintId: proto.String("duration.too_long.proto2"), Message: proto.String("duration can't be longer than 10 seconds"), }, @@ -307,8 +307,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedTimestampRuleProto2{Val: timestamppb.New(time.Unix(1725415496, 0))}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.[buf.validate.conformance.cases.timestamp_in_range_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.[buf.validate.conformance.cases.timestamp_in_range_proto2]"), ConstraintId: proto.String("timestamp.time_range.proto2"), Message: proto.String("timestamp out of range"), }, @@ -322,8 +322,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedFloatRuleProto2{Val: wrapperspb.Float(-2.0)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -339,8 +339,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedDoubleRuleProto2{Val: wrapperspb.Double(-2.0)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -354,8 +354,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedInt32RuleProto2{Val: wrapperspb.Int32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -369,8 +369,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedInt64RuleProto2{Val: wrapperspb.Int64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), ConstraintId: proto.String("int64.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -384,8 +384,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedUInt32RuleProto2{Val: wrapperspb.UInt32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -399,8 +399,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedUInt64RuleProto2{Val: wrapperspb.UInt64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -414,8 +414,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedBoolRuleProto2{Val: wrapperspb.Bool(true)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -429,8 +429,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedStringRuleProto2{Val: wrapperspb.String("../invalid/path")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -444,8 +444,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedBytesRuleProto2{Val: wrapperspb.Bytes([]byte("../invalid/path"))}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -463,8 +463,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.float.[buf.validate.conformance.cases.float_abs_range_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -482,8 +482,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.double.[buf.validate.conformance.cases.double_abs_range_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -501,8 +501,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -520,8 +520,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), ConstraintId: proto.String("int64.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -539,8 +539,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -558,8 +558,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -577,8 +577,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.bool.[buf.validate.conformance.cases.bool_false_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -596,8 +596,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.string.[buf.validate.conformance.cases.string_valid_path_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -615,8 +615,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -640,29 +640,29 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, &validate.Violation{ - FieldPath: proto.String("b.c"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), + Field: results.FieldPath("b.c"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, &validate.Violation{ - FieldPath: proto.String("b"), + Field: results.FieldPath("b"), ConstraintId: proto.String("predefined_and_custom_rule_embedded_proto2"), Message: proto.String("b.c must be a multiple of 3"), }, &validate.Violation{ - FieldPath: proto.String("b.c"), + Field: results.FieldPath("b.c"), ConstraintId: proto.String("predefined_and_custom_rule_nested_proto2"), Message: proto.String("c must be positive"), }, &validate.Violation{ - FieldPath: proto.String("a"), + Field: results.FieldPath("a"), ConstraintId: proto.String("predefined_and_custom_rule_scalar_proto2"), Message: proto.String("a must be greater than 24"), }, @@ -680,8 +680,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("sint32.lt"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("sint32.lt"), ConstraintId: proto.String("sint32.lt"), Message: proto.String("value must be less than 28"), }, @@ -693,8 +693,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, @@ -706,7 +706,7 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), + Field: results.FieldPath("a"), ConstraintId: proto.String("standard_predefined_and_custom_rule_scalar_proto2"), Message: proto.String("a must be greater than 24"), }, @@ -720,8 +720,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedFloatRuleProto3{Val: -2.0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -735,8 +735,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedDoubleRuleProto3{Val: -2.0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -750,8 +750,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedInt32RuleProto3{Val: 3}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -765,8 +765,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedInt64RuleProto3{Val: 3}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), ConstraintId: proto.String("int64.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -780,8 +780,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedUInt32RuleProto3{Val: 3}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -795,8 +795,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedUInt64RuleProto3{Val: 3}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -810,8 +810,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSInt32RuleProto3{Val: 3}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, @@ -825,8 +825,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSInt64RuleProto3{Val: 3}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.[buf.validate.conformance.cases.sint64_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.[buf.validate.conformance.cases.sint64_even_proto2]"), ConstraintId: proto.String("sint64.even.proto2"), Message: proto.String("sint64 value is not even"), }, @@ -840,8 +840,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedFixed32RuleProto3{Val: 3}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.[buf.validate.conformance.cases.fixed32_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.[buf.validate.conformance.cases.fixed32_even_proto2]"), ConstraintId: proto.String("fixed32.even.proto2"), Message: proto.String("fixed32 value is not even"), }, @@ -855,8 +855,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedFixed64RuleProto3{Val: 3}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.[buf.validate.conformance.cases.fixed64_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.[buf.validate.conformance.cases.fixed64_even_proto2]"), ConstraintId: proto.String("fixed64.even.proto2"), Message: proto.String("fixed64 value is not even"), }, @@ -870,8 +870,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSFixed32RuleProto3{Val: 3}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.[buf.validate.conformance.cases.sfixed32_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.[buf.validate.conformance.cases.sfixed32_even_proto2]"), ConstraintId: proto.String("sfixed32.even.proto2"), Message: proto.String("sfixed32 value is not even"), }, @@ -885,8 +885,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSFixed64RuleProto3{Val: 3}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.[buf.validate.conformance.cases.sfixed64_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.[buf.validate.conformance.cases.sfixed64_even_proto2]"), ConstraintId: proto.String("sfixed64.even.proto2"), Message: proto.String("sfixed64 value is not even"), }, @@ -900,8 +900,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedBoolRuleProto3{Val: true}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -915,8 +915,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedStringRuleProto3{Val: "../invalid/path"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -930,8 +930,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedBytesRuleProto3{Val: []byte("../invalid/path")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -945,8 +945,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedEnumRuleProto3{Val: cases.PredefinedEnumRuleProto3_ENUM_PROTO3_ZERO_UNSPECIFIED}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.[buf.validate.conformance.cases.enum_non_zero_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.[buf.validate.conformance.cases.enum_non_zero_proto2]"), ConstraintId: proto.String("enum.non_zero.proto2"), Message: proto.String("enum value is not non-zero"), }, @@ -960,8 +960,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedRepeatedRuleProto3{Val: []uint64{1, 2, 3}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.[buf.validate.conformance.cases.repeated_at_least_five_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.[buf.validate.conformance.cases.repeated_at_least_five_proto2]"), ConstraintId: proto.String("repeated.at_least_five.proto2"), Message: proto.String("repeated field must have at least five values"), }, @@ -975,8 +975,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedMapRuleProto3{Val: map[uint64]uint64{1: 1, 2: 2, 3: 3}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.[buf.validate.conformance.cases.map_at_least_five_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.[buf.validate.conformance.cases.map_at_least_five_edition_2023]"), ConstraintId: proto.String("map.at_least_five.edition_2023"), Message: proto.String("map must have at least five pairs"), }, @@ -990,8 +990,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedDurationRuleProto3{Val: durationpb.New(15 * time.Second)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.[buf.validate.conformance.cases.duration_too_long_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.[buf.validate.conformance.cases.duration_too_long_proto2]"), ConstraintId: proto.String("duration.too_long.proto2"), Message: proto.String("duration can't be longer than 10 seconds"), }, @@ -1005,8 +1005,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedTimestampRuleProto3{Val: timestamppb.New(time.Unix(1725415496, 0))}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.[buf.validate.conformance.cases.timestamp_in_range_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.[buf.validate.conformance.cases.timestamp_in_range_proto2]"), ConstraintId: proto.String("timestamp.time_range.proto2"), Message: proto.String("timestamp out of range"), }, @@ -1020,8 +1020,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedFloatRuleProto3{Val: wrapperspb.Float(-2.0)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -1037,8 +1037,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedDoubleRuleProto3{Val: wrapperspb.Double(-2.0)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -1052,8 +1052,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedInt32RuleProto3{Val: wrapperspb.Int32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -1067,8 +1067,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedInt64RuleProto3{Val: wrapperspb.Int64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), ConstraintId: proto.String("int64.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -1082,8 +1082,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedUInt32RuleProto3{Val: wrapperspb.UInt32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -1097,8 +1097,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedUInt64RuleProto3{Val: wrapperspb.UInt64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -1112,8 +1112,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedBoolRuleProto3{Val: wrapperspb.Bool(true)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -1127,8 +1127,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedStringRuleProto3{Val: wrapperspb.String("../invalid/path")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1142,8 +1142,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedBytesRuleProto3{Val: wrapperspb.Bytes([]byte("../invalid/path"))}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1161,8 +1161,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.float.[buf.validate.conformance.cases.float_abs_range_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.float.[buf.validate.conformance.cases.float_abs_range_proto2]"), ConstraintId: proto.String("float.abs_range.proto2"), Message: proto.String("float value is out of range"), }, @@ -1180,8 +1180,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.double.[buf.validate.conformance.cases.double_abs_range_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.double.[buf.validate.conformance.cases.double_abs_range_proto2]"), ConstraintId: proto.String("double.abs_range.proto2"), Message: proto.String("double value is out of range"), }, @@ -1199,8 +1199,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.int32.[buf.validate.conformance.cases.int32_abs_in_proto2]"), ConstraintId: proto.String("int32.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -1218,8 +1218,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.int64.[buf.validate.conformance.cases.int64_abs_in_proto2]"), ConstraintId: proto.String("int64.abs_in.proto2"), Message: proto.String("value must be in absolute value of list"), }, @@ -1237,8 +1237,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.uint32.[buf.validate.conformance.cases.uint32_even_proto2]"), ConstraintId: proto.String("uint32.even.proto2"), Message: proto.String("uint32 value is not even"), }, @@ -1256,8 +1256,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.uint64.[buf.validate.conformance.cases.uint64_even_proto2]"), ConstraintId: proto.String("uint64.even.proto2"), Message: proto.String("uint64 value is not even"), }, @@ -1275,8 +1275,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.bool.[buf.validate.conformance.cases.bool_false_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.bool.[buf.validate.conformance.cases.bool_false_proto2]"), ConstraintId: proto.String("bool.false.proto2"), Message: proto.String("bool value is not false"), }, @@ -1294,8 +1294,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.string.[buf.validate.conformance.cases.string_valid_path_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.string.[buf.validate.conformance.cases.string_valid_path_proto2]"), ConstraintId: proto.String("string.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1313,8 +1313,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.bytes.[buf.validate.conformance.cases.bytes_valid_path_proto2]"), ConstraintId: proto.String("bytes.valid_path.proto2"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1338,29 +1338,29 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, &validate.Violation{ - FieldPath: proto.String("b.c"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), + Field: results.FieldPath("b.c"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, &validate.Violation{ - FieldPath: proto.String("b"), + Field: results.FieldPath("b"), ConstraintId: proto.String("predefined_and_custom_rule_embedded_proto3"), Message: proto.String("b.c must be a multiple of 3"), }, &validate.Violation{ - FieldPath: proto.String("b.c"), + Field: results.FieldPath("b.c"), ConstraintId: proto.String("predefined_and_custom_rule_nested_proto3"), Message: proto.String("c must be positive"), }, &validate.Violation{ - FieldPath: proto.String("a"), + Field: results.FieldPath("a"), ConstraintId: proto.String("predefined_and_custom_rule_scalar_proto3"), Message: proto.String("a must be greater than 24"), }, @@ -1378,8 +1378,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("sint32.lt"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("sint32.lt"), ConstraintId: proto.String("sint32.lt"), Message: proto.String("value must be less than 28"), }, @@ -1391,8 +1391,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_proto2]"), ConstraintId: proto.String("sint32.even.proto2"), Message: proto.String("sint32 value is not even"), }, @@ -1404,7 +1404,7 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), + Field: results.FieldPath("a"), ConstraintId: proto.String("standard_predefined_and_custom_rule_scalar_proto3"), Message: proto.String("a must be greater than 24"), }, @@ -1418,8 +1418,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedFloatRuleEdition2023{Val: proto.Float32(-2.0)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.[buf.validate.conformance.cases.float_abs_range_edition_2023]"), ConstraintId: proto.String("float.abs_range.edition_2023"), Message: proto.String("float value is out of range"), }, @@ -1433,8 +1433,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedDoubleRuleEdition2023{Val: proto.Float64(-2.0)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.[buf.validate.conformance.cases.double_abs_range_edition_2023]"), ConstraintId: proto.String("double.abs_range.edition_2023"), Message: proto.String("double value is out of range"), }, @@ -1448,8 +1448,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedInt32RuleEdition2023{Val: proto.Int32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.[buf.validate.conformance.cases.int32_abs_in_edition_2023]"), ConstraintId: proto.String("int32.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1463,8 +1463,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedInt64RuleEdition2023{Val: proto.Int64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), ConstraintId: proto.String("int64.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1478,8 +1478,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedUInt32RuleEdition2023{Val: proto.Uint32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.[buf.validate.conformance.cases.uint32_even_edition_2023]"), ConstraintId: proto.String("uint32.even.edition_2023"), Message: proto.String("uint32 value is not even"), }, @@ -1493,8 +1493,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedUInt64RuleEdition2023{Val: proto.Uint64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.[buf.validate.conformance.cases.uint64_even_edition_2023]"), ConstraintId: proto.String("uint64.even.edition_2023"), Message: proto.String("uint64 value is not even"), }, @@ -1508,8 +1508,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSInt32RuleEdition2023{Val: proto.Int32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, @@ -1523,8 +1523,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSInt64RuleEdition2023{Val: proto.Int64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.[buf.validate.conformance.cases.sint64_even_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.[buf.validate.conformance.cases.sint64_even_edition_2023]"), ConstraintId: proto.String("sint64.even.edition_2023"), Message: proto.String("sint64 value is not even"), }, @@ -1538,8 +1538,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedFixed32RuleEdition2023{Val: proto.Uint32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed32.[buf.validate.conformance.cases.fixed32_even_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed32.[buf.validate.conformance.cases.fixed32_even_edition_2023]"), ConstraintId: proto.String("fixed32.even.edition_2023"), Message: proto.String("fixed32 value is not even"), }, @@ -1553,8 +1553,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedFixed64RuleEdition2023{Val: proto.Uint64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("fixed64.[buf.validate.conformance.cases.fixed64_even_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("fixed64.[buf.validate.conformance.cases.fixed64_even_edition_2023]"), ConstraintId: proto.String("fixed64.even.edition_2023"), Message: proto.String("fixed64 value is not even"), }, @@ -1568,8 +1568,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSFixed32RuleEdition2023{Val: proto.Int32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.[buf.validate.conformance.cases.sfixed32_even_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.[buf.validate.conformance.cases.sfixed32_even_edition_2023]"), ConstraintId: proto.String("sfixed32.even.edition_2023"), Message: proto.String("sfixed32 value is not even"), }, @@ -1583,8 +1583,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedSFixed64RuleEdition2023{Val: proto.Int64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.[buf.validate.conformance.cases.sfixed64_even_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.[buf.validate.conformance.cases.sfixed64_even_edition_2023]"), ConstraintId: proto.String("sfixed64.even.edition_2023"), Message: proto.String("sfixed64 value is not even"), }, @@ -1598,8 +1598,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedBoolRuleEdition2023{Val: proto.Bool(true)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bool.[buf.validate.conformance.cases.bool_false_edition_2023]"), ConstraintId: proto.String("bool.false.edition_2023"), Message: proto.String("bool value is not false"), }, @@ -1613,8 +1613,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedStringRuleEdition2023{Val: proto.String("../invalid/path")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.[buf.validate.conformance.cases.string_valid_path_edition_2023]"), ConstraintId: proto.String("string.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1628,8 +1628,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedBytesRuleEdition2023{Val: []byte("../invalid/path")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.[buf.validate.conformance.cases.bytes_valid_path_edition_2023]"), ConstraintId: proto.String("bytes.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1643,8 +1643,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedEnumRuleEdition2023{Val: cases.PredefinedEnumRuleEdition2023_ENUM_EDITION2023_ZERO_UNSPECIFIED.Enum()}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("enum.[buf.validate.conformance.cases.enum_non_zero_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("enum.[buf.validate.conformance.cases.enum_non_zero_edition_2023]"), ConstraintId: proto.String("enum.non_zero.edition_2023"), Message: proto.String("enum value is not non-zero"), }, @@ -1658,8 +1658,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedRepeatedRuleEdition2023{Val: []uint64{1, 2, 3}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.[buf.validate.conformance.cases.repeated_at_least_five_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.[buf.validate.conformance.cases.repeated_at_least_five_edition_2023]"), ConstraintId: proto.String("repeated.at_least_five.edition_2023"), Message: proto.String("repeated field must have at least five values"), }, @@ -1673,8 +1673,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedMapRuleEdition2023{Val: map[uint64]uint64{1: 1, 2: 2, 3: 3}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("map.[buf.validate.conformance.cases.map_at_least_five_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("map.[buf.validate.conformance.cases.map_at_least_five_edition_2023]"), ConstraintId: proto.String("map.at_least_five.edition_2023"), Message: proto.String("map must have at least five pairs"), }, @@ -1688,8 +1688,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedDurationRuleEdition2023{Val: durationpb.New(15 * time.Second)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("duration.[buf.validate.conformance.cases.duration_too_long_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("duration.[buf.validate.conformance.cases.duration_too_long_edition_2023]"), ConstraintId: proto.String("duration.too_long.edition_2023"), Message: proto.String("duration can't be longer than 10 seconds"), }, @@ -1703,8 +1703,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedTimestampRuleEdition2023{Val: timestamppb.New(time.Unix(1725415496, 0))}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.[buf.validate.conformance.cases.timestamp_in_range_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.[buf.validate.conformance.cases.timestamp_in_range_edition_2023]"), ConstraintId: proto.String("timestamp.time_range.edition_2023"), Message: proto.String("timestamp out of range"), }, @@ -1718,8 +1718,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedFloatRuleEdition2023{Val: wrapperspb.Float(-2.0)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.[buf.validate.conformance.cases.float_abs_range_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.[buf.validate.conformance.cases.float_abs_range_edition_2023]"), ConstraintId: proto.String("float.abs_range.edition_2023"), Message: proto.String("float value is out of range"), }, @@ -1735,8 +1735,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedDoubleRuleEdition2023{Val: wrapperspb.Double(-2.0)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.[buf.validate.conformance.cases.double_abs_range_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.[buf.validate.conformance.cases.double_abs_range_edition_2023]"), ConstraintId: proto.String("double.abs_range.edition_2023"), Message: proto.String("double value is out of range"), }, @@ -1750,8 +1750,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedInt32RuleEdition2023{Val: wrapperspb.Int32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.[buf.validate.conformance.cases.int32_abs_in_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.[buf.validate.conformance.cases.int32_abs_in_edition_2023]"), ConstraintId: proto.String("int32.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1765,8 +1765,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedInt64RuleEdition2023{Val: wrapperspb.Int64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), ConstraintId: proto.String("int64.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1780,8 +1780,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedUInt32RuleEdition2023{Val: wrapperspb.UInt32(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.[buf.validate.conformance.cases.uint32_even_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.[buf.validate.conformance.cases.uint32_even_edition_2023]"), ConstraintId: proto.String("uint32.even.edition_2023"), Message: proto.String("uint32 value is not even"), }, @@ -1795,8 +1795,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedUInt64RuleEdition2023{Val: wrapperspb.UInt64(3)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.[buf.validate.conformance.cases.uint64_even_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.[buf.validate.conformance.cases.uint64_even_edition_2023]"), ConstraintId: proto.String("uint64.even.edition_2023"), Message: proto.String("uint64 value is not even"), }, @@ -1810,8 +1810,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedBoolRuleEdition2023{Val: wrapperspb.Bool(true)}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bool.[buf.validate.conformance.cases.bool_false_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bool.[buf.validate.conformance.cases.bool_false_edition_2023]"), ConstraintId: proto.String("bool.false.edition_2023"), Message: proto.String("bool value is not false"), }, @@ -1825,8 +1825,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedStringRuleEdition2023{Val: wrapperspb.String("../invalid/path")}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.[buf.validate.conformance.cases.string_valid_path_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.[buf.validate.conformance.cases.string_valid_path_edition_2023]"), ConstraintId: proto.String("string.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1840,8 +1840,8 @@ func predefinedSuite() suites.Suite { Message: &cases.PredefinedWrappedBytesRuleEdition2023{Val: wrapperspb.Bytes([]byte("../invalid/path"))}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.[buf.validate.conformance.cases.bytes_valid_path_edition_2023]"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.[buf.validate.conformance.cases.bytes_valid_path_edition_2023]"), ConstraintId: proto.String("bytes.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -1859,8 +1859,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.float.[buf.validate.conformance.cases.float_abs_range_edition_2023]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.float.[buf.validate.conformance.cases.float_abs_range_edition_2023]"), ConstraintId: proto.String("float.abs_range.edition_2023"), Message: proto.String("float value is out of range"), }, @@ -1878,8 +1878,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.double.[buf.validate.conformance.cases.double_abs_range_edition_2023]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.double.[buf.validate.conformance.cases.double_abs_range_edition_2023]"), ConstraintId: proto.String("double.abs_range.edition_2023"), Message: proto.String("double value is out of range"), }, @@ -1897,8 +1897,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.int32.[buf.validate.conformance.cases.int32_abs_in_edition_2023]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.int32.[buf.validate.conformance.cases.int32_abs_in_edition_2023]"), ConstraintId: proto.String("int32.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1916,8 +1916,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.int64.[buf.validate.conformance.cases.int64_abs_in_edition_2023]"), ConstraintId: proto.String("int64.abs_in.edition_2023"), Message: proto.String("value must be in absolute value of list"), }, @@ -1935,8 +1935,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.uint32.[buf.validate.conformance.cases.uint32_even_edition_2023]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.uint32.[buf.validate.conformance.cases.uint32_even_edition_2023]"), ConstraintId: proto.String("uint32.even.edition_2023"), Message: proto.String("uint32 value is not even"), }, @@ -1954,8 +1954,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.uint64.[buf.validate.conformance.cases.uint64_even_edition_2023]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.uint64.[buf.validate.conformance.cases.uint64_even_edition_2023]"), ConstraintId: proto.String("uint64.even.edition_2023"), Message: proto.String("uint64 value is not even"), }, @@ -1973,8 +1973,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.bool.[buf.validate.conformance.cases.bool_false_edition_2023]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.bool.[buf.validate.conformance.cases.bool_false_edition_2023]"), ConstraintId: proto.String("bool.false.edition_2023"), Message: proto.String("bool value is not false"), }, @@ -1992,8 +1992,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.string.[buf.validate.conformance.cases.string_valid_path_edition_2023]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.string.[buf.validate.conformance.cases.string_valid_path_edition_2023]"), ConstraintId: proto.String("string.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -2011,8 +2011,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.bytes.[buf.validate.conformance.cases.bytes_valid_path_edition_2023]"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.bytes.[buf.validate.conformance.cases.bytes_valid_path_edition_2023]"), ConstraintId: proto.String("bytes.valid_path.edition_2023"), Message: proto.String("not a valid path: `../invalid/path`"), }, @@ -2036,29 +2036,29 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, &validate.Violation{ - FieldPath: proto.String("b.c"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), + Field: results.FieldPath("b.c"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, &validate.Violation{ - FieldPath: proto.String("b"), + Field: results.FieldPath("b"), ConstraintId: proto.String("predefined_and_custom_rule_embedded_edition_2023"), Message: proto.String("b.c must be a multiple of 3"), }, &validate.Violation{ - FieldPath: proto.String("b.c"), + Field: results.FieldPath("b.c"), ConstraintId: proto.String("predefined_and_custom_rule_nested_edition_2023"), Message: proto.String("c must be positive"), }, &validate.Violation{ - FieldPath: proto.String("a"), + Field: results.FieldPath("a"), ConstraintId: proto.String("predefined_and_custom_rule_scalar_edition_2023"), Message: proto.String("a must be greater than 24"), }, @@ -2076,8 +2076,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("sint32.lt"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("sint32.lt"), ConstraintId: proto.String("sint32.lt"), Message: proto.String("value must be less than 28"), }, @@ -2089,8 +2089,8 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("sint32.[buf.validate.conformance.cases.sint32_even_edition_2023]"), ConstraintId: proto.String("sint32.even.edition_2023"), Message: proto.String("sint32 value is not even"), }, @@ -2102,7 +2102,7 @@ func predefinedSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), + Field: results.FieldPath("a"), ConstraintId: proto.String("standard_predefined_and_custom_rule_scalar_edition_2023"), Message: proto.String("a must be greater than 24"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_repeated.go b/tools/protovalidate-conformance/internal/cases/cases_repeated.go index b76104de..ff7aa14d 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_repeated.go +++ b/tools/protovalidate-conformance/internal/cases/cases_repeated.go @@ -47,8 +47,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedEmbedNone{Val: []*cases.Embed{{Val: -1}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0].val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val[0].val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }, @@ -70,8 +70,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedEmbedCrossPackageNone{Val: []*other_package.Embed{{Val: -1}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0].val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val[0].val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }, @@ -89,8 +89,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedMin{Val: []*cases.Embed{{Val: 1}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), Message: proto.String("value must contain at least 2 item(s)"), }, @@ -100,8 +100,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedMin{Val: []*cases.Embed{{Val: 1}, {Val: -1}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1].val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val[1].val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }, @@ -119,8 +119,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedMax{Val: []float64{1, 2, 3, 4}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.max_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.max_items"), ConstraintId: proto.String("repeated.max_items"), Message: proto.String("value must contain no more than 3 item(s)"), }, @@ -142,8 +142,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedMinMax{Val: []int32{}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), Message: proto.String("value must contain at least 2 item(s)"), }, @@ -153,8 +153,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedMinMax{Val: []int32{1, 2, 3, 4, 5}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.max_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.max_items"), ConstraintId: proto.String("repeated.max_items"), Message: proto.String("value must contain no more than 4 item(s)"), }, @@ -168,8 +168,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedExact{Val: []uint32{1, 2}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), Message: proto.String("value must contain at least 3 item(s)"), }, @@ -179,8 +179,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedExact{Val: []uint32{1, 2, 3, 4}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.max_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.max_items"), ConstraintId: proto.String("repeated.max_items"), Message: proto.String("value must contain no more than 3 item(s)"), }, @@ -202,8 +202,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedUnique{Val: []string{"foo", "bar", "foo", "baz"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.unique"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.unique"), ConstraintId: proto.String("repeated.unique"), }, ), @@ -220,14 +220,14 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedMultipleUnique{A: []string{"foo", "foo"}, B: []int32{1, 1}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("repeated.unique"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("repeated.unique"), ConstraintId: proto.String("repeated.unique"), Message: proto.String("repeated value must contain unique items"), }, &validate.Violation{ - FieldPath: proto.String("b"), - RulePath: proto.String("repeated.unique"), + Field: results.FieldPath("b"), + Rule: results.FieldPath("repeated.unique"), ConstraintId: proto.String("repeated.unique"), Message: proto.String("repeated value must contain unique items"), }), @@ -248,8 +248,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedItemRule{Val: []float32{1, -2, 3}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.float.gt"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.float.gt"), ConstraintId: proto.String("float.gt"), Message: proto.String("value must be greater than 0"), }, @@ -259,8 +259,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedItemPattern{Val: []string{"Alpha", "!@#$%^&*()"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[1]"), - RulePath: proto.String("repeated.items.string.pattern"), + Field: results.FieldPath("val[1]"), + Rule: results.FieldPath("repeated.items.string.pattern"), ConstraintId: proto.String("string.pattern"), Message: proto.String("value does not match regex pattern `(?i)^[a-z0-9]+$`"), }, @@ -270,8 +270,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedItemIn{Val: []string{"baz"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.string.in"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.string.in"), ConstraintId: proto.String("string.in"), Message: proto.String(`value must be in list ["foo", "bar"]`), }, @@ -285,8 +285,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedItemNotIn{Val: []string{"foo"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.string.not_in"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.string.not_in"), ConstraintId: proto.String("string.not_in"), Message: proto.String("value must not be in list [\"foo\", \"bar\"]"), }, @@ -300,8 +300,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedEnumIn{Val: []cases.AnEnum{1}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.enum.in"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.enum.in"), ConstraintId: proto.String("enum.in"), Message: proto.String("value must be in list [0]"), }, @@ -315,8 +315,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedEnumNotIn{Val: []cases.AnEnum{0}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.enum.not_in"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.enum.not_in"), ConstraintId: proto.String("enum.not_in"), Message: proto.String("value must not be in list [0]"), }, @@ -330,8 +330,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedEmbeddedEnumIn{Val: []cases.RepeatedEmbeddedEnumIn_AnotherInEnum{1}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.enum.in"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.enum.in"), ConstraintId: proto.String("enum.in"), Message: proto.String("value must be in list [0]"), }, @@ -345,8 +345,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedEmbeddedEnumNotIn{Val: []cases.RepeatedEmbeddedEnumNotIn_AnotherNotInEnum{0}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.enum.not_in"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.enum.not_in"), ConstraintId: proto.String("enum.not_in"), Message: proto.String("value must not be in list [0]"), }, @@ -360,8 +360,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedAnyIn{Val: []*anypb.Any{{TypeUrl: "type.googleapis.com/google.protobuf.Timestamp"}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.any.in"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.any.in"), ConstraintId: proto.String("any.in"), Message: proto.String("type URL must be in the allow list"), }, @@ -375,8 +375,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedAnyNotIn{Val: []*anypb.Any{{TypeUrl: "type.googleapis.com/google.protobuf.Timestamp"}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.any.not_in"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.any.not_in"), ConstraintId: proto.String("any.not_in"), Message: proto.String("type URL must not be in the block list"), }, @@ -402,8 +402,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedMinAndItemLen{Val: []string{}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), Message: proto.String("value must contain at least 1 item(s)"), }, @@ -413,8 +413,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedMinAndItemLen{Val: []string{"x"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.string.len"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.string.len"), ConstraintId: proto.String("string.len"), Message: proto.String("value length must be 3 characters"), }, @@ -428,8 +428,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedMinAndMaxItemLen{}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.min_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.min_items"), ConstraintId: proto.String("repeated.min_items"), Message: proto.String("value must contain at least 1 item(s)"), }, @@ -439,8 +439,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedMinAndMaxItemLen{Val: []string{"aaa", "bbb", "ccc", "ddd"}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("repeated.max_items"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("repeated.max_items"), ConstraintId: proto.String("repeated.max_items"), Message: proto.String("value must contain no more than 3 item(s)"), }, @@ -462,8 +462,8 @@ func repeatedSuite() suites.Suite { Message: &cases.RepeatedDuration{Val: []*durationpb.Duration{{Seconds: -1}}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val[0]"), - RulePath: proto.String("repeated.items.duration.gte"), + Field: results.FieldPath("val[0]"), + Rule: results.FieldPath("repeated.items.duration.gte"), ConstraintId: proto.String("duration.gte"), Message: proto.String("value must be greater than or equal to 0.001s"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_required.go b/tools/protovalidate-conformance/internal/cases/cases_required.go index 37cd034a..e1317dc5 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_required.go +++ b/tools/protovalidate-conformance/internal/cases/cases_required.go @@ -35,8 +35,8 @@ func requiredSuite() suites.Suite { "proto2/scalar/optional/unset": suites.Case{ Message: &cases.RequiredProto2ScalarOptional{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -55,8 +55,8 @@ func requiredSuite() suites.Suite { "proto2/scalar/optional_with_default/unset": suites.Case{ Message: &cases.RequiredProto2ScalarOptionalDefault{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -79,8 +79,8 @@ func requiredSuite() suites.Suite { "proto2/message/unset": suites.Case{ Message: &cases.RequiredProto2Message{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -95,16 +95,16 @@ func requiredSuite() suites.Suite { "proto2/oneof/other_member": suites.Case{ Message: &cases.RequiredProto2Oneof{Val: &cases.RequiredProto2Oneof_B{B: "foo"}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("required"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, "proto2/oneof/unset": suites.Case{ Message: &cases.RequiredProto2Oneof{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("required"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -115,8 +115,8 @@ func requiredSuite() suites.Suite { "proto2/repeated/empty": suites.Case{ Message: &cases.RequiredProto2Repeated{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -127,8 +127,8 @@ func requiredSuite() suites.Suite { "proto2/map/empty": suites.Case{ Message: &cases.RequiredProto2Map{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -139,8 +139,8 @@ func requiredSuite() suites.Suite { "proto3/scalar/zero": suites.Case{ Message: &cases.RequiredProto3Scalar{Val: ""}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -155,8 +155,8 @@ func requiredSuite() suites.Suite { "proto3/scalar/optional/unset": suites.Case{ Message: &cases.RequiredProto3OptionalScalar{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -171,8 +171,8 @@ func requiredSuite() suites.Suite { "proto3/message/unset": suites.Case{ Message: &cases.RequiredProto3Message{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -187,16 +187,16 @@ func requiredSuite() suites.Suite { "proto3/oneof/other_member": suites.Case{ Message: &cases.RequiredProto3OneOf{Val: &cases.RequiredProto3OneOf_B{B: "foo"}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("required"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, "proto3/oneof/unset": suites.Case{ Message: &cases.RequiredProto3OneOf{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("required"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -207,8 +207,8 @@ func requiredSuite() suites.Suite { "proto3/repeated/empty": suites.Case{ Message: &cases.RequiredProto3Repeated{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -219,8 +219,8 @@ func requiredSuite() suites.Suite { "proto3/map/empty": suites.Case{ Message: &cases.RequiredProto3Map{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -235,8 +235,8 @@ func requiredSuite() suites.Suite { "proto/2023/scalar/explicit_presence/unset": suites.Case{ Message: &cases.RequiredEditionsScalarExplicitPresence{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -255,8 +255,8 @@ func requiredSuite() suites.Suite { "proto/2023/scalar/explicit_presence_with_default/unset": suites.Case{ Message: &cases.RequiredEditionsScalarExplicitPresenceDefault{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -267,8 +267,8 @@ func requiredSuite() suites.Suite { "proto/2023/scalar/implicit_presence/zero": suites.Case{ Message: &cases.RequiredEditionsScalarImplicitPresence{Val: ""}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -291,8 +291,8 @@ func requiredSuite() suites.Suite { "proto/2023/message/explicit_presence/length_prefixed/unset": suites.Case{ Message: &cases.RequiredEditionsMessageExplicitPresence{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -307,8 +307,8 @@ func requiredSuite() suites.Suite { "proto/2023/message/explicit_presence/delimited/unset": suites.Case{ Message: &cases.RequiredEditionsMessageExplicitPresenceDelimited{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -339,16 +339,16 @@ func requiredSuite() suites.Suite { "proto/2023/oneof/other_member": suites.Case{ Message: &cases.RequiredEditionsOneof{Val: &cases.RequiredEditionsOneof_B{B: "foo"}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("required"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, "proto/2023/oneof/unset": suites.Case{ Message: &cases.RequiredEditionsOneof{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("a"), - RulePath: proto.String("required"), + Field: results.FieldPath("a"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -359,8 +359,8 @@ func requiredSuite() suites.Suite { "proto/2023/repeated/compact/empty": suites.Case{ Message: &cases.RequiredEditionsRepeated{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -371,8 +371,8 @@ func requiredSuite() suites.Suite { "proto/2023/repeated/expanded/empty": suites.Case{ Message: &cases.RequiredEditionsRepeatedExpanded{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -383,8 +383,8 @@ func requiredSuite() suites.Suite { "proto/2023/map/empty": suites.Case{ Message: &cases.RequiredEditionsMap{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_sfixed32.go b/tools/protovalidate-conformance/internal/cases/cases_sfixed32.go index 24fe03df..294b2a4c 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_sfixed32.go +++ b/tools/protovalidate-conformance/internal/cases/cases_sfixed32.go @@ -36,8 +36,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32Const{Val: 2}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.const"), ConstraintId: proto.String("sfixed32.const"), Message: proto.String("value must equal 1"), }, @@ -51,8 +51,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32In{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.in"), ConstraintId: proto.String("sfixed32.in"), Message: proto.String("value must be in list [2, 3]"), }, @@ -66,8 +66,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32NotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.not_in"), ConstraintId: proto.String("sfixed32.not_in"), Message: proto.String("value must not be in list [0]"), }, @@ -81,8 +81,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32LT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.lt"), ConstraintId: proto.String("sfixed32.lt"), Message: proto.String("value must be less than 0"), }, @@ -92,8 +92,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32LT{Val: 1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.lt"), ConstraintId: proto.String("sfixed32.lt"), Message: proto.String("value must be less than 0"), }, @@ -111,8 +111,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32LTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.lte"), ConstraintId: proto.String("sfixed32.lte"), Message: proto.String("value must be less than or equal to 64"), }, @@ -126,8 +126,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32GT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt"), Message: proto.String("value must be greater than 16"), }, @@ -137,8 +137,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32GT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt"), Message: proto.String("value must be greater than 16"), }, @@ -156,8 +156,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32GTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gte"), ConstraintId: proto.String("sfixed32.gte"), Message: proto.String("value must be greater than or equal to 8"), }, @@ -171,8 +171,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32GTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -182,8 +182,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32GTLT{Val: -1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -193,8 +193,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32GTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -204,8 +204,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32GTLT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -223,8 +223,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32ExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -234,8 +234,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32ExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -245,8 +245,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32ExLTGT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gt"), ConstraintId: proto.String("sfixed32.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -268,8 +268,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32GTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gte"), ConstraintId: proto.String("sfixed32.gte_lte"), Message: proto.String("value must be greater than or equal to 128 and less than or equal to 256"), }, @@ -279,8 +279,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32GTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gte"), ConstraintId: proto.String("sfixed32.gte_lte"), Message: proto.String("value must be greater than or equal to 128 and less than or equal to 256"), }, @@ -306,8 +306,8 @@ func sfixed32Suite() suites.Suite { Message: &cases.SFixed32ExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed32.gte"), ConstraintId: proto.String("sfixed32.gte_lte_exclusive"), Message: proto.String("value must be greater than or equal to 256 or less than or equal to 128"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_sfixed64.go b/tools/protovalidate-conformance/internal/cases/cases_sfixed64.go index db769150..7992a1d9 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_sfixed64.go +++ b/tools/protovalidate-conformance/internal/cases/cases_sfixed64.go @@ -36,8 +36,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64Const{Val: 2}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.const"), ConstraintId: proto.String("sfixed64.const"), Message: proto.String("value must equal 1"), }, @@ -51,8 +51,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64In{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.in"), ConstraintId: proto.String("sfixed64.in"), Message: proto.String("value must be in list [2, 3]"), }, @@ -66,8 +66,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64NotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.not_in"), ConstraintId: proto.String("sfixed64.not_in"), Message: proto.String("value must not be in list [0]"), }, @@ -81,8 +81,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64LT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.lt"), ConstraintId: proto.String("sfixed64.lt"), Message: proto.String("value must be less than 0"), }, @@ -92,8 +92,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64LT{Val: 1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.lt"), ConstraintId: proto.String("sfixed64.lt"), Message: proto.String("value must be less than 0"), }, @@ -111,8 +111,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64LTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.lte"), ConstraintId: proto.String("sfixed64.lte"), Message: proto.String("value must be less than or equal to 64"), }, @@ -126,8 +126,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64GT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt"), Message: proto.String("value must be greater than 16"), }, @@ -137,8 +137,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64GT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt"), Message: proto.String("value must be greater than 16"), }, @@ -156,8 +156,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64GTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gte"), ConstraintId: proto.String("sfixed64.gte"), Message: proto.String("value must be greater than or equal to 8"), }, @@ -171,8 +171,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64GTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -182,8 +182,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64GTLT{Val: -1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -193,8 +193,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64GTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -204,8 +204,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64GTLT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt"), Message: proto.String("value must be greater than 0 and less than 10"), }, @@ -223,8 +223,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64ExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -234,8 +234,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64ExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -245,8 +245,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64ExLTGT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gt"), ConstraintId: proto.String("sfixed64.gt_lt_exclusive"), Message: proto.String("value must be greater than 10 or less than 0"), }, @@ -268,8 +268,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64GTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gte"), ConstraintId: proto.String("sfixed64.gte_lte"), Message: proto.String("value must be greater than or equal to 128 and less than or equal to 256"), }, @@ -279,8 +279,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64GTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gte"), ConstraintId: proto.String("sfixed64.gte_lte"), Message: proto.String("value must be greater than or equal to 128 and less than or equal to 256"), }, @@ -306,8 +306,8 @@ func sfixed64Suite() suites.Suite { Message: &cases.SFixed64ExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sfixed64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sfixed64.gte"), ConstraintId: proto.String("sfixed64.gte_lte_exclusive"), Message: proto.String("value must be greater than or equal to 256 or less than or equal to 128"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_sint32.go b/tools/protovalidate-conformance/internal/cases/cases_sint32.go index 284929c1..a8fc6628 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_sint32.go +++ b/tools/protovalidate-conformance/internal/cases/cases_sint32.go @@ -36,8 +36,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32Const{Val: 2}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.const"), ConstraintId: proto.String("sint32.const"), }, ), @@ -50,8 +50,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32In{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.in"), ConstraintId: proto.String("sint32.in"), }, ), @@ -64,8 +64,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32NotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.not_in"), ConstraintId: proto.String("sint32.not_in"), }, ), @@ -78,8 +78,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32LT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.lt"), ConstraintId: proto.String("sint32.lt"), }, ), @@ -88,8 +88,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32LT{Val: 1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.lt"), ConstraintId: proto.String("sint32.lt"), }, ), @@ -106,8 +106,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32LTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.lte"), ConstraintId: proto.String("sint32.lte"), }, ), @@ -120,8 +120,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32GT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gt"), ConstraintId: proto.String("sint32.gt"), }, ), @@ -130,8 +130,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32GT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gt"), ConstraintId: proto.String("sint32.gt"), }, ), @@ -148,8 +148,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32GTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gte"), ConstraintId: proto.String("sint32.gte"), }, ), @@ -162,8 +162,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32GTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gt"), ConstraintId: proto.String("sint32.gt_lt"), }, ), @@ -172,8 +172,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32GTLT{Val: -1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gt"), ConstraintId: proto.String("sint32.gt_lt"), }, ), @@ -182,8 +182,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32GTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gt"), ConstraintId: proto.String("sint32.gt_lt"), }, ), @@ -192,8 +192,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32GTLT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gt"), ConstraintId: proto.String("sint32.gt_lt"), }, ), @@ -210,8 +210,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32ExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gt"), ConstraintId: proto.String("sint32.gt_lt_exclusive"), }, ), @@ -220,8 +220,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32ExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gt"), ConstraintId: proto.String("sint32.gt_lt_exclusive"), }, ), @@ -230,8 +230,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32ExLTGT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gt"), ConstraintId: proto.String("sint32.gt_lt_exclusive"), }, ), @@ -252,8 +252,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32GTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gte"), ConstraintId: proto.String("sint32.gte_lte"), }, ), @@ -262,8 +262,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32GTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gte"), ConstraintId: proto.String("sint32.gte_lte"), }, ), @@ -288,8 +288,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32ExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gte"), ConstraintId: proto.String("sint32.gte_lte_exclusive"), }, ), @@ -306,8 +306,8 @@ func sint32Suite() suites.Suite { Message: &cases.SInt32Ignore{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint32.gte"), ConstraintId: proto.String("sint32.gte_lte"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_sint64.go b/tools/protovalidate-conformance/internal/cases/cases_sint64.go index f4ad9979..9c8ef242 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_sint64.go +++ b/tools/protovalidate-conformance/internal/cases/cases_sint64.go @@ -36,8 +36,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64Const{Val: 2}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.const"), ConstraintId: proto.String("sint64.const"), }, ), @@ -50,8 +50,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64In{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.in"), ConstraintId: proto.String("sint64.in"), }, ), @@ -64,8 +64,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64NotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.not_in"), ConstraintId: proto.String("sint64.not_in"), }, ), @@ -78,8 +78,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64LT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.lt"), ConstraintId: proto.String("sint64.lt"), }, ), @@ -88,8 +88,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64LT{Val: 1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.lt"), ConstraintId: proto.String("sint64.lt"), }, ), @@ -106,8 +106,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64LTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.lte"), ConstraintId: proto.String("sint64.lte"), }, ), @@ -120,8 +120,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64GT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gt"), ConstraintId: proto.String("sint64.gt"), }, ), @@ -130,8 +130,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64GT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gt"), ConstraintId: proto.String("sint64.gt"), }, ), @@ -148,8 +148,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64GTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gte"), ConstraintId: proto.String("sint64.gte"), }, ), @@ -162,8 +162,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64GTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gt"), ConstraintId: proto.String("sint64.gt_lt"), }, ), @@ -172,8 +172,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64GTLT{Val: -1}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gt"), ConstraintId: proto.String("sint64.gt_lt"), }, ), @@ -182,8 +182,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64GTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gt"), ConstraintId: proto.String("sint64.gt_lt"), }, ), @@ -192,8 +192,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64GTLT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gt"), ConstraintId: proto.String("sint64.gt_lt"), }, ), @@ -210,8 +210,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64ExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gt"), ConstraintId: proto.String("sint64.gt_lt_exclusive"), }, ), @@ -220,8 +220,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64ExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gt"), ConstraintId: proto.String("sint64.gt_lt_exclusive"), }, ), @@ -230,8 +230,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64ExLTGT{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gt"), ConstraintId: proto.String("sint64.gt_lt_exclusive"), }, ), @@ -252,8 +252,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64GTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gte"), ConstraintId: proto.String("sint64.gte_lte"), }, ), @@ -262,8 +262,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64GTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gte"), ConstraintId: proto.String("sint64.gte_lte"), }, ), @@ -288,8 +288,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64ExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gte"), ConstraintId: proto.String("sint64.gte_lte_exclusive"), }, ), @@ -306,8 +306,8 @@ func sint64Suite() suites.Suite { Message: &cases.SInt64Ignore{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("sint64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("sint64.gte"), ConstraintId: proto.String("sint64.gte_lte"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_strings.go b/tools/protovalidate-conformance/internal/cases/cases_strings.go index 1c1d23f3..e42438b0 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_strings.go +++ b/tools/protovalidate-conformance/internal/cases/cases_strings.go @@ -36,8 +36,8 @@ func stringSuite() suites.Suite { Message: &cases.StringConst{Val: "bar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.const"), ConstraintId: proto.String("string.const"), }, ), @@ -50,8 +50,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIn{Val: "foo"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.in"), ConstraintId: proto.String("string.in"), }, ), @@ -64,8 +64,8 @@ func stringSuite() suites.Suite { Message: &cases.StringNotIn{Val: "fizz"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.not_in"), ConstraintId: proto.String("string.not_in"), }, ), @@ -86,8 +86,8 @@ func stringSuite() suites.Suite { Message: &cases.StringLen{Val: "fizz"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.len"), ConstraintId: proto.String("string.len"), }, ), @@ -96,8 +96,8 @@ func stringSuite() suites.Suite { Message: &cases.StringLen{Val: "👩🏽‍💻🧑🏾‍💻👨🏼‍💻"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.len"), ConstraintId: proto.String("string.len"), Message: proto.String("value length must be 3 characters"), }), @@ -114,8 +114,8 @@ func stringSuite() suites.Suite { Message: &cases.StringMinLen{Val: "pb"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.min_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.min_len"), ConstraintId: proto.String("string.min_len"), }, ), @@ -132,8 +132,8 @@ func stringSuite() suites.Suite { Message: &cases.StringMaxLen{Val: "validate"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.max_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.max_len"), ConstraintId: proto.String("string.max_len"), }, ), @@ -154,8 +154,8 @@ func stringSuite() suites.Suite { Message: &cases.StringMinMaxLen{Val: "pb"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.min_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.min_len"), ConstraintId: proto.String("string.min_len"), }, ), @@ -164,8 +164,8 @@ func stringSuite() suites.Suite { Message: &cases.StringMinMaxLen{Val: "validate"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.max_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.max_len"), ConstraintId: proto.String("string.max_len"), }, ), @@ -178,8 +178,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEqualMinMaxLen{Val: "validate"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.max_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.max_len"), ConstraintId: proto.String("string.max_len"), }, ), @@ -200,8 +200,8 @@ func stringSuite() suites.Suite { Message: &cases.StringLenBytes{Val: "foo"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.len_bytes"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.len_bytes"), ConstraintId: proto.String("string.len_bytes"), }, ), @@ -218,8 +218,8 @@ func stringSuite() suites.Suite { Message: &cases.StringMinBytes{Val: "foo"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.min_bytes"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.min_bytes"), ConstraintId: proto.String("string.min_bytes"), }, ), @@ -236,8 +236,8 @@ func stringSuite() suites.Suite { Message: &cases.StringMaxBytes{Val: "validation"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.max_bytes"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.max_bytes"), ConstraintId: proto.String("string.max_bytes"), }, ), @@ -258,8 +258,8 @@ func stringSuite() suites.Suite { Message: &cases.StringMinMaxBytes{Val: "pb"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.min_bytes"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.min_bytes"), ConstraintId: proto.String("string.min_bytes"), }, ), @@ -268,8 +268,8 @@ func stringSuite() suites.Suite { Message: &cases.StringMinMaxBytes{Val: "validation"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.max_bytes"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.max_bytes"), ConstraintId: proto.String("string.max_bytes"), }, ), @@ -282,8 +282,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEqualMinMaxBytes{Val: "foo"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.min_bytes"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.min_bytes"), ConstraintId: proto.String("string.min_bytes"), }, ), @@ -296,8 +296,8 @@ func stringSuite() suites.Suite { Message: &cases.StringPattern{Val: "!#@$#$%"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.pattern"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.pattern"), ConstraintId: proto.String("string.pattern"), }, ), @@ -310,8 +310,8 @@ func stringSuite() suites.Suite { Message: &cases.StringPatternEscapes{Val: "invalid"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.pattern"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.pattern"), ConstraintId: proto.String("string.pattern"), }, ), @@ -328,8 +328,8 @@ func stringSuite() suites.Suite { Message: &cases.StringPrefix{Val: "fizz"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.prefix"), ConstraintId: proto.String("string.prefix"), }, ), @@ -354,8 +354,8 @@ func stringSuite() suites.Suite { Message: &cases.StringContains{Val: "fizzbuzz"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.contains"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.contains"), ConstraintId: proto.String("string.contains"), }, ), @@ -368,8 +368,8 @@ func stringSuite() suites.Suite { Message: &cases.StringNotContains{Val: "foobarbaz"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.not_contains"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.not_contains"), ConstraintId: proto.String("string.not_contains"), }, ), @@ -386,8 +386,8 @@ func stringSuite() suites.Suite { Message: &cases.StringSuffix{Val: "bazbarfoo"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.suffix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.suffix"), ConstraintId: proto.String("string.suffix"), }, ), @@ -400,8 +400,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEmail{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email_empty"), }, ), @@ -418,8 +418,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEmail{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email"), }, ), @@ -428,8 +428,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEmail{Val: "x0123456789012345678901234567890123456789012345678901234567890123456789@example.com"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email"), }, ), @@ -438,8 +438,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEmail{Val: "foo@x0123456789012345678901234567890123456789012345678901234567890123456789.com"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email"), }, ), @@ -450,8 +450,8 @@ func stringSuite() suites.Suite { }, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email"), }, ), @@ -460,8 +460,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEmail{Val: "foo@-bar.com"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email"), }, ), @@ -470,8 +470,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEmail{Val: "foo@."}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email"), }, ), @@ -480,8 +480,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEmail{Val: " foo@example.com "}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email"), }, ), @@ -490,8 +490,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEmail{Val: "foo@example.com "}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email"), }, ), @@ -500,8 +500,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEmail{Val: " foo@example.com"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email"), }, ), @@ -510,8 +510,8 @@ func stringSuite() suites.Suite { Message: &cases.StringEmail{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.email"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.email"), ConstraintId: proto.String("string.email"), }, ), @@ -520,8 +520,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostname{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.hostname"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.hostname"), ConstraintId: proto.String("string.hostname_empty"), }, ), @@ -546,8 +546,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostname{Val: "@!#$%^&*&^%$#"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.hostname"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.hostname"), ConstraintId: proto.String("string.hostname"), }, ), @@ -564,8 +564,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostname{Val: "foo_bar.com"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.hostname"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.hostname"), ConstraintId: proto.String("string.hostname"), }, ), @@ -574,8 +574,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostname{Val: "x0123456789012345678901234567890123456789012345678901234567890123456789.com"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.hostname"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.hostname"), ConstraintId: proto.String("string.hostname"), }, ), @@ -584,8 +584,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostname{Val: "foo-bar-.com"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.hostname"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.hostname"), ConstraintId: proto.String("string.hostname"), }, ), @@ -594,8 +594,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostname{Val: "-foo-bar.com"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.hostname"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.hostname"), ConstraintId: proto.String("string.hostname"), }, ), @@ -604,8 +604,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostname{Val: "foo..bar.com"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.hostname"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.hostname"), ConstraintId: proto.String("string.hostname"), }, ), @@ -614,8 +614,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostname{Val: "你好.com"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.hostname"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.hostname"), ConstraintId: proto.String("string.hostname"), }, ), @@ -624,8 +624,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostname{Val: "."}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.hostname"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.hostname"), ConstraintId: proto.String("string.hostname"), }, ), @@ -642,8 +642,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIP{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ip"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ip"), ConstraintId: proto.String("string.ip"), }, ), @@ -660,8 +660,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIP{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ip"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ip"), ConstraintId: proto.String("string.ip_empty"), }, ), @@ -674,8 +674,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4"), ConstraintId: proto.String("string.ipv4_empty"), }, ), @@ -692,8 +692,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4"), ConstraintId: proto.String("string.ipv4"), }, ), @@ -702,8 +702,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4{Val: "256.0.0.0"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4"), ConstraintId: proto.String("string.ipv4"), }, ), @@ -712,8 +712,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4{Val: "3e::99"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4"), ConstraintId: proto.String("string.ipv4"), }, ), @@ -730,8 +730,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6"), ConstraintId: proto.String("string.ipv6_empty"), }, ), @@ -748,8 +748,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6"), ConstraintId: proto.String("string.ipv6"), }, ), @@ -758,8 +758,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6{Val: "ff::fff::0b"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6"), ConstraintId: proto.String("string.ipv6"), }, ), @@ -768,8 +768,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6{Val: "192.168.0.1"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6"), ConstraintId: proto.String("string.ipv6"), }, ), @@ -786,8 +786,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPWithPrefixLen{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ip_with_prefixlen"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ip_with_prefixlen"), ConstraintId: proto.String("string.ip_with_prefixlen"), }, ), @@ -804,8 +804,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPWithPrefixLen{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ip_with_prefixlen"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ip_with_prefixlen"), ConstraintId: proto.String("string.ip_with_prefixlen_empty"), }, ), @@ -818,8 +818,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4WithPrefixLen{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4_with_prefixlen"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4_with_prefixlen"), ConstraintId: proto.String("string.ipv4_with_prefixlen_empty"), }, ), @@ -836,8 +836,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4WithPrefixLen{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4_with_prefixlen"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4_with_prefixlen"), ConstraintId: proto.String("string.ipv4_with_prefixlen"), }, ), @@ -846,8 +846,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4WithPrefixLen{Val: "2001:db8:1::1/64"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4_with_prefixlen"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4_with_prefixlen"), ConstraintId: proto.String("string.ipv4_with_prefixlen"), }, ), @@ -860,8 +860,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6WithPrefixLen{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6_with_prefixlen"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6_with_prefixlen"), ConstraintId: proto.String("string.ipv6_with_prefixlen_empty"), }, ), @@ -878,8 +878,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6WithPrefixLen{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6_with_prefixlen"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6_with_prefixlen"), ConstraintId: proto.String("string.ipv6_with_prefixlen"), }, ), @@ -888,8 +888,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6WithPrefixLen{Val: "192.168.0.1/24"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6_with_prefixlen"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6_with_prefixlen"), ConstraintId: proto.String("string.ipv6_with_prefixlen"), }, ), @@ -906,8 +906,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPPrefix{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ip_prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ip_prefix"), ConstraintId: proto.String("string.ip_prefix_empty"), }, ), @@ -924,8 +924,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPPrefix{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ip_prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ip_prefix"), ConstraintId: proto.String("string.ip_prefix"), }, ), @@ -938,8 +938,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4Prefix{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4_prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4_prefix"), ConstraintId: proto.String("string.ipv4_prefix_empty"), }, ), @@ -956,8 +956,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4Prefix{Val: "192.168.0.1/24"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4_prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4_prefix"), ConstraintId: proto.String("string.ipv4_prefix"), }, ), @@ -966,8 +966,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4Prefix{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4_prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4_prefix"), ConstraintId: proto.String("string.ipv4_prefix"), }, ), @@ -976,8 +976,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv4Prefix{Val: "2001:db8:1::/48"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv4_prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv4_prefix"), ConstraintId: proto.String("string.ipv4_prefix"), }, ), @@ -990,8 +990,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6Prefix{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6_prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6_prefix"), ConstraintId: proto.String("string.ipv6_prefix_empty"), }, ), @@ -1008,8 +1008,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6Prefix{Val: "2001:db8:1::1/48"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6_prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6_prefix"), ConstraintId: proto.String("string.ipv6_prefix"), }, ), @@ -1018,8 +1018,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6Prefix{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6_prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6_prefix"), ConstraintId: proto.String("string.ipv6_prefix"), }, ), @@ -1028,8 +1028,8 @@ func stringSuite() suites.Suite { Message: &cases.StringIPv6Prefix{Val: "192.168.0.0/24"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.ipv6_prefix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.ipv6_prefix"), ConstraintId: proto.String("string.ipv6_prefix"), }, ), @@ -1042,8 +1042,8 @@ func stringSuite() suites.Suite { Message: &cases.StringURI{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.uri"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.uri"), ConstraintId: proto.String("string.uri_empty"), }, ), @@ -1060,8 +1060,8 @@ func stringSuite() suites.Suite { Message: &cases.StringURI{Val: "!@#$%^&*"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.uri"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.uri"), ConstraintId: proto.String("string.uri"), }, ), @@ -1070,8 +1070,8 @@ func stringSuite() suites.Suite { Message: &cases.StringURI{Val: "/foo/bar?baz=quux"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.uri"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.uri"), ConstraintId: proto.String("string.uri"), }, ), @@ -1088,8 +1088,8 @@ func stringSuite() suites.Suite { Message: &cases.StringURIRef{Val: "!@#$%^&*"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.uri_ref"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.uri_ref"), ConstraintId: proto.String("string.uri_ref"), }, ), @@ -1118,8 +1118,8 @@ func stringSuite() suites.Suite { Message: &cases.StringAddress{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.address"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.address"), ConstraintId: proto.String("string.address_empty"), }, ), @@ -1136,8 +1136,8 @@ func stringSuite() suites.Suite { Message: &cases.StringAddress{Val: "-foo.bar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.address"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.address"), ConstraintId: proto.String("string.address"), }, ), @@ -1146,8 +1146,8 @@ func stringSuite() suites.Suite { Message: &cases.StringAddress{Val: "ff::fff::0b"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.address"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.address"), ConstraintId: proto.String("string.address"), }, ), @@ -1200,8 +1200,8 @@ func stringSuite() suites.Suite { Message: &cases.StringUUID{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.uuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.uuid"), ConstraintId: proto.String("string.uuid_empty"), }, ), @@ -1218,8 +1218,8 @@ func stringSuite() suites.Suite { Message: &cases.StringUUID{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.uuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.uuid"), ConstraintId: proto.String("string.uuid"), }, ), @@ -1228,8 +1228,8 @@ func stringSuite() suites.Suite { Message: &cases.StringUUID{Val: "ffffffff-ffff-ffff-ffff-fffffffffffff"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.uuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.uuid"), ConstraintId: proto.String("string.uuid"), }, ), @@ -1238,8 +1238,8 @@ func stringSuite() suites.Suite { Message: &cases.StringUUID{Val: "8B20830500E84460A4405E0DCD83BB0A"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.uuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.uuid"), ConstraintId: proto.String("string.uuid"), }, ), @@ -1248,8 +1248,8 @@ func stringSuite() suites.Suite { Message: &cases.StringUUID{Val: "8b20830500e84460a4405e0dcd83bb0a"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.uuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.uuid"), ConstraintId: proto.String("string.uuid"), }, ), @@ -1302,8 +1302,8 @@ func stringSuite() suites.Suite { Message: &cases.StringTUUID{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.tuuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.tuuid"), ConstraintId: proto.String("string.tuuid_empty"), }, ), @@ -1320,8 +1320,8 @@ func stringSuite() suites.Suite { Message: &cases.StringTUUID{Val: "foobar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.tuuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.tuuid"), ConstraintId: proto.String("string.tuuid"), }, ), @@ -1330,8 +1330,8 @@ func stringSuite() suites.Suite { Message: &cases.StringTUUID{Val: "fffffffffffffffffffffffffffffffff"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.tuuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.tuuid"), ConstraintId: proto.String("string.tuuid"), }, ), @@ -1340,8 +1340,8 @@ func stringSuite() suites.Suite { Message: &cases.StringTUUID{Val: "8B208305-00E8-4460-A440-5E0DCD83BB0A"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.tuuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.tuuid"), ConstraintId: proto.String("string.tuuid"), }, ), @@ -1350,8 +1350,8 @@ func stringSuite() suites.Suite { Message: &cases.StringTUUID{Val: "8b208305-00e8-4460-a440-5e0dcd83bb0a"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.tuuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.tuuid"), ConstraintId: proto.String("string.tuuid"), }, ), @@ -1380,8 +1380,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderName{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name_empty"), }, ), @@ -1390,8 +1390,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderName{Val: ":"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name"), }, ), @@ -1400,8 +1400,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderName{Val: ":foo:"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name"), }, ), @@ -1410,8 +1410,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderName{Val: "foo bar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name"), }, ), @@ -1420,8 +1420,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderName{Val: "foo\rbar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name"), }, ), @@ -1430,8 +1430,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderName{Val: "foo\nbar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name"), }, ), @@ -1440,8 +1440,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderName{Val: "foo\tbar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name"), }, ), @@ -1450,8 +1450,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderName{Val: "foo\000bar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name"), }, ), @@ -1460,8 +1460,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderName{Val: "foo/bar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name"), }, ), @@ -1482,8 +1482,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderNameLoose{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name_empty"), }, ), @@ -1492,8 +1492,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderNameLoose{Val: "foo\rbar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name"), }, ), @@ -1502,8 +1502,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderNameLoose{Val: "foo\nbar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_name"), }, ), @@ -1536,8 +1536,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderValue{Val: "foo\000bar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_value"), }, ), @@ -1546,8 +1546,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderValue{Val: "foo\007bar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_value"), }, ), @@ -1556,8 +1556,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderValue{Val: "foo\rbar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_value"), }, ), @@ -1566,8 +1566,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderValue{Val: "foo\nbar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_value"), }, ), @@ -1580,8 +1580,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderValueLoose{Val: "\000"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_value"), }, ), @@ -1590,8 +1590,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderValueLoose{Val: "foo\rbar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_value"), }, ), @@ -1600,8 +1600,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHttpHeaderValueLoose{Val: "foo\nbar"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.well_known_regex"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.well_known_regex"), ConstraintId: proto.String("string.well_known_regex.header_value"), }, ), @@ -1622,8 +1622,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndPort{Val: ""}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.host_and_port"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.host_and_port"), ConstraintId: proto.String("string.host_and_port_empty"), }, ), @@ -1632,8 +1632,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndPort{Val: "localhost"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.host_and_port"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.host_and_port"), ConstraintId: proto.String("string.host_and_port"), }, ), @@ -1642,8 +1642,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndPort{Val: " localhost:8080 "}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.host_and_port"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.host_and_port"), ConstraintId: proto.String("string.host_and_port"), }, ), @@ -1652,8 +1652,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndPort{Val: "abc#123:456"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.host_and_port"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.host_and_port"), ConstraintId: proto.String("string.host_and_port"), }, ), @@ -1662,8 +1662,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndPort{Val: "123.456.789.100:8080"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.host_and_port"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.host_and_port"), ConstraintId: proto.String("string.host_and_port"), }, ), @@ -1672,8 +1672,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndPort{Val: "[1::jk::3]:8080"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.host_and_port"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.host_and_port"), ConstraintId: proto.String("string.host_and_port"), }, ), @@ -1682,8 +1682,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndPort{Val: "::1:8080"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.host_and_port"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.host_and_port"), ConstraintId: proto.String("string.host_and_port"), }, ), @@ -1692,8 +1692,8 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndPort{Val: "localhost:99999"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.host_and_port"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.host_and_port"), ConstraintId: proto.String("string.host_and_port"), }, ), @@ -1726,7 +1726,7 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndOptionalPort{Val: "abc#123"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("string.host_and_port.optional_port"), }, ), @@ -1735,7 +1735,7 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndOptionalPort{Val: "123.456.789.100"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("string.host_and_port.optional_port"), }, ), @@ -1744,7 +1744,7 @@ func stringSuite() suites.Suite { Message: &cases.StringHostAndOptionalPort{Val: "[1::jk::3]"}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), + Field: results.FieldPath("val"), ConstraintId: proto.String("string.host_and_port.optional_port"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_timestamp.go b/tools/protovalidate-conformance/internal/cases/cases_timestamp.go index 4289525e..40d83135 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_timestamp.go +++ b/tools/protovalidate-conformance/internal/cases/cases_timestamp.go @@ -38,8 +38,8 @@ func timestampSuite() suites.Suite { "required/invalid": { Message: &cases.TimestampRequired{Val: nil}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), }), }, @@ -54,8 +54,8 @@ func timestampSuite() suites.Suite { "const/invalid": { Message: &cases.TimestampConst{Val: ×tamppb.Timestamp{Nanos: 3}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.const"), ConstraintId: proto.String("timestamp.const"), }), }, @@ -70,16 +70,16 @@ func timestampSuite() suites.Suite { "lt/invalid/equal": { Message: &cases.TimestampLT{Val: ×tamppb.Timestamp{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.lt"), ConstraintId: proto.String("timestamp.lt"), }), }, "lt/invalid": { Message: &cases.TimestampLT{Val: ×tamppb.Timestamp{Seconds: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.lt"), ConstraintId: proto.String("timestamp.lt"), }), }, @@ -98,8 +98,8 @@ func timestampSuite() suites.Suite { "lte/invalid": { Message: &cases.TimestampLTE{Val: ×tamppb.Timestamp{Seconds: 1, Nanos: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.lte"), ConstraintId: proto.String("timestamp.lte"), }), }, @@ -114,16 +114,16 @@ func timestampSuite() suites.Suite { "gt/invalid/equal": { Message: &cases.TimestampGT{Val: ×tamppb.Timestamp{Nanos: 1000}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt"), ConstraintId: proto.String("timestamp.gt"), }), }, "gt/invalid": { Message: &cases.TimestampGT{Val: ×tamppb.Timestamp{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt"), ConstraintId: proto.String("timestamp.gt"), }), }, @@ -142,8 +142,8 @@ func timestampSuite() suites.Suite { "gte/invalid": { Message: &cases.TimestampGTE{Val: ×tamppb.Timestamp{Seconds: -1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gte"), ConstraintId: proto.String("timestamp.gte"), }), }, @@ -158,32 +158,32 @@ func timestampSuite() suites.Suite { "gt_lt/invalid/above": { Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{Seconds: 1000}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt"), ConstraintId: proto.String("timestamp.gt_lt"), }), }, "gt_lt/invalid/below": { Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{Seconds: -1000}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt"), ConstraintId: proto.String("timestamp.gt_lt"), }), }, "gt_lt/invalid/max": { Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{Seconds: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt"), ConstraintId: proto.String("timestamp.gt_lt"), }), }, "gt_lt/invalid/min": { Message: &cases.TimestampGTLT{Val: ×tamppb.Timestamp{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt"), ConstraintId: proto.String("timestamp.gt_lt"), }), }, @@ -202,24 +202,24 @@ func timestampSuite() suites.Suite { "exclusive/gt_lt/invalid": { Message: &cases.TimestampExLTGT{Val: ×tamppb.Timestamp{Nanos: 1000}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt"), ConstraintId: proto.String("timestamp.gt_lt_exclusive"), }), }, "exclusive/gt_lt/invalid/max": { Message: &cases.TimestampExLTGT{Val: ×tamppb.Timestamp{Seconds: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt"), ConstraintId: proto.String("timestamp.gt_lt_exclusive"), }), }, "exclusive/gt_lt/invalid/min": { Message: &cases.TimestampExLTGT{Val: ×tamppb.Timestamp{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt"), ConstraintId: proto.String("timestamp.gt_lt_exclusive"), }), }, @@ -242,16 +242,16 @@ func timestampSuite() suites.Suite { "gte_lte/invalid/above": { Message: &cases.TimestampGTELTE{Val: ×tamppb.Timestamp{Seconds: 3600, Nanos: 1}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gte"), ConstraintId: proto.String("timestamp.gte_lte"), }), }, "gte_lte/invalid/below": { Message: &cases.TimestampGTELTE{Val: ×tamppb.Timestamp{Seconds: 59}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gte"), ConstraintId: proto.String("timestamp.gte_lte"), }), }, @@ -278,8 +278,8 @@ func timestampSuite() suites.Suite { "exclusive/gte_lte/invalid": { Message: &cases.TimestampExGTELTE{Val: ×tamppb.Timestamp{Seconds: 61}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gte"), ConstraintId: proto.String("timestamp.gte_lte_exclusive"), }), }, @@ -294,8 +294,8 @@ func timestampSuite() suites.Suite { "lt_now/invalid": { Message: &cases.TimestampLTNow{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 7200}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.lt_now"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.lt_now"), ConstraintId: proto.String("timestamp.lt_now"), }), }, @@ -314,8 +314,8 @@ func timestampSuite() suites.Suite { "gt_now/invalid": { Message: &cases.TimestampGTNow{Val: ×tamppb.Timestamp{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt_now"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt_now"), ConstraintId: proto.String("timestamp.gt_now"), }), }, @@ -334,16 +334,16 @@ func timestampSuite() suites.Suite { "within/invalid/below": { Message: &cases.TimestampWithin{Val: ×tamppb.Timestamp{}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.within"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.within"), ConstraintId: proto.String("timestamp.within"), }), }, "within/invalid/above": { Message: &cases.TimestampWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 7200}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.within"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.within"), ConstraintId: proto.String("timestamp.within"), }), }, @@ -359,16 +359,16 @@ func timestampSuite() suites.Suite { Message: &cases.TimestampLTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 1800}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.lt_now"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.lt_now"), ConstraintId: proto.String("timestamp.lt_now"), }), }, "lt_now/within/invalid/within": { Message: &cases.TimestampLTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() / 7200}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.within"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.within"), ConstraintId: proto.String("timestamp.within"), }), }, @@ -384,20 +384,20 @@ func timestampSuite() suites.Suite { Message: &cases.TimestampGTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() / 1800}}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.gt_now"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.gt_now"), ConstraintId: proto.String("timestamp.gt_now")}, &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.within"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.within"), ConstraintId: proto.String("timestamp.within")}, ), }, "gt_now/within/invalid/within": { Message: &cases.TimestampGTNowWithin{Val: ×tamppb.Timestamp{Seconds: time.Now().Unix() + 7200}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("timestamp.within"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("timestamp.within"), ConstraintId: proto.String("timestamp.within"), }), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_uint32.go b/tools/protovalidate-conformance/internal/cases/cases_uint32.go index 87341358..3ec2b8b6 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_uint32.go +++ b/tools/protovalidate-conformance/internal/cases/cases_uint32.go @@ -36,8 +36,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32Const{Val: 2}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.const"), ConstraintId: proto.String("uint32.const"), }, ), @@ -50,8 +50,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32In{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.in"), ConstraintId: proto.String("uint32.in"), }, ), @@ -64,8 +64,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32NotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.not_in"), ConstraintId: proto.String("uint32.not_in"), }, ), @@ -78,8 +78,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32LT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.lt"), ConstraintId: proto.String("uint32.lt"), }, ), @@ -88,8 +88,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32LT{Val: 6}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.lt"), ConstraintId: proto.String("uint32.lt"), }, ), @@ -106,8 +106,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32LTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.lte"), ConstraintId: proto.String("uint32.lte"), }, ), @@ -120,8 +120,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32GT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gt"), ConstraintId: proto.String("uint32.gt"), }, ), @@ -130,8 +130,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32GT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gt"), ConstraintId: proto.String("uint32.gt"), }, ), @@ -148,8 +148,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32GTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gte"), ConstraintId: proto.String("uint32.gte"), }, ), @@ -162,8 +162,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32GTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gt"), ConstraintId: proto.String("uint32.gt_lt"), }, ), @@ -172,8 +172,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32GTLT{Val: 4}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gt"), ConstraintId: proto.String("uint32.gt_lt"), }, ), @@ -182,8 +182,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32GTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gt"), ConstraintId: proto.String("uint32.gt_lt"), }, ), @@ -192,8 +192,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32GTLT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gt"), ConstraintId: proto.String("uint32.gt_lt"), }, ), @@ -210,8 +210,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32ExLTGT{Val: 6}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gt"), ConstraintId: proto.String("uint32.gt_lt_exclusive"), }, ), @@ -220,8 +220,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32ExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gt"), ConstraintId: proto.String("uint32.gt_lt_exclusive"), }, ), @@ -230,8 +230,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32ExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gt"), ConstraintId: proto.String("uint32.gt_lt_exclusive"), }, ), @@ -252,8 +252,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32GTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gte"), ConstraintId: proto.String("uint32.gte_lte"), }, ), @@ -262,8 +262,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32GTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gte"), ConstraintId: proto.String("uint32.gte_lte"), }, ), @@ -288,8 +288,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32ExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gte"), ConstraintId: proto.String("uint32.gte_lte_exclusive"), }, ), @@ -306,8 +306,8 @@ func uint32Suite() suites.Suite { Message: &cases.UInt32Ignore{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gte"), ConstraintId: proto.String("uint32.gte_lte"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_uint64.go b/tools/protovalidate-conformance/internal/cases/cases_uint64.go index 1d529b7b..ddaada06 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_uint64.go +++ b/tools/protovalidate-conformance/internal/cases/cases_uint64.go @@ -36,8 +36,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64Const{Val: 2}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.const"), ConstraintId: proto.String("uint64.const"), }, ), @@ -50,8 +50,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64In{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.in"), ConstraintId: proto.String("uint64.in"), }, ), @@ -64,8 +64,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64NotIn{Val: 0}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.not_in"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.not_in"), ConstraintId: proto.String("uint64.not_in"), }, ), @@ -78,8 +78,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64LT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.lt"), ConstraintId: proto.String("uint64.lt"), }, ), @@ -88,8 +88,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64LT{Val: 6}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.lt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.lt"), ConstraintId: proto.String("uint64.lt"), }, ), @@ -106,8 +106,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64LTE{Val: 65}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.lte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.lte"), ConstraintId: proto.String("uint64.lte"), }, ), @@ -120,8 +120,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64GT{Val: 16}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gt"), ConstraintId: proto.String("uint64.gt"), }, ), @@ -130,8 +130,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64GT{Val: 15}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gt"), ConstraintId: proto.String("uint64.gt"), }, ), @@ -148,8 +148,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64GTE{Val: 7}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gte"), ConstraintId: proto.String("uint64.gte"), }, ), @@ -162,8 +162,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64GTLT{Val: 11}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gt"), ConstraintId: proto.String("uint64.gt_lt"), }, ), @@ -172,8 +172,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64GTLT{Val: 4}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gt"), ConstraintId: proto.String("uint64.gt_lt"), }, ), @@ -182,8 +182,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64GTLT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gt"), ConstraintId: proto.String("uint64.gt_lt"), }, ), @@ -192,8 +192,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64GTLT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gt"), ConstraintId: proto.String("uint64.gt_lt"), }, ), @@ -210,8 +210,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64ExLTGT{Val: 6}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gt"), ConstraintId: proto.String("uint64.gt_lt_exclusive"), }, ), @@ -220,8 +220,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64ExLTGT{Val: 10}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gt"), ConstraintId: proto.String("uint64.gt_lt_exclusive"), }, ), @@ -230,8 +230,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64ExLTGT{Val: 5}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gt"), ConstraintId: proto.String("uint64.gt_lt_exclusive"), }, ), @@ -252,8 +252,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64GTELTE{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gte"), ConstraintId: proto.String("uint64.gte_lte"), }, ), @@ -262,8 +262,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64GTELTE{Val: 100}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gte"), ConstraintId: proto.String("uint64.gte_lte"), }, ), @@ -288,8 +288,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64ExGTELTE{Val: 200}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gte"), ConstraintId: proto.String("uint64.gte_lte_exclusive"), }, ), @@ -306,8 +306,8 @@ func uint64Suite() suites.Suite { Message: &cases.UInt64Ignore{Val: 300}, Expected: results.Violations( &validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gte"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gte"), ConstraintId: proto.String("uint64.gte_lte"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_wrapper.go b/tools/protovalidate-conformance/internal/cases/cases_wrapper.go index fb1c8a46..a1accef2 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_wrapper.go +++ b/tools/protovalidate-conformance/internal/cases/cases_wrapper.go @@ -44,8 +44,8 @@ func wrapperSuite() suites.Suite { "float/invalid": { Message: &cases.WrapperFloat{Val: &wrapperspb.FloatValue{Value: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt"), Message: proto.String("value must be greater than 0"), }), @@ -61,8 +61,8 @@ func wrapperSuite() suites.Suite { "double/invalid": { Message: &cases.WrapperDouble{Val: &wrapperspb.DoubleValue{Value: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("double.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("double.gt"), ConstraintId: proto.String("double.gt"), Message: proto.String("value must be greater than 0"), }), @@ -78,8 +78,8 @@ func wrapperSuite() suites.Suite { "int64/invalid": { Message: &cases.WrapperInt64{Val: &wrapperspb.Int64Value{Value: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int64.gt"), ConstraintId: proto.String("int64.gt"), Message: proto.String("value must be greater than 0"), }), @@ -95,8 +95,8 @@ func wrapperSuite() suites.Suite { "int32/invalid": { Message: &cases.WrapperInt32{Val: &wrapperspb.Int32Value{Value: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("int32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("int32.gt"), ConstraintId: proto.String("int32.gt"), Message: proto.String("value must be greater than 0"), }), @@ -112,8 +112,8 @@ func wrapperSuite() suites.Suite { "uint64/invalid": { Message: &cases.WrapperUInt64{Val: &wrapperspb.UInt64Value{Value: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint64.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint64.gt"), ConstraintId: proto.String("uint64.gt"), Message: proto.String("value must be greater than 0"), }), @@ -129,8 +129,8 @@ func wrapperSuite() suites.Suite { "uint32/invalid": { Message: &cases.WrapperUInt32{Val: &wrapperspb.UInt32Value{Value: 0}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("uint32.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("uint32.gt"), ConstraintId: proto.String("uint32.gt"), Message: proto.String("value must be greater than 0"), }), @@ -146,8 +146,8 @@ func wrapperSuite() suites.Suite { "bool/invalid": { Message: &cases.WrapperBool{Val: &wrapperspb.BoolValue{Value: false}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bool.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bool.const"), ConstraintId: proto.String("bool.const"), Message: proto.String("value must equal true"), }), @@ -163,8 +163,8 @@ func wrapperSuite() suites.Suite { "string/invalid": { Message: &cases.WrapperString{Val: &wrapperspb.StringValue{Value: "fizzbuzz"}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.suffix"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.suffix"), ConstraintId: proto.String("string.suffix"), Message: proto.String("value does not have suffix `bar`"), }), @@ -180,8 +180,8 @@ func wrapperSuite() suites.Suite { "bytes/invalid": { Message: &cases.WrapperBytes{Val: &wrapperspb.BytesValue{Value: []byte("x")}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("bytes.min_len"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("bytes.min_len"), ConstraintId: proto.String("bytes.min_len"), Message: proto.String("value length must be at least 3 bytes"), }), @@ -193,8 +193,8 @@ func wrapperSuite() suites.Suite { "required/string/invalid": { Message: &cases.WrapperRequiredString{Val: &wrapperspb.StringValue{Value: "foo"}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal `bar`"), }), @@ -202,8 +202,8 @@ func wrapperSuite() suites.Suite { "required/string/empty/invalid": { Message: &cases.WrapperRequiredString{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }), @@ -215,15 +215,15 @@ func wrapperSuite() suites.Suite { "required/empty/string/invalid": { Message: &cases.WrapperRequiredEmptyString{Val: &wrapperspb.StringValue{Value: "foo"}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.const"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.const"), ConstraintId: proto.String("string.const"), Message: proto.String("value must equal ``"), }), }, "required/empty/string/empty/invalid": { Message: &cases.WrapperRequiredEmptyString{}, - Expected: results.Violations(&validate.Violation{FieldPath: proto.String("val"), RulePath: proto.String("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required")}), + Expected: results.Violations(&validate.Violation{Field: results.FieldPath("val"), Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required")}), }, "optional/string/uuid/valid": { Message: &cases.WrapperOptionalUuidString{Val: &wrapperspb.StringValue{Value: "8b72987b-024a-43b3-b4cf-647a1f925c5d"}}, @@ -236,8 +236,8 @@ func wrapperSuite() suites.Suite { "optional/string/uuid/invalid": { Message: &cases.WrapperOptionalUuidString{Val: &wrapperspb.StringValue{Value: "foo"}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("string.uuid"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("string.uuid"), ConstraintId: proto.String("string.uuid"), Message: proto.String("value must be a valid UUID"), }), @@ -249,8 +249,8 @@ func wrapperSuite() suites.Suite { "required/float/invalid": { Message: &cases.WrapperRequiredFloat{Val: &wrapperspb.FloatValue{Value: -5}}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("float.gt"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("float.gt"), ConstraintId: proto.String("float.gt"), Message: proto.String("value must be greater than 0"), }), @@ -258,8 +258,8 @@ func wrapperSuite() suites.Suite { "required/float/empty/invalid": { Message: &cases.WrapperRequiredFloat{}, Expected: results.Violations(&validate.Violation{ - FieldPath: proto.String("val"), - RulePath: proto.String("required"), + Field: results.FieldPath("val"), + Rule: results.FieldPath("required"), ConstraintId: proto.String("required"), Message: proto.String("value is required"), }), diff --git a/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go b/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go new file mode 100644 index 00000000..5a4e64f0 --- /dev/null +++ b/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go @@ -0,0 +1,268 @@ +// Copyright 2023 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package fieldpath + +import ( + "errors" + "fmt" + "strconv" + "strings" + + "github.com/bufbuild/protovalidate/tools/internal/gen/buf/validate" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/types/descriptorpb" +) + +// Marshal takes a FieldPath and encodes it to a string-based dotted field path. +func Marshal(path *validate.FieldPath) string { + var result strings.Builder + if path == nil { + return "" + } + for i, element := range path.GetElements() { + if i > 0 { + result.WriteByte('.') + } + result.WriteString(element.GetFieldName()) + subscript := element.GetSubscript() + if subscript == nil { + continue + } + result.WriteByte('[') + switch value := subscript.(type) { + case *validate.FieldPathElement_Index: + result.WriteString(strconv.FormatUint(value.Index, 10)) + case *validate.FieldPathElement_BoolKey: + result.WriteString(strconv.FormatBool(value.BoolKey)) + case *validate.FieldPathElement_IntKey: + result.WriteString(strconv.FormatInt(value.IntKey, 10)) + case *validate.FieldPathElement_SintKey: + result.WriteString(strconv.FormatInt(value.SintKey, 10)) + case *validate.FieldPathElement_UintKey: + result.WriteString(strconv.FormatUint(value.UintKey, 10)) + case *validate.FieldPathElement_StringKey: + result.WriteString(strconv.Quote(value.StringKey)) + } + result.WriteByte(']') + } + return result.String() +} + +// Unmarshal parses a string-based dotted field path to a FieldPath. +func Unmarshal( + message protoreflect.MessageDescriptor, + path string, +) (*validate.FieldPath, error) { + var name, subscript string + var atEnd, isExt bool + var err error + result := &validate.FieldPath{} + for !atEnd { + name, subscript, path, atEnd, isExt = parsePathElement(path) + if name == "" { + return nil, errors.New("empty field name") + } + var descriptor protoreflect.FieldDescriptor + var oneOf protoreflect.OneofDescriptor + if isExt { + extension, err := protoregistry.GlobalTypes.FindExtensionByName(protoreflect.FullName(name)) + if err != nil { + return nil, fmt.Errorf("resolving extension: %w", err) + } + descriptor = extension.TypeDescriptor() + } else { + descriptor = message.Fields().ByTextName(name) + oneOf = message.Oneofs().ByName(protoreflect.Name(name)) + } + var element *validate.FieldPathElement + switch { + case descriptor != nil: + element = &validate.FieldPathElement{ + FieldNumber: proto.Int32(int32(descriptor.Number())), + FieldName: proto.String(descriptor.TextName()), + FieldType: descriptorpb.FieldDescriptorProto_Type(descriptor.Kind()).Enum(), + } + case oneOf != nil: + element = &validate.FieldPathElement{ + FieldName: proto.String(string(oneOf.Name())), + } + result.Elements = append(result.Elements, element) + continue + default: + return nil, fmt.Errorf("field %s not found", name) + } + result.Elements = append(result.Elements, element) + if subscript != "" { + descriptor, err = parseSubscript(descriptor, subscript, name, element) + if err != nil { + return nil, err + } + } else if descriptor.IsList() || descriptor.IsMap() { + if atEnd { + break + } + return nil, fmt.Errorf("missing subscript on field %s", name) + } + if descriptor.Message() != nil { + message = descriptor.Message() + } + } + return result, nil +} + +func parseSubscript( + descriptor protoreflect.FieldDescriptor, + subscript string, + name string, + element *validate.FieldPathElement, +) (protoreflect.FieldDescriptor, error) { + switch { + case descriptor.IsList(): + i, err := strconv.Atoi(subscript) + if err != nil { + return nil, fmt.Errorf("invalid list index: %s", subscript) + } + element.Subscript = &validate.FieldPathElement_Index{Index: uint64(i)} + case descriptor.IsMap(): + if err := parseMapKey(descriptor, subscript, element); err != nil { + return nil, err + } + descriptor = descriptor.MapValue() + default: + return nil, fmt.Errorf("unexpected subscript on field %s", name) + } + return descriptor, nil +} + +func parseMapKey( + mapDescriptor protoreflect.FieldDescriptor, + subscript string, + element *validate.FieldPathElement, +) error { + switch mapDescriptor.MapKey().Kind() { + case protoreflect.BoolKind: + if boolValue, err := strconv.ParseBool(subscript); err == nil { + element.Subscript = &validate.FieldPathElement_BoolKey{BoolKey: boolValue} + return nil + } + case protoreflect.Sint32Kind: + if intValue, err := strconv.ParseInt(subscript, 10, 32); err == nil { + element.Subscript = &validate.FieldPathElement_SintKey{SintKey: intValue} + return nil + } + case protoreflect.Sint64Kind: + if intValue, err := strconv.ParseInt(subscript, 10, 64); err == nil { + element.Subscript = &validate.FieldPathElement_SintKey{SintKey: intValue} + return nil + } + case protoreflect.Int32Kind, protoreflect.Sfixed32Kind: + if intValue, err := strconv.ParseInt(subscript, 10, 32); err == nil { + element.Subscript = &validate.FieldPathElement_IntKey{IntKey: intValue} + return nil + } + case protoreflect.Int64Kind, protoreflect.Sfixed64Kind: + if intValue, err := strconv.ParseInt(subscript, 10, 64); err == nil { + element.Subscript = &validate.FieldPathElement_IntKey{IntKey: intValue} + return nil + } + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + if intValue, err := strconv.ParseUint(subscript, 10, 32); err == nil { + element.Subscript = &validate.FieldPathElement_UintKey{UintKey: intValue} + return nil + } + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + if intValue, err := strconv.ParseUint(subscript, 10, 64); err == nil { + element.Subscript = &validate.FieldPathElement_UintKey{UintKey: intValue} + return nil + } + case protoreflect.StringKind: + if stringValue, err := strconv.Unquote(subscript); err == nil { + element.Subscript = &validate.FieldPathElement_StringKey{StringKey: stringValue} + return nil + } + case protoreflect.EnumKind, protoreflect.FloatKind, protoreflect.DoubleKind, + protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind: + fallthrough + default: + // This should not occur, but it might if the rules are relaxed in the + // future. + return fmt.Errorf("unsupported map key type: %s", mapDescriptor.MapKey().Kind()) + } + return fmt.Errorf("invalid map key: %s", subscript) +} + +// parsePathElement parses a single path element. +func parsePathElement(path string) (name, subscript, rest string, atEnd bool, isExt bool) { + // Scan extension name. + if len(path) > 0 && path[0] == '[' { + if i := strings.IndexByte(path, ']'); i >= 0 { + isExt = true + name, path = path[1:i], path[i+1:] + } + } + // Scan field name. + if !isExt { + if i := strings.IndexAny(path, ".["); i >= 0 { + name, path = path[:i], path[i:] + } else { + name, path = path, "" + } + } + // No subscript: At end of path. + if len(path) == 0 { + return name, "", path, true, isExt + } + // No subscript: At end of path element. + if path[0] == '.' { + return name, "", path[1:], false, isExt + } + // Malformed subscript + if len(path) == 1 || path[1] == '.' { + name, path = name+path[:1], path[1:] + return name, "", path, true, isExt + } + switch path[1] { + case ']': + // Empty subscript + name, path = name+path[:2], path[2:] + case '`', '"', '\'': + // String subscript: must scan string. + var err error + subscript, err = strconv.QuotedPrefix(path[1:]) + if err == nil { + path = path[len(subscript)+2:] + } + default: + // Other subscript; can skip to next ] + if i := strings.IndexByte(path, ']'); i >= 0 { + subscript, path = path[1:i], path[i+1:] + } else { + // Unterminated subscript + return name + path, "", "", true, isExt + } + } + // No subscript: At end of path. + if len(path) == 0 { + return name, subscript, path, true, isExt + } + // No subscript: At end of path element. + if path[0] == '.' { + return name, subscript, path[1:], false, isExt + } + // Malformed element + return name, subscript, path, false, isExt +} diff --git a/tools/protovalidate-conformance/internal/results/result.go b/tools/protovalidate-conformance/internal/results/result.go index dfc5a055..fb77d250 100644 --- a/tools/protovalidate-conformance/internal/results/result.go +++ b/tools/protovalidate-conformance/internal/results/result.go @@ -17,11 +17,16 @@ package results import ( "cmp" "fmt" + "log" "slices" "strings" "github.com/bufbuild/protovalidate/tools/internal/gen/buf/validate" "github.com/bufbuild/protovalidate/tools/internal/gen/buf/validate/conformance/harness" + "github.com/bufbuild/protovalidate/tools/protovalidate-conformance/internal/fieldpath" + "github.com/davecgh/go-spew/spew" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" ) type Result interface { @@ -113,11 +118,15 @@ func (v violationsResult) String() string { if err.GetForKey() { forKey = " (key)" } + violationPath := "" + if path := err.GetField(); path != nil { + violationPath = fieldpath.Marshal(path) + } rulePath := "" - if err.GetRulePath() != "" { - rulePath = " (" + err.GetRulePath() + ")" + if path := err.GetRule(); path != nil { + rulePath = " (" + fieldpath.Marshal(path) + ")" } - _, _ = fmt.Fprintf(bldr, "\n%s %2d. %s%s: %s%s", resultPadding, i+1, err.GetFieldPath(), forKey, err.GetConstraintId(), rulePath) + _, _ = fmt.Fprintf(bldr, "\n%s %2d. %s%s: %s%s", resultPadding, i+1, violationPath, forKey, err.GetConstraintId(), rulePath) _, _ = fmt.Fprintf(bldr, "\n%s %s", resultPadding, err.GetMessage()) } return bldr.String() @@ -137,10 +146,16 @@ func (v violationsResult) IsSuccessWith(other Result, options *harness.ResultOpt return false } for i := range len(want) { - matchingField := want[i].GetFieldPath() == got[i].GetFieldPath() && want[i].GetForKey() == got[i].GetForKey() - matchingRule := want[i].GetRulePath() == got[i].GetRulePath() + matchingField := want[i].GetFieldPath() == got[i].GetFieldPath() && + proto.Equal(want[i].GetField(), got[i].GetField()) && + want[i].GetForKey() == got[i].GetForKey() + matchingRule := proto.Equal(want[i].GetRule(), got[i].GetRule()) matchingConstraint := want[i].GetConstraintId() == got[i].GetConstraintId() if !matchingField || !matchingRule || !matchingConstraint { + log.Printf("matchingField %v, matchingRule %v, matchingConstraint %v", matchingField, matchingRule, matchingConstraint) + log.Printf("--") + spew.Dump(want[i].GetFieldPath(), got[i].GetFieldPath()) + log.Printf("--") return false } if options.GetStrictMessage() && len(want[i].GetMessage()) > 0 && @@ -231,8 +246,56 @@ func (u unexpectedErrorResult) IsSuccessWith(_ Result, _ *harness.ResultOptions) func SortViolations(violations []*validate.Violation) { slices.SortFunc(violations, func(a, b *validate.Violation) int { if a.GetConstraintId() == b.GetConstraintId() { - return cmp.Compare(a.GetFieldPath(), b.GetFieldPath()) + return cmp.Compare(fieldpath.Marshal(a.GetField()), fieldpath.Marshal(b.GetField())) } return cmp.Compare(a.GetConstraintId(), b.GetConstraintId()) }) } + +// FieldPath returns a placeholder field path. It will be expanded automatically +// when processing the results. +func FieldPath(fieldPath string) *validate.FieldPath { + return &validate.FieldPath{ + Elements: []*validate.FieldPathElement{{FieldName: &fieldPath}}, + } +} + +// HydrateFieldPaths expands placeholder field paths in the violations messages. +func HydrateFieldPaths( + descriptor protoreflect.MessageDescriptor, + result Result, +) error { + switch result := result.(type) { + case violationsResult: + violations := result.inner.GetValidationError() + if violations == nil { + break + } + for _, violation := range violations.GetViolations() { + if path := violation.GetField(); path != nil && len(path.GetElements()) > 0 { + var err error + //nolint:staticcheck // Intentional use of deprecated field + violation.FieldPath = proto.String(path.GetElements()[0].GetFieldName()) + violation.Field, err = fieldpath.Unmarshal( + descriptor, + path.GetElements()[0].GetFieldName(), + ) + if err != nil { + return fmt.Errorf("hydrating field path: %w", err) + } + } + if path := violation.GetRule(); path != nil && len(path.GetElements()) > 0 { + var err error + constraints := validate.FieldConstraints{} + violation.Rule, err = fieldpath.Unmarshal( + constraints.ProtoReflect().Descriptor(), + path.GetElements()[0].GetFieldName(), + ) + if err != nil { + return fmt.Errorf("hydrating rule path: %w", err) + } + } + } + } + return nil +} diff --git a/tools/protovalidate-conformance/internal/suites/suite.go b/tools/protovalidate-conformance/internal/suites/suite.go index 486c8e59..95b2f775 100644 --- a/tools/protovalidate-conformance/internal/suites/suite.go +++ b/tools/protovalidate-conformance/internal/suites/suite.go @@ -97,6 +97,12 @@ func (s Suite) ProcessResults( if err != nil { return err } + if err := results.HydrateFieldPaths( + testCase.Message.ProtoReflect().Descriptor(), + testCase.Expected, + ); err != nil { + return err + } out.AddCase(&harness.CaseResult{ Name: caseName, Success: testCase.Expected.IsSuccessWith(actual, options), From 9fbcb20937fb97609f5711d25474213241694294 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Wed, 6 Nov 2024 18:38:34 -0500 Subject: [PATCH 06/14] Update MODULE.bazel.lock, for some reason --- MODULE.bazel.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 21b358eb..d62a47c0 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -64,19 +64,19 @@ "@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": { "general": { "bzlTransitiveDigest": "PjIds3feoYE8SGbbIq2SFTZy3zmxeO2tQevJZNDo7iY=", - "usagesDigest": "aLmqbvowmHkkBPve05yyDNGN7oh7QE9kBADr3QIZTZs=", + "usagesDigest": "+hz7IHWN6A1oVJJWNDB6yZRG+RYhF76wAYItpAeIUIg=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { - "local_config_apple_cc": { + "local_config_apple_cc_toolchains": { "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf", + "ruleClassName": "_apple_cc_autoconf_toolchains", "attributes": {} }, - "local_config_apple_cc_toolchains": { + "local_config_apple_cc": { "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf_toolchains", + "ruleClassName": "_apple_cc_autoconf", "attributes": {} } }, @@ -92,7 +92,7 @@ "@@platforms//host:extension.bzl%host_platform": { "general": { "bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=", - "usagesDigest": "meSzxn3DUCcYEhq4HQwExWkWtU4EjriRBQLsZN+Q0SU=", + "usagesDigest": "pCYpDQmqMbmiiPI1p2Kd3VLm5T48rRAht5WdW0X2GlA=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, From ad50b2885f8751f5773a142b7f37acbca5eb4185 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Thu, 7 Nov 2024 14:20:39 -0500 Subject: [PATCH 07/14] Remove left-over printf debugging gunk --- tools/protovalidate-conformance/internal/results/result.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tools/protovalidate-conformance/internal/results/result.go b/tools/protovalidate-conformance/internal/results/result.go index fb77d250..c38e9c9b 100644 --- a/tools/protovalidate-conformance/internal/results/result.go +++ b/tools/protovalidate-conformance/internal/results/result.go @@ -17,14 +17,12 @@ package results import ( "cmp" "fmt" - "log" "slices" "strings" "github.com/bufbuild/protovalidate/tools/internal/gen/buf/validate" "github.com/bufbuild/protovalidate/tools/internal/gen/buf/validate/conformance/harness" "github.com/bufbuild/protovalidate/tools/protovalidate-conformance/internal/fieldpath" - "github.com/davecgh/go-spew/spew" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" ) @@ -152,10 +150,6 @@ func (v violationsResult) IsSuccessWith(other Result, options *harness.ResultOpt matchingRule := proto.Equal(want[i].GetRule(), got[i].GetRule()) matchingConstraint := want[i].GetConstraintId() == got[i].GetConstraintId() if !matchingField || !matchingRule || !matchingConstraint { - log.Printf("matchingField %v, matchingRule %v, matchingConstraint %v", matchingField, matchingRule, matchingConstraint) - log.Printf("--") - spew.Dump(want[i].GetFieldPath(), got[i].GetFieldPath()) - log.Printf("--") return false } if options.GetStrictMessage() && len(want[i].GetMessage()) > 0 && From 23224b17be30ed7b997589b178b0cfd3163f15ac Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Fri, 22 Nov 2024 11:48:47 -0500 Subject: [PATCH 08/14] Add test case with multiple custom field expressions --- .../custom_constraints.proto | 14 ++ .../custom_constraints.pb.go | 145 ++++++++++-------- .../cases/cases_custom_constraints.go | 9 ++ 3 files changed, 105 insertions(+), 63 deletions(-) diff --git a/proto/protovalidate-testing/buf/validate/conformance/cases/custom_constraints/custom_constraints.proto b/proto/protovalidate-testing/buf/validate/conformance/cases/custom_constraints/custom_constraints.proto index fb7ca318..80bf8b9c 100644 --- a/proto/protovalidate-testing/buf/validate/conformance/cases/custom_constraints/custom_constraints.proto +++ b/proto/protovalidate-testing/buf/validate/conformance/cases/custom_constraints/custom_constraints.proto @@ -87,6 +87,20 @@ message FieldExpressions { message: "c.a must be a multiple of 4" expression: "this.a % 4 == 0" }]; + int32 d = 4 [ + (field).cel = { + id: "field_expression_scalar_multiple_1" + expression: + "this < 1 ? ''" + ": 'd must be less than 1'" + }, + (field).cel = { + id: "field_expression_scalar_multiple_2" + expression: + "this < 2 ? ''" + ": 'd must be less than 2'" + } + ]; message Nested { int32 a = 1 [(field).cel = { diff --git a/tools/internal/gen/buf/validate/conformance/cases/custom_constraints/custom_constraints.pb.go b/tools/internal/gen/buf/validate/conformance/cases/custom_constraints/custom_constraints.pb.go index 8da5f330..29ba7e99 100644 --- a/tools/internal/gen/buf/validate/conformance/cases/custom_constraints/custom_constraints.pb.go +++ b/tools/internal/gen/buf/validate/conformance/cases/custom_constraints/custom_constraints.pb.go @@ -241,6 +241,7 @@ type FieldExpressions struct { A int32 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` B Enum `protobuf:"varint,2,opt,name=b,proto3,enum=buf.validate.conformance.cases.custom_constraints.Enum" json:"b,omitempty"` C *FieldExpressions_Nested `protobuf:"bytes,3,opt,name=c,proto3" json:"c,omitempty"` + D int32 `protobuf:"varint,4,opt,name=d,proto3" json:"d,omitempty"` } func (x *FieldExpressions) Reset() { @@ -296,6 +297,13 @@ func (x *FieldExpressions) GetC() *FieldExpressions_Nested { return nil } +func (x *FieldExpressions) GetD() int32 { + if x != nil { + return x.D + } + return 0 +} + type MissingField struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -684,7 +692,7 @@ var file_buf_validate_conformance_cases_custom_constraints_custom_constraints_pr 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x12, 0x12, 0x65, 0x2e, 0x61, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x20, 0x66, 0x2e, 0x61, 0x1a, 0x14, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x65, 0x2e, 0x61, 0x20, 0x3d, - 0x3d, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x66, 0x2e, 0x61, 0x22, 0xf6, 0x03, 0x0a, 0x10, 0x46, + 0x3d, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x66, 0x2e, 0x61, 0x22, 0xaa, 0x05, 0x0a, 0x10, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5a, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x4c, 0xba, 0x48, 0x49, 0xba, 0x01, 0x46, 0x0a, 0x17, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, @@ -710,68 +718,79 @@ var file_buf_validate_conformance_cases_custom_constraints_custom_constraints_pr 0x6d, 0x62, 0x65, 0x64, 0x12, 0x1b, 0x63, 0x2e, 0x61, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x61, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x34, 0x1a, 0x0f, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x61, 0x20, 0x25, 0x20, 0x34, 0x20, 0x3d, 0x3d, - 0x20, 0x30, 0x52, 0x01, 0x63, 0x1a, 0x5c, 0x0a, 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, - 0x52, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x44, 0xba, 0x48, 0x41, 0xba, - 0x01, 0x3e, 0x0a, 0x17, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x1a, 0x23, 0x74, 0x68, 0x69, - 0x73, 0x20, 0x3e, 0x20, 0x30, 0x20, 0x3f, 0x20, 0x27, 0x27, 0x3a, 0x20, 0x27, 0x61, 0x20, 0x6d, - 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x27, - 0x52, 0x01, 0x61, 0x22, 0x52, 0x0a, 0x0c, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, - 0x61, 0x3a, 0x34, 0xba, 0x48, 0x31, 0x1a, 0x2f, 0x0a, 0x0d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, - 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x12, 0x62, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, - 0x62, 0x65, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x1a, 0x0a, 0x74, 0x68, 0x69, - 0x73, 0x2e, 0x62, 0x20, 0x3e, 0x20, 0x30, 0x22, 0x67, 0x0a, 0x0d, 0x49, 0x6e, 0x63, 0x6f, 0x72, - 0x72, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x01, 0x61, 0x3a, 0x48, 0xba, 0x48, 0x45, 0x1a, 0x43, 0x0a, 0x0e, 0x69, - 0x6e, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x17, 0x61, - 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, - 0x20, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x1a, 0x18, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x61, 0x2e, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x73, 0x57, 0x69, 0x74, 0x68, 0x28, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x29, - 0x22, 0x7d, 0x0a, 0x0f, 0x44, 0x79, 0x6e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, - 0x61, 0x3a, 0x5c, 0xba, 0x48, 0x59, 0x1a, 0x57, 0x0a, 0x0f, 0x64, 0x79, 0x6e, 0x5f, 0x72, 0x75, - 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x65, 0x72, 0x72, 0x12, 0x2e, 0x64, 0x79, 0x6e, 0x61, 0x6d, - 0x69, 0x63, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x74, 0x72, 0x69, 0x65, 0x73, 0x20, 0x74, 0x6f, - 0x20, 0x75, 0x73, 0x65, 0x20, 0x61, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x65, 0x78, 0x69, 0x73, 0x74, - 0x65, 0x6e, 0x74, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x14, 0x64, 0x79, 0x6e, 0x28, 0x74, - 0x68, 0x69, 0x73, 0x29, 0x2e, 0x62, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x22, - 0x5c, 0x0a, 0x0c, 0x4e, 0x6f, 0x77, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x4e, 0x6f, 0x77, 0x3a, - 0x4c, 0xba, 0x48, 0x49, 0x1a, 0x47, 0x0a, 0x0e, 0x6e, 0x6f, 0x77, 0x5f, 0x65, 0x71, 0x75, 0x61, - 0x6c, 0x73, 0x5f, 0x6e, 0x6f, 0x77, 0x12, 0x29, 0x6e, 0x6f, 0x77, 0x20, 0x73, 0x68, 0x6f, 0x75, - 0x6c, 0x64, 0x20, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x20, 0x6e, 0x6f, 0x77, 0x20, 0x77, 0x69, 0x74, - 0x68, 0x69, 0x6e, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x1a, 0x0a, 0x6e, 0x6f, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x6f, 0x77, 0x2a, 0x2a, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, - 0x4e, 0x55, 0x4d, 0x5f, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x42, 0x9d, 0x03, 0x0a, 0x35, 0x63, 0x6f, - 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x73, 0x65, 0x73, - 0x2e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, - 0x6e, 0x74, 0x73, 0x42, 0x16, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x73, 0x74, - 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x66, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x66, 0x62, 0x75, 0x69, - 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2f, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, - 0x67, 0x65, 0x6e, 0x2f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2f, 0x63, 0x61, 0x73, - 0x65, 0x73, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x61, 0x69, 0x6e, 0x74, 0x73, 0xa2, 0x02, 0x05, 0x42, 0x56, 0x43, 0x43, 0x43, 0xaa, 0x02, 0x30, - 0x42, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x43, 0x6f, 0x6e, - 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x43, 0x61, 0x73, 0x65, 0x73, 0x2e, 0x43, - 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, - 0xca, 0x02, 0x30, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, - 0x43, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x5c, 0x43, 0x61, 0x73, 0x65, - 0x73, 0x5c, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, - 0x6e, 0x74, 0x73, 0xe2, 0x02, 0x3c, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x5c, 0x43, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x5c, 0x43, - 0x61, 0x73, 0x65, 0x73, 0x5c, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x73, 0x74, - 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x34, 0x42, 0x75, 0x66, 0x3a, 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x3a, - 0x3a, 0x43, 0x61, 0x73, 0x65, 0x73, 0x3a, 0x3a, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, - 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x20, 0x30, 0x52, 0x01, 0x63, 0x12, 0xb1, 0x01, 0x0a, 0x01, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x05, 0x42, 0xa2, 0x01, 0xba, 0x48, 0x9e, 0x01, 0xba, 0x01, 0x4c, 0x0a, 0x22, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x63, + 0x61, 0x6c, 0x61, 0x72, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x31, 0x1a, + 0x26, 0x74, 0x68, 0x69, 0x73, 0x20, 0x3c, 0x20, 0x31, 0x20, 0x3f, 0x20, 0x27, 0x27, 0x3a, 0x20, + 0x27, 0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x6c, 0x65, 0x73, 0x73, 0x20, + 0x74, 0x68, 0x61, 0x6e, 0x20, 0x31, 0x27, 0xba, 0x01, 0x4c, 0x0a, 0x22, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x63, 0x61, + 0x6c, 0x61, 0x72, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x32, 0x1a, 0x26, + 0x74, 0x68, 0x69, 0x73, 0x20, 0x3c, 0x20, 0x32, 0x20, 0x3f, 0x20, 0x27, 0x27, 0x3a, 0x20, 0x27, + 0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x6c, 0x65, 0x73, 0x73, 0x20, 0x74, + 0x68, 0x61, 0x6e, 0x20, 0x32, 0x27, 0x52, 0x01, 0x64, 0x1a, 0x5c, 0x0a, 0x06, 0x4e, 0x65, 0x73, + 0x74, 0x65, 0x64, 0x12, 0x52, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x44, + 0xba, 0x48, 0x41, 0xba, 0x01, 0x3e, 0x0a, 0x17, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x78, + 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x1a, + 0x23, 0x74, 0x68, 0x69, 0x73, 0x20, 0x3e, 0x20, 0x30, 0x20, 0x3f, 0x20, 0x27, 0x27, 0x3a, 0x20, + 0x27, 0x61, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x76, 0x65, 0x27, 0x52, 0x01, 0x61, 0x22, 0x52, 0x0a, 0x0c, 0x4d, 0x69, 0x73, 0x73, 0x69, + 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x01, 0x61, 0x3a, 0x34, 0xba, 0x48, 0x31, 0x1a, 0x2f, 0x0a, 0x0d, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x12, 0x62, 0x20, 0x6d, + 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x1a, + 0x0a, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x62, 0x20, 0x3e, 0x20, 0x30, 0x22, 0x67, 0x0a, 0x0d, 0x49, + 0x6e, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x01, + 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x61, 0x3a, 0x48, 0xba, 0x48, 0x45, 0x1a, + 0x43, 0x0a, 0x0e, 0x69, 0x6e, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x17, 0x61, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, + 0x77, 0x69, 0x74, 0x68, 0x20, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x1a, 0x18, 0x74, 0x68, 0x69, 0x73, + 0x2e, 0x61, 0x2e, 0x73, 0x74, 0x61, 0x72, 0x74, 0x73, 0x57, 0x69, 0x74, 0x68, 0x28, 0x27, 0x66, + 0x6f, 0x6f, 0x27, 0x29, 0x22, 0x7d, 0x0a, 0x0f, 0x44, 0x79, 0x6e, 0x52, 0x75, 0x6e, 0x74, 0x69, + 0x6d, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x01, 0x61, 0x3a, 0x5c, 0xba, 0x48, 0x59, 0x1a, 0x57, 0x0a, 0x0f, 0x64, 0x79, + 0x6e, 0x5f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x65, 0x72, 0x72, 0x12, 0x2e, 0x64, + 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x74, 0x72, 0x69, 0x65, + 0x73, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x61, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x65, + 0x78, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x14, 0x64, + 0x79, 0x6e, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29, 0x2e, 0x62, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x66, + 0x6f, 0x6f, 0x27, 0x22, 0x5c, 0x0a, 0x0c, 0x4e, 0x6f, 0x77, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, + 0x4e, 0x6f, 0x77, 0x3a, 0x4c, 0xba, 0x48, 0x49, 0x1a, 0x47, 0x0a, 0x0e, 0x6e, 0x6f, 0x77, 0x5f, + 0x65, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x5f, 0x6e, 0x6f, 0x77, 0x12, 0x29, 0x6e, 0x6f, 0x77, 0x20, + 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x20, 0x6e, 0x6f, 0x77, + 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x78, 0x70, 0x72, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x0a, 0x6e, 0x6f, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x6f, + 0x77, 0x2a, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x0c, 0x0a, 0x08, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x42, 0x9d, 0x03, + 0x0a, 0x35, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x63, + 0x61, 0x73, 0x65, 0x73, 0x2e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x6e, 0x73, + 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x42, 0x16, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, + 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x66, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, + 0x66, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2f, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, + 0x2f, 0x63, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, + 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0xa2, 0x02, 0x05, 0x42, 0x56, 0x43, 0x43, + 0x43, 0xaa, 0x02, 0x30, 0x42, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x43, 0x61, 0x73, + 0x65, 0x73, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, + 0x69, 0x6e, 0x74, 0x73, 0xca, 0x02, 0x30, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x5c, 0x43, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x5c, + 0x43, 0x61, 0x73, 0x65, 0x73, 0x5c, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x73, + 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0xe2, 0x02, 0x3c, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, 0x43, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, + 0x63, 0x65, 0x5c, 0x43, 0x61, 0x73, 0x65, 0x73, 0x5c, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, + 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x34, 0x42, 0x75, 0x66, 0x3a, 0x3a, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, + 0x6e, 0x63, 0x65, 0x3a, 0x3a, 0x43, 0x61, 0x73, 0x65, 0x73, 0x3a, 0x3a, 0x43, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go b/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go index 576614b1..6b701518 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go +++ b/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go @@ -109,6 +109,7 @@ func customSuite() suites.Suite { C: &custom_constraints.FieldExpressions_Nested{ A: 16, }, + D: 0, }, Expected: results.Success(true), }, @@ -119,6 +120,7 @@ func customSuite() suites.Suite { C: &custom_constraints.FieldExpressions_Nested{ A: -3, }, + D: 3, }, Expected: results.Violations( &validate.Violation{ @@ -137,6 +139,13 @@ func customSuite() suites.Suite { Field: results.FieldPath("c.a"), ConstraintId: proto.String("field_expression_nested"), }, + &validate.Violation{ + Field: results.FieldPath("d"), + }, + &validate.Violation{ + Field: results.FieldPath("d"), + ConstraintId: proto.String("field_expression_scalar_multiple_2"), + }, ), }, "now/equality": { From d44382b05aaeae7d90f61e08977032bb63beb6e4 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Fri, 22 Nov 2024 11:49:39 -0500 Subject: [PATCH 09/14] Conformance: `rule` should contain path to custom constraint --- .../cases/cases_custom_constraints.go | 9 +++++ .../internal/cases/cases_ignore.go | 40 +++++++++++++++++++ .../internal/cases/cases_ignore_empty.go | 4 ++ .../internal/cases/cases_predefined.go | 12 ++++++ .../internal/cases/cases_strings.go | 3 ++ 5 files changed, 68 insertions(+) diff --git a/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go b/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go index 6b701518..07381618 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go +++ b/tools/protovalidate-conformance/internal/cases/cases_custom_constraints.go @@ -94,10 +94,12 @@ func customSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ Field: results.FieldPath("a"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("field_expression_scalar"), }, &validate.Violation{ Field: results.FieldPath("b"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("field_expression_enum"), }, ), @@ -125,25 +127,32 @@ func customSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ Field: results.FieldPath("a"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("field_expression_scalar"), }, &validate.Violation{ Field: results.FieldPath("b"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("field_expression_enum"), }, &validate.Violation{ Field: results.FieldPath("c"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("field_expression_embed"), }, &validate.Violation{ Field: results.FieldPath("c.a"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("field_expression_nested"), }, &validate.Violation{ Field: results.FieldPath("d"), + Rule: results.FieldPath("cel[0]"), + ConstraintId: proto.String("field_expression_scalar_multiple_1"), }, &validate.Violation{ Field: results.FieldPath("d"), + Rule: results.FieldPath("cel[1]"), ConstraintId: proto.String("field_expression_scalar_multiple_2"), }, ), diff --git a/tools/protovalidate-conformance/internal/cases/cases_ignore.go b/tools/protovalidate-conformance/internal/cases/cases_ignore.go index 8b7981c6..8454af3e 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_ignore.go +++ b/tools/protovalidate-conformance/internal/cases/cases_ignore.go @@ -336,6 +336,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -345,6 +346,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -364,6 +366,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -373,6 +376,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -392,6 +396,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -413,6 +418,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -422,6 +428,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -437,6 +444,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -446,6 +454,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -461,6 +470,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto2.message.ignore.empty"), }), }, @@ -1068,6 +1078,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1077,6 +1088,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1096,6 +1108,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1105,6 +1118,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1124,6 +1138,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1145,6 +1160,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1154,6 +1170,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1169,6 +1186,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1178,6 +1196,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1193,6 +1212,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto3.message.ignore.empty"), }), }, @@ -1912,6 +1932,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1921,6 +1942,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1940,6 +1962,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1949,6 +1972,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1968,6 +1992,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1977,6 +2002,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -1996,6 +2022,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2005,6 +2032,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2024,6 +2052,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2049,6 +2078,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2070,6 +2100,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2079,6 +2110,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2094,6 +2126,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2103,6 +2136,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2118,6 +2152,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2127,6 +2162,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2142,6 +2178,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2151,6 +2188,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2166,6 +2204,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, @@ -2187,6 +2226,7 @@ func ignoreSuite() suites.Suite { }, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("proto.editions.message.ignore.empty"), }), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go b/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go index 7aaaf631..e6b27edc 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go +++ b/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go @@ -104,6 +104,7 @@ func ignoreEmptySuite() suites.Suite { Message: &cases.IgnoreEmptyProto2Message{Val: &cases.IgnoreEmptyProto2Message_Msg{}}, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("ignore_empty.proto2.message"), }), }, @@ -199,6 +200,7 @@ func ignoreEmptySuite() suites.Suite { Message: &cases.IgnoreEmptyProto3Message{Val: &cases.IgnoreEmptyProto3Message_Msg{}}, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("ignore_empty.proto3.message"), }), }, @@ -418,6 +420,7 @@ func ignoreEmptySuite() suites.Suite { Message: &cases.IgnoreEmptyEditionsMessageExplicitPresence{Val: &cases.IgnoreEmptyEditionsMessageExplicitPresence_Msg{}}, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("ignore_empty.editions.message"), }), }, @@ -433,6 +436,7 @@ func ignoreEmptySuite() suites.Suite { Message: &cases.IgnoreEmptyEditionsMessageExplicitPresenceDelimited{Val: &cases.IgnoreEmptyEditionsMessageExplicitPresenceDelimited_Msg{}}, Expected: results.Violations(&validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("ignore_empty.editions.message"), }), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_predefined.go b/tools/protovalidate-conformance/internal/cases/cases_predefined.go index 770f6549..5fa96135 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_predefined.go +++ b/tools/protovalidate-conformance/internal/cases/cases_predefined.go @@ -653,16 +653,19 @@ func predefinedSuite() suites.Suite { }, &validate.Violation{ Field: results.FieldPath("b"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("predefined_and_custom_rule_embedded_proto2"), Message: proto.String("b.c must be a multiple of 3"), }, &validate.Violation{ Field: results.FieldPath("b.c"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("predefined_and_custom_rule_nested_proto2"), Message: proto.String("c must be positive"), }, &validate.Violation{ Field: results.FieldPath("a"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("predefined_and_custom_rule_scalar_proto2"), Message: proto.String("a must be greater than 24"), }, @@ -707,6 +710,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ Field: results.FieldPath("a"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("standard_predefined_and_custom_rule_scalar_proto2"), Message: proto.String("a must be greater than 24"), }, @@ -1351,16 +1355,19 @@ func predefinedSuite() suites.Suite { }, &validate.Violation{ Field: results.FieldPath("b"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("predefined_and_custom_rule_embedded_proto3"), Message: proto.String("b.c must be a multiple of 3"), }, &validate.Violation{ Field: results.FieldPath("b.c"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("predefined_and_custom_rule_nested_proto3"), Message: proto.String("c must be positive"), }, &validate.Violation{ Field: results.FieldPath("a"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("predefined_and_custom_rule_scalar_proto3"), Message: proto.String("a must be greater than 24"), }, @@ -1405,6 +1412,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ Field: results.FieldPath("a"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("standard_predefined_and_custom_rule_scalar_proto3"), Message: proto.String("a must be greater than 24"), }, @@ -2049,16 +2057,19 @@ func predefinedSuite() suites.Suite { }, &validate.Violation{ Field: results.FieldPath("b"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("predefined_and_custom_rule_embedded_edition_2023"), Message: proto.String("b.c must be a multiple of 3"), }, &validate.Violation{ Field: results.FieldPath("b.c"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("predefined_and_custom_rule_nested_edition_2023"), Message: proto.String("c must be positive"), }, &validate.Violation{ Field: results.FieldPath("a"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("predefined_and_custom_rule_scalar_edition_2023"), Message: proto.String("a must be greater than 24"), }, @@ -2103,6 +2114,7 @@ func predefinedSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ Field: results.FieldPath("a"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("standard_predefined_and_custom_rule_scalar_edition_2023"), Message: proto.String("a must be greater than 24"), }, diff --git a/tools/protovalidate-conformance/internal/cases/cases_strings.go b/tools/protovalidate-conformance/internal/cases/cases_strings.go index e42438b0..26b3d8c4 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_strings.go +++ b/tools/protovalidate-conformance/internal/cases/cases_strings.go @@ -1727,6 +1727,7 @@ func stringSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("string.host_and_port.optional_port"), }, ), @@ -1736,6 +1737,7 @@ func stringSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("string.host_and_port.optional_port"), }, ), @@ -1745,6 +1747,7 @@ func stringSuite() suites.Suite { Expected: results.Violations( &validate.Violation{ Field: results.FieldPath("val"), + Rule: results.FieldPath("cel[0]"), ConstraintId: proto.String("string.host_and_port.optional_port"), }, ), From 55145cf96d17444ed160436cba8d1e6b4f597cd3 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Fri, 22 Nov 2024 12:02:38 -0500 Subject: [PATCH 10/14] Update documentation. --- .../protovalidate/buf/validate/validate.proto | 56 +++- .../internal/gen/buf/validate/validate.pb.go | 240 +++++++++++------- 2 files changed, 202 insertions(+), 94 deletions(-) diff --git a/proto/protovalidate/buf/validate/validate.proto b/proto/protovalidate/buf/validate/validate.proto index 6b3b32c2..ddd1dd4c 100644 --- a/proto/protovalidate/buf/validate/validate.proto +++ b/proto/protovalidate/buf/validate/validate.proto @@ -4772,18 +4772,60 @@ message Violations { message Violation { // `field` is a machine-readable path to the field that failed validation. // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. + // + // For example, consider the following message: + // + // ```proto + // message Message { + // bool a = 1 [(buf.validate.field).required = true]; + // } + // ``` + // + // It could produce the following violation: + // + // ```textproto + // violation { + // field { element { field_number: 1, field_name: "a", field_type: 8 } } + // ... + // } + // ``` optional FieldPath field = 5; // `rule` is a machine-readable path that points to the specific constraint rule that failed validation. // This will be a nested field starting from the FieldConstraints of the field that failed validation. - // This field is not present when there is no corresponding rule field, e.g. for custom constraints. + // For custom constraints, this will provide the path of the constraint, e.g. `cel[0]`. + // + // For example, consider the following message: + // + // ```proto + // message Message { + // bool a = 1 [(buf.validate.field).required = true]; + // bool b = 2 [(buf.validate.field).cel = { + // id: "custom_constraint", + // expression: "!this ? 'b must be true': ''" + // }] + // } + // ``` + // + // It could produce the following violations: + // + // ```textproto + // violation { + // rule { element { field_number: 25, field_name: "required", field_type: 8 } } + // ... + // } + // violation { + // rule { element { field_number: 23, field_name: "cel", field_type: 11, index: 0 } } + // ... + // } + // ``` optional FieldPath rule = 6; // `field_path` is a human-readable identifier that points to the specific field that failed the validation. // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. // // Deprecated: use the `field` instead. - optional string field_path = 1; + optional string field_path = 1 [deprecated = true]; // `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. // This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated. @@ -4809,7 +4851,7 @@ message FieldPath { // `FieldPathElement` provides enough information to nest through a single protobuf field. // // If the selected field is a map or repeated field, the `subscript` value selects a specific element from it. -// A path that refers to a map or repeated field and not an element under it will not have a `subscript` value. +// A path that refers to a value nested under a map key or repeated field index will have a `subscript` value. // The `field_type` field allows unambiguous resolution of a field even if descriptors are not available. message FieldPathElement { // `field_number` is the field number this path element refers to. @@ -4822,7 +4864,13 @@ message FieldPathElement { // `field_type` specifies the type of this field. When using reflection, this value is not needed. // // This value is provided to make it possible to traverse unknown fields through wire data. - // When traversing wire data, be mindful of both packed and delimited encoding schemes. + // When traversing wire data, be mindful of both packed[1] and delimited[2] encoding schemes. + // + // [1]: https://protobuf.dev/programming-guides/encoding/#packed + // [2]: https://protobuf.dev/programming-guides/encoding/#groups + // + // N.B.: Although groups are deprecated, the corresponding delimited encoding scheme is not, and + // can be explicitly used in Protocol Buffers 2023 Edition. optional google.protobuf.FieldDescriptorProto.Type field_type = 3; // `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. diff --git a/tools/internal/gen/buf/validate/validate.pb.go b/tools/internal/gen/buf/validate/validate.pb.go index 22e06ebf..bb82cd75 100644 --- a/tools/internal/gen/buf/validate/validate.pb.go +++ b/tools/internal/gen/buf/validate/validate.pb.go @@ -6768,15 +6768,68 @@ type Violation struct { // `field` is a machine-readable path to the field that failed validation. // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. + // + // For example, consider the following message: + // + // ```proto + // + // message Message { + // bool a = 1 [(buf.validate.field).required = true]; + // } + // + // ``` + // + // It could produce the following violation: + // + // ```textproto + // + // violation { + // field { element { field_number: 1, field_name: "a", field_type: 8 } } + // ... + // } + // + // ``` Field *FieldPath `protobuf:"bytes,5,opt,name=field" json:"field,omitempty"` // `rule` is a machine-readable path that points to the specific constraint rule that failed validation. // This will be a nested field starting from the FieldConstraints of the field that failed validation. - // This field is not present when there is no corresponding rule field, e.g. for custom constraints. + // For custom constraints, this will provide the path of the constraint, e.g. `cel[0]`. + // + // For example, consider the following message: + // + // ```proto + // + // message Message { + // bool a = 1 [(buf.validate.field).required = true]; + // bool b = 2 [(buf.validate.field).cel = { + // id: "custom_constraint", + // expression: "!this ? 'b must be true': ''" + // }] + // } + // + // ``` + // + // It could produce the following violations: + // + // ```textproto + // + // violation { + // rule { element { field_number: 25, field_name: "required", field_type: 8 } } + // ... + // } + // + // violation { + // rule { element { field_number: 23, field_name: "cel", field_type: 11, index: 0 } } + // ... + // } + // + // ``` Rule *FieldPath `protobuf:"bytes,6,opt,name=rule" json:"rule,omitempty"` // `field_path` is a human-readable identifier that points to the specific field that failed the validation. // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. // // Deprecated: use the `field` instead. + // + // Deprecated: Marked as deprecated in buf/validate/validate.proto. FieldPath *string `protobuf:"bytes,1,opt,name=field_path,json=fieldPath" json:"field_path,omitempty"` // `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. // This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated. @@ -6834,6 +6887,7 @@ func (x *Violation) GetRule() *FieldPath { return nil } +// Deprecated: Marked as deprecated in buf/validate/validate.proto. func (x *Violation) GetFieldPath() string { if x != nil && x.FieldPath != nil { return *x.FieldPath @@ -6917,7 +6971,7 @@ func (x *FieldPath) GetElements() []*FieldPathElement { // `FieldPathElement` provides enough information to nest through a single protobuf field. // // If the selected field is a map or repeated field, the `subscript` value selects a specific element from it. -// A path that refers to a map or repeated field and not an element under it will not have a `subscript` value. +// A path that refers to a value nested under a map key or repeated field index will have a `subscript` value. // The `field_type` field allows unambiguous resolution of a field even if descriptors are not available. type FieldPathElement struct { state protoimpl.MessageState @@ -6932,7 +6986,13 @@ type FieldPathElement struct { // `field_type` specifies the type of this field. When using reflection, this value is not needed. // // This value is provided to make it possible to traverse unknown fields through wire data. - // When traversing wire data, be mindful of both packed and delimited encoding schemes. + // When traversing wire data, be mindful of both packed[1] and delimited[2] encoding schemes. + // + // N.B.: Although groups are deprecated, the corresponding delimited encoding scheme is not, and + // can be explicitly used in Protocol Buffers 2023 Edition. + // + // [1]: https://protobuf.dev/programming-guides/encoding/#packed + // [2]: https://protobuf.dev/programming-guides/encoding/#groups FieldType *descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,3,opt,name=field_type,json=fieldType,enum=google.protobuf.FieldDescriptorProto_Type" json:"field_type,omitempty"` // `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. // @@ -10473,98 +10533,98 @@ var file_buf_validate_validate_proto_rawDesc = []byte{ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x22, 0xde, 0x01, 0x0a, 0x09, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, + 0x22, 0xe2, 0x01, 0x0a, 0x09, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x50, 0x61, 0x74, 0x68, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, - 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x18, - 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x6f, 0x72, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x4b, 0x65, - 0x79, 0x22, 0x47, 0x0a, 0x09, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x12, 0x3a, - 0x0a, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd7, 0x02, 0x0a, 0x10, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x21, 0x0a, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, - 0x65, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x05, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x05, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x4b, 0x65, - 0x79, 0x12, 0x19, 0x0a, 0x07, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x03, 0x48, 0x00, 0x52, 0x06, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x08, - 0x73, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x12, 0x48, 0x00, - 0x52, 0x07, 0x73, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x08, 0x75, 0x69, 0x6e, - 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x07, 0x75, - 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x73, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x42, 0x0b, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x2a, 0x9d, 0x01, 0x0a, 0x06, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x12, - 0x16, 0x0a, 0x12, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x49, 0x47, 0x4e, 0x4f, 0x52, - 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x55, 0x4e, 0x50, 0x4f, 0x50, 0x55, 0x4c, 0x41, 0x54, 0x45, 0x44, - 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x49, 0x46, 0x5f, - 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x12, - 0x11, 0x0a, 0x0d, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x41, 0x4c, 0x57, 0x41, 0x59, 0x53, - 0x10, 0x03, 0x12, 0x14, 0x0a, 0x0c, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x45, 0x4d, 0x50, - 0x54, 0x59, 0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x16, 0x0a, 0x0e, 0x49, 0x47, 0x4e, 0x4f, - 0x52, 0x45, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x02, 0x1a, 0x02, 0x08, 0x01, - 0x1a, 0x02, 0x10, 0x01, 0x2a, 0x6e, 0x0a, 0x0a, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x67, - 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x17, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, - 0x58, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x20, 0x0a, 0x1c, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x48, - 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x10, - 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, - 0x5f, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x56, 0x41, 0x4c, - 0x55, 0x45, 0x10, 0x02, 0x3a, 0x5c, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, - 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x3a, 0x54, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x1d, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, - 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, - 0x73, 0x52, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x3a, 0x54, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x73, - 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x3a, 0x63, - 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x1d, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x09, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x73, - 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, - 0x6e, 0x65, 0x64, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x2e, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x42, 0x0d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x66, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x74, 0x6f, 0x6f, - 0x6c, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, - 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x42, - 0x56, 0x58, 0xaa, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0xca, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0xe2, 0x02, 0x18, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x42, 0x75, - 0x66, 0x3a, 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x74, 0x68, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x0a, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, + 0x18, 0x01, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x12, 0x23, 0x0a, + 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, + 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, + 0x66, 0x6f, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, + 0x6f, 0x72, 0x4b, 0x65, 0x79, 0x22, 0x47, 0x0a, 0x09, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, + 0x74, 0x68, 0x12, 0x3a, 0x0a, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6c, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd7, + 0x02, 0x0a, 0x10, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6c, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x16, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, + 0x00, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, + 0x6f, 0x6c, 0x4b, 0x65, 0x79, 0x12, 0x19, 0x0a, 0x07, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x06, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, + 0x12, 0x1b, 0x0a, 0x08, 0x73, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x12, 0x48, 0x00, 0x52, 0x07, 0x73, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, + 0x08, 0x75, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x48, + 0x00, 0x52, 0x07, 0x75, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0a, 0x73, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x09, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x42, 0x0b, 0x0a, 0x09, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x2a, 0x9d, 0x01, 0x0a, 0x06, 0x49, 0x67, 0x6e, + 0x6f, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x49, + 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x55, 0x4e, 0x50, 0x4f, 0x50, 0x55, 0x4c, + 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, + 0x5f, 0x49, 0x46, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, + 0x45, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x41, 0x4c, + 0x57, 0x41, 0x59, 0x53, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x0c, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, + 0x5f, 0x45, 0x4d, 0x50, 0x54, 0x59, 0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x16, 0x0a, 0x0e, + 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x02, + 0x1a, 0x02, 0x08, 0x01, 0x1a, 0x02, 0x10, 0x01, 0x2a, 0x6e, 0x0a, 0x0a, 0x4b, 0x6e, 0x6f, 0x77, + 0x6e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x17, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, + 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1c, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, + 0x45, 0x58, 0x5f, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x4e, + 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, + 0x45, 0x47, 0x45, 0x58, 0x5f, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, + 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x3a, 0x5c, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x75, + 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x54, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x12, + 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, + 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, + 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x3a, 0x54, 0x0a, 0x05, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, + 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x3a, 0x63, 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, + 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x88, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, + 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x70, 0x72, 0x65, + 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, + 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x42, 0x0d, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x41, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x66, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x2f, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0xa2, 0x02, 0x03, 0x42, 0x56, 0x58, 0xaa, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x65, 0xca, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0xe2, 0x02, 0x18, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0d, 0x42, 0x75, 0x66, 0x3a, 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, } var ( From 3f193c95f96b9da59d3e57fbd13307107e607f68 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Fri, 22 Nov 2024 16:02:51 -0500 Subject: [PATCH 11/14] Fix lint issue --- tools/protovalidate-conformance/internal/results/result.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/protovalidate-conformance/internal/results/result.go b/tools/protovalidate-conformance/internal/results/result.go index c38e9c9b..938c1861 100644 --- a/tools/protovalidate-conformance/internal/results/result.go +++ b/tools/protovalidate-conformance/internal/results/result.go @@ -144,6 +144,7 @@ func (v violationsResult) IsSuccessWith(other Result, options *harness.ResultOpt return false } for i := range len(want) { + //nolint:staticcheck // Intentional use of deprecated field matchingField := want[i].GetFieldPath() == got[i].GetFieldPath() && proto.Equal(want[i].GetField(), got[i].GetField()) && want[i].GetForKey() == got[i].GetForKey() From 59d6a1fb874f0c592767690c66b04f7bbdc30708 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Fri, 22 Nov 2024 16:06:31 -0500 Subject: [PATCH 12/14] buf format --- .../protovalidate/buf/validate/validate.proto | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/proto/protovalidate/buf/validate/validate.proto b/proto/protovalidate/buf/validate/validate.proto index ddd1dd4c..683e685d 100644 --- a/proto/protovalidate/buf/validate/validate.proto +++ b/proto/protovalidate/buf/validate/validate.proto @@ -4785,16 +4785,16 @@ message Violation { // // ```textproto // violation { - // field { element { field_number: 1, field_name: "a", field_type: 8 } } - // ... - // } + // field { element { field_number: 1, field_name: "a", field_type: 8 } } + // ... + // } // ``` optional FieldPath field = 5; // `rule` is a machine-readable path that points to the specific constraint rule that failed validation. // This will be a nested field starting from the FieldConstraints of the field that failed validation. // For custom constraints, this will provide the path of the constraint, e.g. `cel[0]`. - // + // // For example, consider the following message: // // ```proto @@ -4811,13 +4811,13 @@ message Violation { // // ```textproto // violation { - // rule { element { field_number: 25, field_name: "required", field_type: 8 } } - // ... - // } + // rule { element { field_number: 25, field_name: "required", field_type: 8 } } + // ... + // } // violation { - // rule { element { field_number: 23, field_name: "cel", field_type: 11, index: 0 } } - // ... - // } + // rule { element { field_number: 23, field_name: "cel", field_type: 11, index: 0 } } + // ... + // } // ``` optional FieldPath rule = 6; From 7e20e7ad28f017f1b25fd2b22a3d59d64c6088f2 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Mon, 25 Nov 2024 12:06:47 -0500 Subject: [PATCH 13/14] One last tweak to FieldPathElement. --- .../protovalidate/buf/validate/validate.proto | 24 +- .../internal/gen/buf/validate/validate.pb.go | 213 ++++++++++-------- .../internal/fieldpath/fieldpath.go | 8 +- 3 files changed, 133 insertions(+), 112 deletions(-) diff --git a/proto/protovalidate/buf/validate/validate.proto b/proto/protovalidate/buf/validate/validate.proto index da6a5ac3..f24d8dff 100644 --- a/proto/protovalidate/buf/validate/validate.proto +++ b/proto/protovalidate/buf/validate/validate.proto @@ -4873,24 +4873,30 @@ message FieldPathElement { // can be explicitly used in Protocol Buffers 2023 Edition. optional google.protobuf.FieldDescriptorProto.Type field_type = 3; + // `key_type` specifies the map key type of this field. This value is useful when traversing + // unknown fields through wire data: specifically, it allows handling the differences between + // different integer encodings. + optional google.protobuf.FieldDescriptorProto.Type key_type = 4; + + // `value_type` specifies map value type of this field. This is useful if you want to display a + // value inside unknown fields through wire data. + optional google.protobuf.FieldDescriptorProto.Type value_type = 5; + // `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. oneof subscript { // `index` specifies a 0-based index into a repeated field. - uint64 index = 4; + uint64 index = 6; // `bool_key` specifies a map key of type bool. - bool bool_key = 5; - - // `int_key` specifies a map key of type int32, int64, sfixed32 or sfixed64. - int64 int_key = 6; + bool bool_key = 7; - // `sint_key` specifies a map key of type sint32 or sint64. - sint64 sint_key = 7; + // `int_key` specifies a map key of type int32, int64, sint32, sint64, sfixed32 or sfixed64. + int64 int_key = 8; // `uint_key` specifies a map key of type uint32, uint64, fixed32 or fixed64. - uint64 uint_key = 8; + uint64 uint_key = 9; // `string_key` specifies a map key of type string. - string string_key = 9; + string string_key = 10; } } diff --git a/tools/internal/gen/buf/validate/validate.pb.go b/tools/internal/gen/buf/validate/validate.pb.go index 618e87fc..6a967ac1 100644 --- a/tools/internal/gen/buf/validate/validate.pb.go +++ b/tools/internal/gen/buf/validate/validate.pb.go @@ -6994,6 +6994,13 @@ type FieldPathElement struct { // [1]: https://protobuf.dev/programming-guides/encoding/#packed // [2]: https://protobuf.dev/programming-guides/encoding/#groups FieldType *descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,3,opt,name=field_type,json=fieldType,enum=google.protobuf.FieldDescriptorProto_Type" json:"field_type,omitempty"` + // `key_type` specifies the map key type of this field. This value is useful when traversing + // unknown fields through wire data: specifically, it allows handling the differences between + // different integer encodings. + KeyType *descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,4,opt,name=key_type,json=keyType,enum=google.protobuf.FieldDescriptorProto_Type" json:"key_type,omitempty"` + // `value_type` specifies map value type of this field. This is useful if you want to display a + // value inside unknown fields through wire data. + ValueType *descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=value_type,json=valueType,enum=google.protobuf.FieldDescriptorProto_Type" json:"value_type,omitempty"` // `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. // // Types that are assignable to Subscript: @@ -7001,7 +7008,6 @@ type FieldPathElement struct { // *FieldPathElement_Index // *FieldPathElement_BoolKey // *FieldPathElement_IntKey - // *FieldPathElement_SintKey // *FieldPathElement_UintKey // *FieldPathElement_StringKey Subscript isFieldPathElement_Subscript `protobuf_oneof:"subscript"` @@ -7060,6 +7066,20 @@ func (x *FieldPathElement) GetFieldType() descriptorpb.FieldDescriptorProto_Type return descriptorpb.FieldDescriptorProto_Type(1) } +func (x *FieldPathElement) GetKeyType() descriptorpb.FieldDescriptorProto_Type { + if x != nil && x.KeyType != nil { + return *x.KeyType + } + return descriptorpb.FieldDescriptorProto_Type(1) +} + +func (x *FieldPathElement) GetValueType() descriptorpb.FieldDescriptorProto_Type { + if x != nil && x.ValueType != nil { + return *x.ValueType + } + return descriptorpb.FieldDescriptorProto_Type(1) +} + func (m *FieldPathElement) GetSubscript() isFieldPathElement_Subscript { if m != nil { return m.Subscript @@ -7088,13 +7108,6 @@ func (x *FieldPathElement) GetIntKey() int64 { return 0 } -func (x *FieldPathElement) GetSintKey() int64 { - if x, ok := x.GetSubscript().(*FieldPathElement_SintKey); ok { - return x.SintKey - } - return 0 -} - func (x *FieldPathElement) GetUintKey() uint64 { if x, ok := x.GetSubscript().(*FieldPathElement_UintKey); ok { return x.UintKey @@ -7115,32 +7128,27 @@ type isFieldPathElement_Subscript interface { type FieldPathElement_Index struct { // `index` specifies a 0-based index into a repeated field. - Index uint64 `protobuf:"varint,4,opt,name=index,oneof"` + Index uint64 `protobuf:"varint,6,opt,name=index,oneof"` } type FieldPathElement_BoolKey struct { // `bool_key` specifies a map key of type bool. - BoolKey bool `protobuf:"varint,5,opt,name=bool_key,json=boolKey,oneof"` + BoolKey bool `protobuf:"varint,7,opt,name=bool_key,json=boolKey,oneof"` } type FieldPathElement_IntKey struct { - // `int_key` specifies a map key of type int32, int64, sfixed32 or sfixed64. - IntKey int64 `protobuf:"varint,6,opt,name=int_key,json=intKey,oneof"` -} - -type FieldPathElement_SintKey struct { - // `sint_key` specifies a map key of type sint32 or sint64. - SintKey int64 `protobuf:"zigzag64,7,opt,name=sint_key,json=sintKey,oneof"` + // `int_key` specifies a map key of type int32, int64, sint32, sint64, sfixed32 or sfixed64. + IntKey int64 `protobuf:"varint,8,opt,name=int_key,json=intKey,oneof"` } type FieldPathElement_UintKey struct { // `uint_key` specifies a map key of type uint32, uint64, fixed32 or fixed64. - UintKey uint64 `protobuf:"varint,8,opt,name=uint_key,json=uintKey,oneof"` + UintKey uint64 `protobuf:"varint,9,opt,name=uint_key,json=uintKey,oneof"` } type FieldPathElement_StringKey struct { // `string_key` specifies a map key of type string. - StringKey string `protobuf:"bytes,9,opt,name=string_key,json=stringKey,oneof"` + StringKey string `protobuf:"bytes,10,opt,name=string_key,json=stringKey,oneof"` } func (*FieldPathElement_Index) isFieldPathElement_Subscript() {} @@ -7149,8 +7157,6 @@ func (*FieldPathElement_BoolKey) isFieldPathElement_Subscript() {} func (*FieldPathElement_IntKey) isFieldPathElement_Subscript() {} -func (*FieldPathElement_SintKey) isFieldPathElement_Subscript() {} - func (*FieldPathElement_UintKey) isFieldPathElement_Subscript() {} func (*FieldPathElement_StringKey) isFieldPathElement_Subscript() {} @@ -10551,8 +10557,8 @@ var file_buf_validate_validate_proto_rawDesc = []byte{ 0x74, 0x68, 0x12, 0x3a, 0x0a, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6c, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd7, - 0x02, 0x0a, 0x10, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6c, 0x65, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xcc, + 0x03, 0x0a, 0x10, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, @@ -10562,69 +10568,77 @@ var file_buf_validate_validate_proto_rawDesc = []byte{ 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x16, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, - 0x00, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, - 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, - 0x6f, 0x6c, 0x4b, 0x65, 0x79, 0x12, 0x19, 0x0a, 0x07, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x06, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, - 0x12, 0x1b, 0x0a, 0x08, 0x73, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x12, 0x48, 0x00, 0x52, 0x07, 0x73, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, - 0x08, 0x75, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x48, - 0x00, 0x52, 0x07, 0x75, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0a, 0x73, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x09, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x42, 0x0b, 0x0a, 0x09, 0x73, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x2a, 0x9d, 0x01, 0x0a, 0x06, 0x49, 0x67, 0x6e, - 0x6f, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x49, - 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x55, 0x4e, 0x50, 0x4f, 0x50, 0x55, 0x4c, - 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, - 0x5f, 0x49, 0x46, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, - 0x45, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x41, 0x4c, - 0x57, 0x41, 0x59, 0x53, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x0c, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, - 0x5f, 0x45, 0x4d, 0x50, 0x54, 0x59, 0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x16, 0x0a, 0x0e, - 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x02, - 0x1a, 0x02, 0x08, 0x01, 0x1a, 0x02, 0x10, 0x01, 0x2a, 0x6e, 0x0a, 0x0a, 0x4b, 0x6e, 0x6f, 0x77, - 0x6e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x17, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, - 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1c, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, - 0x45, 0x58, 0x5f, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x4e, - 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, - 0x45, 0x47, 0x45, 0x58, 0x5f, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, - 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x3a, 0x5c, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x75, - 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x54, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x12, - 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, - 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x3a, 0x54, 0x0a, 0x05, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x12, 0x45, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, + 0x6b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x16, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x04, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x08, 0x62, 0x6f, + 0x6f, 0x6c, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, + 0x62, 0x6f, 0x6f, 0x6c, 0x4b, 0x65, 0x79, 0x12, 0x19, 0x0a, 0x07, 0x69, 0x6e, 0x74, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x06, 0x69, 0x6e, 0x74, 0x4b, + 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x08, 0x75, 0x69, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x07, 0x75, 0x69, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, + 0x1f, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, + 0x42, 0x0b, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x2a, 0x9d, 0x01, + 0x0a, 0x06, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x47, 0x4e, 0x4f, + 0x52, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x19, 0x0a, 0x15, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x55, 0x4e, + 0x50, 0x4f, 0x50, 0x55, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x49, + 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, + 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x47, 0x4e, 0x4f, + 0x52, 0x45, 0x5f, 0x41, 0x4c, 0x57, 0x41, 0x59, 0x53, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x0c, 0x49, + 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x45, 0x4d, 0x50, 0x54, 0x59, 0x10, 0x01, 0x1a, 0x02, 0x08, + 0x01, 0x12, 0x16, 0x0a, 0x0e, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x5f, 0x44, 0x45, 0x46, 0x41, + 0x55, 0x4c, 0x54, 0x10, 0x02, 0x1a, 0x02, 0x08, 0x01, 0x1a, 0x02, 0x10, 0x01, 0x2a, 0x6e, 0x0a, + 0x0a, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x17, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1c, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, + 0x44, 0x45, 0x52, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x4b, 0x4e, + 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x5f, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, + 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x3a, 0x5c, 0x0a, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, + 0x74, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x54, 0x0a, 0x05, 0x6f, + 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, + 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x43, + 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x6f, 0x6e, 0x65, 0x6f, + 0x66, 0x3a, 0x54, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, + 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x3a, 0x63, 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, + 0x66, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, - 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x3a, 0x63, 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, - 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x88, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, - 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x70, 0x72, 0x65, - 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, - 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x42, 0x0d, 0x56, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x41, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x66, 0x62, 0x75, 0x69, - 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2f, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, - 0x67, 0x65, 0x6e, 0x2f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0xa2, 0x02, 0x03, 0x42, 0x56, 0x58, 0xaa, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0xca, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0xe2, 0x02, 0x18, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x0d, 0x42, 0x75, 0x66, 0x3a, 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x75, + 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x65, + 0x66, 0x69, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, + 0x52, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x42, 0xb5, 0x01, 0x0a, + 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x42, 0x0d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, + 0x75, 0x66, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x42, 0x56, 0x58, 0xaa, 0x02, 0x0c, 0x42, 0x75, + 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xca, 0x02, 0x0c, 0x42, 0x75, 0x66, + 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xe2, 0x02, 0x18, 0x42, 0x75, 0x66, 0x5c, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x42, 0x75, 0x66, 0x3a, 0x3a, 0x56, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, } var ( @@ -10731,19 +10745,21 @@ var file_buf_validate_validate_proto_depIdxs = []int32{ 30, // 46: buf.validate.Violation.rule:type_name -> buf.validate.FieldPath 31, // 47: buf.validate.FieldPath.elements:type_name -> buf.validate.FieldPathElement 34, // 48: buf.validate.FieldPathElement.field_type:type_name -> google.protobuf.FieldDescriptorProto.Type - 35, // 49: buf.validate.message:extendee -> google.protobuf.MessageOptions - 36, // 50: buf.validate.oneof:extendee -> google.protobuf.OneofOptions - 37, // 51: buf.validate.field:extendee -> google.protobuf.FieldOptions - 37, // 52: buf.validate.predefined:extendee -> google.protobuf.FieldOptions - 3, // 53: buf.validate.message:type_name -> buf.validate.MessageConstraints - 4, // 54: buf.validate.oneof:type_name -> buf.validate.OneofConstraints - 5, // 55: buf.validate.field:type_name -> buf.validate.FieldConstraints - 6, // 56: buf.validate.predefined:type_name -> buf.validate.PredefinedConstraints - 57, // [57:57] is the sub-list for method output_type - 57, // [57:57] is the sub-list for method input_type - 53, // [53:57] is the sub-list for extension type_name - 49, // [49:53] is the sub-list for extension extendee - 0, // [0:49] is the sub-list for field type_name + 34, // 49: buf.validate.FieldPathElement.key_type:type_name -> google.protobuf.FieldDescriptorProto.Type + 34, // 50: buf.validate.FieldPathElement.value_type:type_name -> google.protobuf.FieldDescriptorProto.Type + 35, // 51: buf.validate.message:extendee -> google.protobuf.MessageOptions + 36, // 52: buf.validate.oneof:extendee -> google.protobuf.OneofOptions + 37, // 53: buf.validate.field:extendee -> google.protobuf.FieldOptions + 37, // 54: buf.validate.predefined:extendee -> google.protobuf.FieldOptions + 3, // 55: buf.validate.message:type_name -> buf.validate.MessageConstraints + 4, // 56: buf.validate.oneof:type_name -> buf.validate.OneofConstraints + 5, // 57: buf.validate.field:type_name -> buf.validate.FieldConstraints + 6, // 58: buf.validate.predefined:type_name -> buf.validate.PredefinedConstraints + 59, // [59:59] is the sub-list for method output_type + 59, // [59:59] is the sub-list for method input_type + 55, // [55:59] is the sub-list for extension type_name + 51, // [51:55] is the sub-list for extension extendee + 0, // [0:51] is the sub-list for field type_name } func init() { file_buf_validate_validate_proto_init() } @@ -11291,7 +11307,6 @@ func file_buf_validate_validate_proto_init() { (*FieldPathElement_Index)(nil), (*FieldPathElement_BoolKey)(nil), (*FieldPathElement_IntKey)(nil), - (*FieldPathElement_SintKey)(nil), (*FieldPathElement_UintKey)(nil), (*FieldPathElement_StringKey)(nil), } diff --git a/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go b/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go index 5a4e64f0..96c7ce45 100644 --- a/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go +++ b/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go @@ -50,8 +50,6 @@ func Marshal(path *validate.FieldPath) string { result.WriteString(strconv.FormatBool(value.BoolKey)) case *validate.FieldPathElement_IntKey: result.WriteString(strconv.FormatInt(value.IntKey, 10)) - case *validate.FieldPathElement_SintKey: - result.WriteString(strconv.FormatInt(value.SintKey, 10)) case *validate.FieldPathElement_UintKey: result.WriteString(strconv.FormatUint(value.UintKey, 10)) case *validate.FieldPathElement_StringKey: @@ -142,6 +140,8 @@ func parseSubscript( return nil, err } descriptor = descriptor.MapValue() + element.KeyType = descriptorpb.FieldDescriptorProto_Type(descriptor.MapKey().Kind()).Enum() + element.ValueType = descriptorpb.FieldDescriptorProto_Type(descriptor.MapValue().Kind()).Enum() default: return nil, fmt.Errorf("unexpected subscript on field %s", name) } @@ -161,12 +161,12 @@ func parseMapKey( } case protoreflect.Sint32Kind: if intValue, err := strconv.ParseInt(subscript, 10, 32); err == nil { - element.Subscript = &validate.FieldPathElement_SintKey{SintKey: intValue} + element.Subscript = &validate.FieldPathElement_IntKey{IntKey: intValue} return nil } case protoreflect.Sint64Kind: if intValue, err := strconv.ParseInt(subscript, 10, 64); err == nil { - element.Subscript = &validate.FieldPathElement_SintKey{SintKey: intValue} + element.Subscript = &validate.FieldPathElement_IntKey{IntKey: intValue} return nil } case protoreflect.Int32Kind, protoreflect.Sfixed32Kind: From a4d7e113cc9e8944fb22098123eddc5413500381 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Mon, 25 Nov 2024 12:23:43 -0500 Subject: [PATCH 14/14] Fix minor mistake in parseSubscript --- tools/protovalidate-conformance/internal/fieldpath/fieldpath.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go b/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go index 96c7ce45..bc67ac42 100644 --- a/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go +++ b/tools/protovalidate-conformance/internal/fieldpath/fieldpath.go @@ -139,9 +139,9 @@ func parseSubscript( if err := parseMapKey(descriptor, subscript, element); err != nil { return nil, err } - descriptor = descriptor.MapValue() element.KeyType = descriptorpb.FieldDescriptorProto_Type(descriptor.MapKey().Kind()).Enum() element.ValueType = descriptorpb.FieldDescriptorProto_Type(descriptor.MapValue().Kind()).Enum() + descriptor = descriptor.MapValue() default: return nil, fmt.Errorf("unexpected subscript on field %s", name) }