From 1365e7b64f4b1014d3905d0488f6012334a50318 Mon Sep 17 00:00:00 2001 From: Oliver Sun Date: Thu, 28 Sep 2023 19:24:11 -0400 Subject: [PATCH 1/7] fix loading field message when dependency is more than one step --- buf.gen.yaml | 1 + internal/evaluator/builder.go | 2 +- .../gen/tests/example/v1/validations.pb.go | 127 ++++++++++++++---- proto/buf.lock | 5 + proto/buf.yaml | 1 + proto/tests/example/v1/validations.proto | 9 ++ validator_test.go | 17 +++ 7 files changed, 137 insertions(+), 25 deletions(-) diff --git a/buf.gen.yaml b/buf.gen.yaml index 0e42127..915aee5 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -6,6 +6,7 @@ managed: except: - buf.build/envoyproxy/protoc-gen-validate - buf.build/bufbuild/protovalidate + - buf.build/googleapis/googleapis plugins: - plugin: buf.build/protocolbuffers/go:v1.31.0 out: internal/gen diff --git a/internal/evaluator/builder.go b/internal/evaluator/builder.go index 488bdf8..d0f8da4 100644 --- a/internal/evaluator/builder.go +++ b/internal/evaluator/builder.go @@ -268,7 +268,7 @@ func (bldr *Builder) processFieldExpressions( var opts []cel.EnvOption if fieldDesc.Kind() == protoreflect.MessageKind { opts = []cel.EnvOption{ - cel.TypeDescs(fieldDesc.Message().ParentFile()), + cel.Types(dynamicpb.NewMessage(fieldDesc.Message())), cel.Variable("this", cel.ObjectType(string(fieldDesc.Message().FullName()))), } } else { diff --git a/internal/gen/tests/example/v1/validations.pb.go b/internal/gen/tests/example/v1/validations.pb.go index fa42776..ed00da9 100644 --- a/internal/gen/tests/example/v1/validations.pb.go +++ b/internal/gen/tests/example/v1/validations.pb.go @@ -22,6 +22,7 @@ package examplev1 import ( _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + viewport "google.golang.org/genproto/googleapis/geo/type/viewport" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" @@ -508,6 +509,53 @@ func (x *TransitiveFieldConstraint) GetMask() *fieldmaskpb.FieldMask { return nil } +type MultipleStepsTransitiveFieldConstraints struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Viewport *viewport.Viewport `protobuf:"bytes,1,opt,name=viewport,proto3" json:"viewport,omitempty"` +} + +func (x *MultipleStepsTransitiveFieldConstraints) Reset() { + *x = MultipleStepsTransitiveFieldConstraints{} + if protoimpl.UnsafeEnabled { + mi := &file_tests_example_v1_validations_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MultipleStepsTransitiveFieldConstraints) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MultipleStepsTransitiveFieldConstraints) ProtoMessage() {} + +func (x *MultipleStepsTransitiveFieldConstraints) ProtoReflect() protoreflect.Message { + mi := &file_tests_example_v1_validations_proto_msgTypes[8] + 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 MultipleStepsTransitiveFieldConstraints.ProtoReflect.Descriptor instead. +func (*MultipleStepsTransitiveFieldConstraints) Descriptor() ([]byte, []int) { + return file_tests_example_v1_validations_proto_rawDescGZIP(), []int{8} +} + +func (x *MultipleStepsTransitiveFieldConstraints) GetViewport() *viewport.Viewport { + if x != nil { + return x.Viewport + } + return nil +} + var File_tests_example_v1_validations_proto protoreflect.FileDescriptor var file_tests_example_v1_validations_proto_rawDesc = []byte{ @@ -516,6 +564,8 @@ var file_tests_example_v1_validations_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x67, 0x65, 0x6f, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x69, 0x65, 0x77, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x02, 0x0a, 0x0b, 0x48, 0x61, 0x73, 0x4d, 0x73, 0x67, @@ -626,6 +676,20 @@ var file_tests_example_v1_validations_proto_rawDesc = []byte{ 0x6b, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x68, 0x61, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x73, 0x29, 0x52, 0x04, 0x6d, 0x61, 0x73, 0x6b, + 0x22, 0xdd, 0x01, 0x0a, 0x27, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x53, 0x74, 0x65, + 0x70, 0x73, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x12, 0xb1, 0x01, 0x0a, + 0x08, 0x76, 0x69, 0x65, 0x77, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x65, 0x6f, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x7a, 0xba, 0x48, 0x77, 0xba, + 0x01, 0x74, 0x0a, 0x15, 0x76, 0x69, 0x65, 0x77, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x6c, 0x6f, 0x77, + 0x2e, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x41, 0x76, 0x69, 0x65, 0x77, 0x70, + 0x6f, 0x72, 0x74, 0x27, 0x73, 0x20, 0x6c, 0x6f, 0x77, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x27, + 0x73, 0x20, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, + 0x62, 0x65, 0x20, 0x67, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, + 0x31, 0x30, 0x2e, 0x30, 0x20, 0x64, 0x65, 0x67, 0x72, 0x65, 0x65, 0x73, 0x1a, 0x18, 0x74, 0x68, + 0x69, 0x73, 0x2e, 0x6c, 0x6f, 0x77, 0x2e, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x20, + 0x3e, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x52, 0x08, 0x76, 0x69, 0x65, 0x77, 0x70, 0x6f, 0x72, 0x74, 0x42, 0xd8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4c, 0x67, @@ -655,20 +719,22 @@ func file_tests_example_v1_validations_proto_rawDescGZIP() []byte { return file_tests_example_v1_validations_proto_rawDescData } -var file_tests_example_v1_validations_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_tests_example_v1_validations_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_tests_example_v1_validations_proto_goTypes = []interface{}{ - (*HasMsgExprs)(nil), // 0: tests.example.v1.HasMsgExprs - (*SelfRecursive)(nil), // 1: tests.example.v1.SelfRecursive - (*LoopRecursiveA)(nil), // 2: tests.example.v1.LoopRecursiveA - (*LoopRecursiveB)(nil), // 3: tests.example.v1.LoopRecursiveB - (*MsgHasOneof)(nil), // 4: tests.example.v1.MsgHasOneof - (*MsgHasRepeated)(nil), // 5: tests.example.v1.MsgHasRepeated - (*MsgHasMap)(nil), // 6: tests.example.v1.MsgHasMap - (*TransitiveFieldConstraint)(nil), // 7: tests.example.v1.TransitiveFieldConstraint - nil, // 8: tests.example.v1.MsgHasMap.Int32mapEntry - nil, // 9: tests.example.v1.MsgHasMap.StringMapEntry - nil, // 10: tests.example.v1.MsgHasMap.MessageMapEntry - (*fieldmaskpb.FieldMask)(nil), // 11: google.protobuf.FieldMask + (*HasMsgExprs)(nil), // 0: tests.example.v1.HasMsgExprs + (*SelfRecursive)(nil), // 1: tests.example.v1.SelfRecursive + (*LoopRecursiveA)(nil), // 2: tests.example.v1.LoopRecursiveA + (*LoopRecursiveB)(nil), // 3: tests.example.v1.LoopRecursiveB + (*MsgHasOneof)(nil), // 4: tests.example.v1.MsgHasOneof + (*MsgHasRepeated)(nil), // 5: tests.example.v1.MsgHasRepeated + (*MsgHasMap)(nil), // 6: tests.example.v1.MsgHasMap + (*TransitiveFieldConstraint)(nil), // 7: tests.example.v1.TransitiveFieldConstraint + (*MultipleStepsTransitiveFieldConstraints)(nil), // 8: tests.example.v1.MultipleStepsTransitiveFieldConstraints + nil, // 9: tests.example.v1.MsgHasMap.Int32mapEntry + nil, // 10: tests.example.v1.MsgHasMap.StringMapEntry + nil, // 11: tests.example.v1.MsgHasMap.MessageMapEntry + (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask + (*viewport.Viewport)(nil), // 13: google.geo.type.Viewport } var file_tests_example_v1_validations_proto_depIdxs = []int32{ 1, // 0: tests.example.v1.SelfRecursive.turtle:type_name -> tests.example.v1.SelfRecursive @@ -676,16 +742,17 @@ var file_tests_example_v1_validations_proto_depIdxs = []int32{ 2, // 2: tests.example.v1.LoopRecursiveB.a:type_name -> tests.example.v1.LoopRecursiveA 0, // 3: tests.example.v1.MsgHasOneof.msg:type_name -> tests.example.v1.HasMsgExprs 0, // 4: tests.example.v1.MsgHasRepeated.z:type_name -> tests.example.v1.HasMsgExprs - 8, // 5: tests.example.v1.MsgHasMap.int32map:type_name -> tests.example.v1.MsgHasMap.Int32mapEntry - 9, // 6: tests.example.v1.MsgHasMap.string_map:type_name -> tests.example.v1.MsgHasMap.StringMapEntry - 10, // 7: tests.example.v1.MsgHasMap.message_map:type_name -> tests.example.v1.MsgHasMap.MessageMapEntry - 11, // 8: tests.example.v1.TransitiveFieldConstraint.mask:type_name -> google.protobuf.FieldMask - 2, // 9: tests.example.v1.MsgHasMap.MessageMapEntry.value:type_name -> tests.example.v1.LoopRecursiveA - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 9, // 5: tests.example.v1.MsgHasMap.int32map:type_name -> tests.example.v1.MsgHasMap.Int32mapEntry + 10, // 6: tests.example.v1.MsgHasMap.string_map:type_name -> tests.example.v1.MsgHasMap.StringMapEntry + 11, // 7: tests.example.v1.MsgHasMap.message_map:type_name -> tests.example.v1.MsgHasMap.MessageMapEntry + 12, // 8: tests.example.v1.TransitiveFieldConstraint.mask:type_name -> google.protobuf.FieldMask + 13, // 9: tests.example.v1.MultipleStepsTransitiveFieldConstraints.viewport:type_name -> google.geo.type.Viewport + 2, // 10: tests.example.v1.MsgHasMap.MessageMapEntry.value:type_name -> tests.example.v1.LoopRecursiveA + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_tests_example_v1_validations_proto_init() } @@ -790,6 +857,18 @@ func file_tests_example_v1_validations_proto_init() { return nil } } + file_tests_example_v1_validations_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MultipleStepsTransitiveFieldConstraints); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_tests_example_v1_validations_proto_msgTypes[4].OneofWrappers = []interface{}{ (*MsgHasOneof_X)(nil), @@ -802,7 +881,7 @@ func file_tests_example_v1_validations_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_tests_example_v1_validations_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 12, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/buf.lock b/proto/buf.lock index 88097ab..cdaff59 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -16,3 +16,8 @@ deps: repository: protoc-gen-validate commit: eac44469a7af47e7839a7f1f3d7ac004 digest: shake256:0feabcde01b6b11e3c75a5e3f807968d5995626546f39c37e5d4205892b3a59cced0ed83b35a2eb9e6dddd3309660ad46b737c9dcd224b425de0a6654ce04417 + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 28151c0d0a1641bf938a7672c500e01d + digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de diff --git a/proto/buf.yaml b/proto/buf.yaml index bbcdd14..d9c965b 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -3,6 +3,7 @@ deps: - buf.build/bufbuild/protovalidate - buf.build/bufbuild/protovalidate-testing - buf.build/envoyproxy/protoc-gen-validate + - buf.build/googleapis/googleapis breaking: use: - FILE diff --git a/proto/tests/example/v1/validations.proto b/proto/tests/example/v1/validations.proto index e45b156..67ac4ea 100644 --- a/proto/tests/example/v1/validations.proto +++ b/proto/tests/example/v1/validations.proto @@ -17,6 +17,7 @@ syntax = "proto3"; package tests.example.v1; import "buf/validate/validate.proto"; +import "google/geo/type/viewport.proto"; import "google/protobuf/field_mask.proto"; message HasMsgExprs { @@ -131,3 +132,11 @@ message TransitiveFieldConstraint { expression: "has(this.paths)", }]; } + +message MultipleStepsTransitiveFieldConstraints { + google.geo.type.Viewport viewport = 1 [(buf.validate.field).cel = { + id: "viewport.low.latitude", + message: "viewport's low point's latitude must be greater than 10.0 degrees", + expression: "this.low.latitude > 10.0" + }]; +} diff --git a/validator_test.go b/validator_test.go index ea7d985..e89927d 100644 --- a/validator_test.go +++ b/validator_test.go @@ -20,6 +20,8 @@ import ( pb "github.com/bufbuild/protovalidate-go/internal/gen/tests/example/v1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "google.golang.org/genproto/googleapis/geo/type/viewport" + "google.golang.org/genproto/googleapis/type/latlng" "google.golang.org/protobuf/types/known/fieldmaskpb" ) @@ -135,3 +137,18 @@ func TestValidator_Validate_TransitiveFieldConstraints(t *testing.T) { err = val.Validate(msg) require.NoError(t, err) } + +func TestValidator_Validate_MultipleStepsTransitiveFieldConstraints(t *testing.T) { + t.Parallel() + val, err := New() + require.NoError(t, err) + msg := &pb.MultipleStepsTransitiveFieldConstraints{ + Viewport: &viewport.Viewport{ + Low: &latlng.LatLng{ + Latitude: 30.0, + }, + }, + } + err = val.Validate(msg) + require.NoError(t, err) +} From 265fd0f76f7d106f3f550a7d91427d1b2585b7b9 Mon Sep 17 00:00:00 2001 From: Oliver Sun Date: Thu, 28 Sep 2023 19:26:10 -0400 Subject: [PATCH 2/7] format --- validator_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validator_test.go b/validator_test.go index e89927d..d8f2ef8 100644 --- a/validator_test.go +++ b/validator_test.go @@ -149,6 +149,6 @@ func TestValidator_Validate_MultipleStepsTransitiveFieldConstraints(t *testing.T }, }, } - err = val.Validate(msg) - require.NoError(t, err) + err = val.Validate(msg) + require.NoError(t, err) } From 9803e721a00a7d15a2d4719c8c1c4c29d28f82e2 Mon Sep 17 00:00:00 2001 From: Oliver Sun Date: Thu, 28 Sep 2023 19:27:49 -0400 Subject: [PATCH 3/7] whitespace --- validator_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/validator_test.go b/validator_test.go index d8f2ef8..92117f6 100644 --- a/validator_test.go +++ b/validator_test.go @@ -143,12 +143,12 @@ func TestValidator_Validate_MultipleStepsTransitiveFieldConstraints(t *testing.T val, err := New() require.NoError(t, err) msg := &pb.MultipleStepsTransitiveFieldConstraints{ - Viewport: &viewport.Viewport{ - Low: &latlng.LatLng{ - Latitude: 30.0, - }, - }, - } - err = val.Validate(msg) - require.NoError(t, err) + Viewport: &viewport.Viewport{ + Low: &latlng.LatLng{ + Latitude: 30.0, + }, + }, + } + err = val.Validate(msg) + require.NoError(t, err) } From a4a7aa6caaf320a5900f3297b1f6b0fabe73ff22 Mon Sep 17 00:00:00 2001 From: Oliver Sun Date: Thu, 28 Sep 2023 19:28:41 -0400 Subject: [PATCH 4/7] whitespace --- internal/evaluator/builder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/evaluator/builder.go b/internal/evaluator/builder.go index d0f8da4..7410247 100644 --- a/internal/evaluator/builder.go +++ b/internal/evaluator/builder.go @@ -268,7 +268,7 @@ func (bldr *Builder) processFieldExpressions( var opts []cel.EnvOption if fieldDesc.Kind() == protoreflect.MessageKind { opts = []cel.EnvOption{ - cel.Types(dynamicpb.NewMessage(fieldDesc.Message())), + cel.Types(dynamicpb.NewMessage(fieldDesc.Message())), cel.Variable("this", cel.ObjectType(string(fieldDesc.Message().FullName()))), } } else { From c150b3dcf3fbff75dece5ff53c473e5a45de22b7 Mon Sep 17 00:00:00 2001 From: Oliver Sun Date: Fri, 29 Sep 2023 10:33:07 -0400 Subject: [PATCH 5/7] c --- go.mod | 1 + go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index f741f53..f2d2973 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/envoyproxy/protoc-gen-validate v1.0.2 github.com/google/cel-go v0.18.0 github.com/stretchr/testify v1.8.4 + google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 google.golang.org/protobuf v1.31.0 ) diff --git a/go.sum b/go.sum index 6ee5263..2dee793 100644 --- a/go.sum +++ b/go.sum @@ -36,6 +36,8 @@ golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqR golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb h1:lK0oleSc7IQsUxO3U5TjL9DWlsxpEBemh+zpB7IqhWI= google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb h1:Isk1sSH7bovx8Rti2wZK0UZF6oraBDK74uoyLEEVFN0= From f0cf887450ee8d48f9b396b97f34cb016bf0ca3b Mon Sep 17 00:00:00 2001 From: Oliver Sun Date: Fri, 29 Sep 2023 10:47:09 -0400 Subject: [PATCH 6/7] c --- buf.gen.yaml | 1 - go.mod | 1 - go.sum | 2 - .../gen/tests/example/v1/validations.pb.go | 290 +++++++++--------- proto/buf.yaml | 1 - proto/tests/example/v1/validations.proto | 10 +- validator_test.go | 10 +- 7 files changed, 154 insertions(+), 161 deletions(-) diff --git a/buf.gen.yaml b/buf.gen.yaml index 915aee5..0e42127 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -6,7 +6,6 @@ managed: except: - buf.build/envoyproxy/protoc-gen-validate - buf.build/bufbuild/protovalidate - - buf.build/googleapis/googleapis plugins: - plugin: buf.build/protocolbuffers/go:v1.31.0 out: internal/gen diff --git a/go.mod b/go.mod index f2d2973..f741f53 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/envoyproxy/protoc-gen-validate v1.0.2 github.com/google/cel-go v0.18.0 github.com/stretchr/testify v1.8.4 - google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 google.golang.org/protobuf v1.31.0 ) diff --git a/go.sum b/go.sum index 2dee793..6ee5263 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,6 @@ golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqR golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb h1:lK0oleSc7IQsUxO3U5TjL9DWlsxpEBemh+zpB7IqhWI= google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb h1:Isk1sSH7bovx8Rti2wZK0UZF6oraBDK74uoyLEEVFN0= diff --git a/internal/gen/tests/example/v1/validations.pb.go b/internal/gen/tests/example/v1/validations.pb.go index ed00da9..8787061 100644 --- a/internal/gen/tests/example/v1/validations.pb.go +++ b/internal/gen/tests/example/v1/validations.pb.go @@ -22,9 +22,9 @@ package examplev1 import ( _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" - viewport "google.golang.org/genproto/googleapis/geo/type/viewport" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + apipb "google.golang.org/protobuf/types/known/apipb" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" reflect "reflect" sync "sync" @@ -514,7 +514,7 @@ type MultipleStepsTransitiveFieldConstraints struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Viewport *viewport.Viewport `protobuf:"bytes,1,opt,name=viewport,proto3" json:"viewport,omitempty"` + Api *apipb.Api `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` } func (x *MultipleStepsTransitiveFieldConstraints) Reset() { @@ -549,9 +549,9 @@ func (*MultipleStepsTransitiveFieldConstraints) Descriptor() ([]byte, []int) { return file_tests_example_v1_validations_proto_rawDescGZIP(), []int{8} } -func (x *MultipleStepsTransitiveFieldConstraints) GetViewport() *viewport.Viewport { +func (x *MultipleStepsTransitiveFieldConstraints) GetApi() *apipb.Api { if x != nil { - return x.Viewport + return x.Api } return nil } @@ -564,147 +564,145 @@ var file_tests_example_v1_validations_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x67, 0x65, 0x6f, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x69, 0x65, 0x77, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x02, 0x0a, 0x0b, 0x48, 0x61, 0x73, 0x4d, 0x73, 0x67, - 0x45, 0x78, 0x70, 0x72, 0x73, 0x12, 0x7f, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x42, 0x71, 0xba, 0x48, 0x6e, 0xba, 0x01, 0x27, 0x0a, 0x06, 0x78, 0x5f, 0x65, 0x76, 0x65, 0x6e, - 0x12, 0x0e, 0x78, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x65, 0x76, 0x65, 0x6e, - 0x1a, 0x0d, 0x74, 0x68, 0x69, 0x73, 0x20, 0x25, 0x20, 0x32, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0xba, - 0x01, 0x41, 0x0a, 0x0b, 0x78, 0x5f, 0x63, 0x6f, 0x70, 0x72, 0x69, 0x6d, 0x65, 0x5f, 0x33, 0x1a, - 0x32, 0x74, 0x68, 0x69, 0x73, 0x20, 0x25, 0x20, 0x33, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x20, 0x3f, - 0x20, 0x27, 0x27, 0x3a, 0x20, 0x27, 0x78, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x6e, 0x6f, 0x74, - 0x20, 0x62, 0x65, 0x20, 0x64, 0x69, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x20, 0x62, 0x79, - 0x20, 0x33, 0x27, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x01, 0x79, 0x3a, 0x6f, 0xba, 0x48, 0x6c, 0x1a, 0x30, 0x0a, 0x06, 0x78, 0x5f, 0x6c, - 0x74, 0x5f, 0x79, 0x12, 0x15, 0x78, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x6c, - 0x65, 0x73, 0x73, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x79, 0x1a, 0x0f, 0x74, 0x68, 0x69, 0x73, - 0x2e, 0x78, 0x20, 0x3c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x79, 0x1a, 0x38, 0x0a, 0x07, 0x79, - 0x5f, 0x67, 0x74, 0x5f, 0x34, 0x32, 0x1a, 0x2d, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x79, 0x20, 0x3e, - 0x20, 0x34, 0x32, 0x20, 0x3f, 0x20, 0x27, 0x27, 0x3a, 0x20, 0x27, 0x79, 0x20, 0x6d, 0x75, 0x73, - 0x74, 0x20, 0x62, 0x65, 0x20, 0x67, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, - 0x6e, 0x20, 0x34, 0x32, 0x27, 0x22, 0xfe, 0x01, 0x0a, 0x0d, 0x53, 0x65, 0x6c, 0x66, 0x52, 0x65, - 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x8d, 0x01, 0x0a, 0x06, 0x74, 0x75, 0x72, 0x74, 0x6c, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6c, 0x66, 0x52, 0x65, - 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x42, 0x54, 0xba, 0x48, 0x51, 0xba, 0x01, 0x4e, 0x0a, - 0x14, 0x6e, 0x6f, 0x6e, 0x5f, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x62, 0x61, 0x62, 0x79, 0x5f, 0x74, - 0x75, 0x72, 0x74, 0x6c, 0x65, 0x12, 0x2a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, - 0x74, 0x75, 0x72, 0x74, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x78, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x7a, 0x65, 0x72, - 0x6f, 0x1a, 0x0a, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x78, 0x20, 0x3e, 0x20, 0x30, 0x52, 0x06, 0x74, - 0x75, 0x72, 0x74, 0x6c, 0x65, 0x3a, 0x4f, 0xba, 0x48, 0x4c, 0x1a, 0x4a, 0x0a, 0x0e, 0x75, 0x6e, - 0x69, 0x71, 0x75, 0x65, 0x5f, 0x74, 0x75, 0x72, 0x74, 0x6c, 0x65, 0x73, 0x12, 0x1f, 0x61, 0x64, - 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x75, 0x72, 0x74, 0x6c, 0x65, 0x73, 0x20, 0x6d, - 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x1a, 0x17, 0x74, - 0x68, 0x69, 0x73, 0x2e, 0x78, 0x20, 0x21, 0x3d, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x74, 0x75, - 0x72, 0x74, 0x6c, 0x65, 0x2e, 0x78, 0x22, 0x40, 0x0a, 0x0e, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, - 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x41, 0x12, 0x2e, 0x0a, 0x01, 0x62, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x63, 0x75, 0x72, - 0x73, 0x69, 0x76, 0x65, 0x42, 0x52, 0x01, 0x62, 0x22, 0x40, 0x0a, 0x0e, 0x4c, 0x6f, 0x6f, 0x70, - 0x52, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x42, 0x12, 0x2e, 0x0a, 0x01, 0x61, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x63, - 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x41, 0x52, 0x01, 0x61, 0x22, 0xfb, 0x01, 0x0a, 0x0b, 0x4d, - 0x73, 0x67, 0x48, 0x61, 0x73, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x1a, 0x0a, 0x01, 0x78, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x3a, 0x03, 0x66, 0x6f, - 0x6f, 0x48, 0x00, 0x52, 0x01, 0x78, 0x12, 0x17, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x42, 0x07, 0xba, 0x48, 0x04, 0x1a, 0x02, 0x20, 0x00, 0x48, 0x00, 0x52, 0x01, 0x79, 0x12, - 0x31, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x48, 0x61, 0x73, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x70, 0x72, 0x73, 0x48, 0x00, 0x52, 0x03, 0x6d, - 0x73, 0x67, 0x3a, 0x78, 0xba, 0x48, 0x75, 0x1a, 0x5c, 0x0a, 0x06, 0x74, 0x65, 0x73, 0x74, 0x20, - 0x78, 0x1a, 0x52, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x78, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x27, 0x20, - 0x3f, 0x20, 0x27, 0x27, 0x20, 0x3a, 0x20, 0x0a, 0x21, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x78, 0x2e, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x73, 0x57, 0x69, 0x74, 0x68, 0x28, 0x27, 0x66, 0x6f, 0x6f, 0x27, - 0x29, 0x20, 0x3f, 0x20, 0x27, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x68, 0x61, - 0x76, 0x65, 0x20, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x60, 0x66, 0x6f, 0x6f, 0x60, 0x27, - 0x20, 0x3a, 0x20, 0x27, 0x27, 0x1a, 0x15, 0x0a, 0x06, 0x74, 0x65, 0x78, 0x74, 0x20, 0x79, 0x1a, - 0x0b, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x79, 0x20, 0x3e, 0x3d, 0x20, 0x30, 0x42, 0x0a, 0x0a, 0x01, - 0x6f, 0x12, 0x05, 0xba, 0x48, 0x02, 0x08, 0x01, 0x22, 0xa0, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, - 0x48, 0x61, 0x73, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3f, 0x0a, 0x01, 0x78, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x02, 0x42, 0x31, 0xba, 0x48, 0x2e, 0x92, 0x01, 0x2b, 0x08, 0x01, - 0x10, 0x03, 0x18, 0x01, 0x22, 0x23, 0xba, 0x01, 0x19, 0x12, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x1a, 0x04, 0x74, 0x72, - 0x75, 0x65, 0x0a, 0x05, 0x25, 0x00, 0x00, 0x00, 0x00, 0x52, 0x01, 0x78, 0x12, 0x16, 0x0a, 0x01, - 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x18, - 0x01, 0x52, 0x01, 0x79, 0x12, 0x35, 0x0a, 0x01, 0x7a, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x48, 0x61, 0x73, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x70, 0x72, 0x73, 0x42, 0x08, - 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x10, 0x02, 0x52, 0x01, 0x7a, 0x22, 0xf1, 0x03, 0x0a, 0x09, - 0x4d, 0x73, 0x67, 0x48, 0x61, 0x73, 0x4d, 0x61, 0x70, 0x12, 0x5b, 0x0a, 0x08, 0x69, 0x6e, 0x74, - 0x33, 0x32, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x74, 0x65, + 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x8d, 0x02, 0x0a, 0x0b, 0x48, 0x61, 0x73, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x70, 0x72, 0x73, + 0x12, 0x7f, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x71, 0xba, 0x48, 0x6e, + 0xba, 0x01, 0x27, 0x0a, 0x06, 0x78, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x12, 0x0e, 0x78, 0x20, 0x6d, + 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x1a, 0x0d, 0x74, 0x68, 0x69, + 0x73, 0x20, 0x25, 0x20, 0x32, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0xba, 0x01, 0x41, 0x0a, 0x0b, 0x78, + 0x5f, 0x63, 0x6f, 0x70, 0x72, 0x69, 0x6d, 0x65, 0x5f, 0x33, 0x1a, 0x32, 0x74, 0x68, 0x69, 0x73, + 0x20, 0x25, 0x20, 0x33, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x20, 0x3f, 0x20, 0x27, 0x27, 0x3a, 0x20, + 0x27, 0x78, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x64, + 0x69, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x20, 0x62, 0x79, 0x20, 0x33, 0x27, 0x52, 0x01, + 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x3a, + 0x6f, 0xba, 0x48, 0x6c, 0x1a, 0x30, 0x0a, 0x06, 0x78, 0x5f, 0x6c, 0x74, 0x5f, 0x79, 0x12, 0x15, + 0x78, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x6c, 0x65, 0x73, 0x73, 0x20, 0x74, + 0x68, 0x61, 0x6e, 0x20, 0x79, 0x1a, 0x0f, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x78, 0x20, 0x3c, 0x20, + 0x74, 0x68, 0x69, 0x73, 0x2e, 0x79, 0x1a, 0x38, 0x0a, 0x07, 0x79, 0x5f, 0x67, 0x74, 0x5f, 0x34, + 0x32, 0x1a, 0x2d, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x79, 0x20, 0x3e, 0x20, 0x34, 0x32, 0x20, 0x3f, + 0x20, 0x27, 0x27, 0x3a, 0x20, 0x27, 0x79, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, + 0x67, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x34, 0x32, 0x27, + 0x22, 0xfe, 0x01, 0x0a, 0x0d, 0x53, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, + 0x76, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, + 0x12, 0x8d, 0x01, 0x0a, 0x06, 0x74, 0x75, 0x72, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, + 0x76, 0x65, 0x42, 0x54, 0xba, 0x48, 0x51, 0xba, 0x01, 0x4e, 0x0a, 0x14, 0x6e, 0x6f, 0x6e, 0x5f, + 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x62, 0x61, 0x62, 0x79, 0x5f, 0x74, 0x75, 0x72, 0x74, 0x6c, 0x65, + 0x12, 0x2a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x74, 0x75, 0x72, 0x74, 0x6c, + 0x65, 0x27, 0x73, 0x20, 0x78, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, + 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x7a, 0x65, 0x72, 0x6f, 0x1a, 0x0a, 0x74, 0x68, + 0x69, 0x73, 0x2e, 0x78, 0x20, 0x3e, 0x20, 0x30, 0x52, 0x06, 0x74, 0x75, 0x72, 0x74, 0x6c, 0x65, + 0x3a, 0x4f, 0xba, 0x48, 0x4c, 0x1a, 0x4a, 0x0a, 0x0e, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, + 0x74, 0x75, 0x72, 0x74, 0x6c, 0x65, 0x73, 0x12, 0x1f, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, + 0x74, 0x20, 0x74, 0x75, 0x72, 0x74, 0x6c, 0x65, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, + 0x65, 0x20, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x1a, 0x17, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x78, + 0x20, 0x21, 0x3d, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x74, 0x75, 0x72, 0x74, 0x6c, 0x65, 0x2e, + 0x78, 0x22, 0x40, 0x0a, 0x0e, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, + 0x76, 0x65, 0x41, 0x12, 0x2e, 0x0a, 0x01, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x42, + 0x52, 0x01, 0x62, 0x22, 0x40, 0x0a, 0x0e, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x63, 0x75, 0x72, + 0x73, 0x69, 0x76, 0x65, 0x42, 0x12, 0x2e, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, + 0x65, 0x41, 0x52, 0x01, 0x61, 0x22, 0xfb, 0x01, 0x0a, 0x0b, 0x4d, 0x73, 0x67, 0x48, 0x61, 0x73, + 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x1a, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x3a, 0x03, 0x66, 0x6f, 0x6f, 0x48, 0x00, 0x52, 0x01, + 0x78, 0x12, 0x17, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x07, 0xba, 0x48, + 0x04, 0x1a, 0x02, 0x20, 0x00, 0x48, 0x00, 0x52, 0x01, 0x79, 0x12, 0x31, 0x0a, 0x03, 0x6d, 0x73, + 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, + 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x61, 0x73, 0x4d, 0x73, + 0x67, 0x45, 0x78, 0x70, 0x72, 0x73, 0x48, 0x00, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x3a, 0x78, 0xba, + 0x48, 0x75, 0x1a, 0x5c, 0x0a, 0x06, 0x74, 0x65, 0x73, 0x74, 0x20, 0x78, 0x1a, 0x52, 0x74, 0x68, + 0x69, 0x73, 0x2e, 0x78, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x27, 0x20, 0x3f, 0x20, 0x27, 0x27, 0x20, + 0x3a, 0x20, 0x0a, 0x21, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x78, 0x2e, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x73, 0x57, 0x69, 0x74, 0x68, 0x28, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x29, 0x20, 0x3f, 0x20, 0x27, + 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x70, 0x72, + 0x65, 0x66, 0x69, 0x78, 0x20, 0x60, 0x66, 0x6f, 0x6f, 0x60, 0x27, 0x20, 0x3a, 0x20, 0x27, 0x27, + 0x1a, 0x15, 0x0a, 0x06, 0x74, 0x65, 0x78, 0x74, 0x20, 0x79, 0x1a, 0x0b, 0x74, 0x68, 0x69, 0x73, + 0x2e, 0x79, 0x20, 0x3e, 0x3d, 0x20, 0x30, 0x42, 0x0a, 0x0a, 0x01, 0x6f, 0x12, 0x05, 0xba, 0x48, + 0x02, 0x08, 0x01, 0x22, 0xa0, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x48, 0x61, 0x73, 0x52, 0x65, + 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3f, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x02, 0x42, 0x31, 0xba, 0x48, 0x2e, 0x92, 0x01, 0x2b, 0x08, 0x01, 0x10, 0x03, 0x18, 0x01, 0x22, + 0x23, 0xba, 0x01, 0x19, 0x12, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6c, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x1a, 0x04, 0x74, 0x72, 0x75, 0x65, 0x0a, 0x05, 0x25, + 0x00, 0x00, 0x00, 0x00, 0x52, 0x01, 0x78, 0x12, 0x16, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x18, 0x01, 0x52, 0x01, 0x79, 0x12, + 0x35, 0x0a, 0x01, 0x7a, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x61, + 0x73, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x70, 0x72, 0x73, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, + 0x02, 0x10, 0x02, 0x52, 0x01, 0x7a, 0x22, 0xf1, 0x03, 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x48, 0x61, + 0x73, 0x4d, 0x61, 0x70, 0x12, 0x5b, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x6d, 0x61, 0x70, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, + 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x48, 0x61, 0x73, + 0x4d, 0x61, 0x70, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x42, 0x14, 0xba, 0x48, 0x11, 0x9a, 0x01, 0x0e, 0x08, 0x03, 0x22, 0x04, 0x1a, 0x02, 0x20, + 0x00, 0x2a, 0x04, 0x1a, 0x02, 0x10, 0x00, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x6d, 0x61, + 0x70, 0x12, 0x53, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x48, 0x61, 0x73, 0x4d, + 0x61, 0x70, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x42, 0x08, 0xba, 0x48, 0x05, 0x9a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x09, 0x73, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x12, 0x56, 0x0a, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x48, 0x61, 0x73, 0x4d, 0x61, 0x70, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x6d, 0x61, - 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x14, 0xba, 0x48, 0x11, 0x9a, 0x01, 0x0e, 0x08, 0x03, - 0x22, 0x04, 0x1a, 0x02, 0x20, 0x00, 0x2a, 0x04, 0x1a, 0x02, 0x10, 0x00, 0x52, 0x08, 0x69, 0x6e, - 0x74, 0x33, 0x32, 0x6d, 0x61, 0x70, 0x12, 0x53, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x48, 0x61, 0x73, 0x4d, 0x61, 0x70, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, - 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x08, 0xba, 0x48, 0x05, 0x9a, 0x01, 0x02, 0x10, 0x01, - 0x52, 0x09, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x12, 0x56, 0x0a, 0x0b, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x2b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x48, 0x61, 0x73, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x08, 0xba, - 0x48, 0x05, 0x9a, 0x01, 0x02, 0x08, 0x02, 0x52, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x4d, 0x61, 0x70, 0x1a, 0x3b, 0x0a, 0x0d, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x6d, 0x61, 0x70, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x1a, 0x3c, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5f, - 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x63, 0x75, 0x72, 0x73, - 0x69, 0x76, 0x65, 0x41, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, - 0x8e, 0x01, 0x0a, 0x19, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x12, 0x71, 0x0a, - 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x42, 0x41, 0xba, 0x48, 0x3e, 0xba, 0x01, 0x3b, 0x0a, - 0x0a, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x1c, 0x6d, 0x61, 0x73, - 0x6b, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x6e, 0x6f, 0x74, - 0x20, 0x62, 0x65, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x68, 0x61, 0x73, 0x28, 0x74, - 0x68, 0x69, 0x73, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x73, 0x29, 0x52, 0x04, 0x6d, 0x61, 0x73, 0x6b, - 0x22, 0xdd, 0x01, 0x0a, 0x27, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x53, 0x74, 0x65, - 0x70, 0x73, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x12, 0xb1, 0x01, 0x0a, - 0x08, 0x76, 0x69, 0x65, 0x77, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x65, 0x6f, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x7a, 0xba, 0x48, 0x77, 0xba, - 0x01, 0x74, 0x0a, 0x15, 0x76, 0x69, 0x65, 0x77, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x6c, 0x6f, 0x77, - 0x2e, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x41, 0x76, 0x69, 0x65, 0x77, 0x70, - 0x6f, 0x72, 0x74, 0x27, 0x73, 0x20, 0x6c, 0x6f, 0x77, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x27, - 0x73, 0x20, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, - 0x62, 0x65, 0x20, 0x67, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, - 0x31, 0x30, 0x2e, 0x30, 0x20, 0x64, 0x65, 0x67, 0x72, 0x65, 0x65, 0x73, 0x1a, 0x18, 0x74, 0x68, - 0x69, 0x73, 0x2e, 0x6c, 0x6f, 0x77, 0x2e, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x20, - 0x3e, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x52, 0x08, 0x76, 0x69, 0x65, 0x77, 0x70, 0x6f, 0x72, 0x74, - 0x42, 0xd8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4c, 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, - 0x2d, 0x67, 0x6f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, - 0x2f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x76, - 0x31, 0x3b, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x54, 0x45, - 0x58, 0xaa, 0x02, 0x10, 0x54, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, - 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x54, 0x65, 0x73, 0x74, 0x73, 0x5c, 0x45, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x54, 0x65, 0x73, 0x74, 0x73, 0x5c, - 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x54, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x3a, - 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x73, 0x67, 0x48, 0x61, 0x73, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x08, 0xba, 0x48, 0x05, 0x9a, 0x01, 0x02, + 0x08, 0x02, 0x52, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4d, 0x61, 0x70, 0x1a, 0x3b, + 0x0a, 0x0d, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3c, 0x0a, 0x0e, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5f, 0x0a, 0x0f, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x36, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x41, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x8e, 0x01, 0x0a, 0x19, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, + 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x12, 0x71, 0x0a, 0x04, 0x6d, 0x61, 0x73, 0x6b, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, + 0x73, 0x6b, 0x42, 0x41, 0xba, 0x48, 0x3e, 0xba, 0x01, 0x3b, 0x0a, 0x0a, 0x6d, 0x61, 0x73, 0x6b, + 0x2e, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x1c, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x61, 0x74, + 0x68, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x65, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x68, 0x61, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x70, + 0x61, 0x74, 0x68, 0x73, 0x29, 0x52, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x22, 0xce, 0x01, 0x0a, 0x27, + 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x53, 0x74, 0x65, 0x70, 0x73, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x73, + 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x12, 0xa2, 0x01, 0x0a, 0x03, 0x61, 0x70, 0x69, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x70, 0x69, 0x42, 0x7a, 0xba, 0x48, 0x77, + 0xba, 0x01, 0x74, 0x0a, 0x1c, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x30, 0x61, 0x70, 0x69, 0x27, 0x73, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x61, 0x6d, + 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x1a, 0x22, 0x68, 0x61, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x66, 0x69, 0x6c, + 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x29, 0x52, 0x03, 0x61, 0x70, 0x69, 0x42, 0xd8, 0x01, 0x0a, + 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4c, 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, 0x2d, 0x67, 0x6f, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x74, 0x65, 0x73, + 0x74, 0x73, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x78, + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x54, 0x45, 0x58, 0xaa, 0x02, 0x10, + 0x54, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x56, 0x31, + 0xca, 0x02, 0x10, 0x54, 0x65, 0x73, 0x74, 0x73, 0x5c, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, + 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x54, 0x65, 0x73, 0x74, 0x73, 0x5c, 0x45, 0x78, 0x61, 0x6d, + 0x70, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x12, 0x54, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x3a, 0x45, 0x78, 0x61, 0x6d, + 0x70, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -734,7 +732,7 @@ var file_tests_example_v1_validations_proto_goTypes = []interface{}{ nil, // 10: tests.example.v1.MsgHasMap.StringMapEntry nil, // 11: tests.example.v1.MsgHasMap.MessageMapEntry (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask - (*viewport.Viewport)(nil), // 13: google.geo.type.Viewport + (*apipb.Api)(nil), // 13: google.protobuf.Api } var file_tests_example_v1_validations_proto_depIdxs = []int32{ 1, // 0: tests.example.v1.SelfRecursive.turtle:type_name -> tests.example.v1.SelfRecursive @@ -746,7 +744,7 @@ var file_tests_example_v1_validations_proto_depIdxs = []int32{ 10, // 6: tests.example.v1.MsgHasMap.string_map:type_name -> tests.example.v1.MsgHasMap.StringMapEntry 11, // 7: tests.example.v1.MsgHasMap.message_map:type_name -> tests.example.v1.MsgHasMap.MessageMapEntry 12, // 8: tests.example.v1.TransitiveFieldConstraint.mask:type_name -> google.protobuf.FieldMask - 13, // 9: tests.example.v1.MultipleStepsTransitiveFieldConstraints.viewport:type_name -> google.geo.type.Viewport + 13, // 9: tests.example.v1.MultipleStepsTransitiveFieldConstraints.api:type_name -> google.protobuf.Api 2, // 10: tests.example.v1.MsgHasMap.MessageMapEntry.value:type_name -> tests.example.v1.LoopRecursiveA 11, // [11:11] is the sub-list for method output_type 11, // [11:11] is the sub-list for method input_type diff --git a/proto/buf.yaml b/proto/buf.yaml index d9c965b..bbcdd14 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -3,7 +3,6 @@ deps: - buf.build/bufbuild/protovalidate - buf.build/bufbuild/protovalidate-testing - buf.build/envoyproxy/protoc-gen-validate - - buf.build/googleapis/googleapis breaking: use: - FILE diff --git a/proto/tests/example/v1/validations.proto b/proto/tests/example/v1/validations.proto index 67ac4ea..8248e65 100644 --- a/proto/tests/example/v1/validations.proto +++ b/proto/tests/example/v1/validations.proto @@ -17,7 +17,7 @@ syntax = "proto3"; package tests.example.v1; import "buf/validate/validate.proto"; -import "google/geo/type/viewport.proto"; +import "google/protobuf/api.proto"; import "google/protobuf/field_mask.proto"; message HasMsgExprs { @@ -134,9 +134,9 @@ message TransitiveFieldConstraint { } message MultipleStepsTransitiveFieldConstraints { - google.geo.type.Viewport viewport = 1 [(buf.validate.field).cel = { - id: "viewport.low.latitude", - message: "viewport's low point's latitude must be greater than 10.0 degrees", - expression: "this.low.latitude > 10.0" + google.protobuf.Api api = 1 [(buf.validate.field).cel = { + id: "api.source_context.file_name", + message: "api's source context file name must not be empty", + expression: "has(this.source_context.file_name)" }]; } diff --git a/validator_test.go b/validator_test.go index 92117f6..cd5d1ec 100644 --- a/validator_test.go +++ b/validator_test.go @@ -20,9 +20,9 @@ import ( pb "github.com/bufbuild/protovalidate-go/internal/gen/tests/example/v1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "google.golang.org/genproto/googleapis/geo/type/viewport" - "google.golang.org/genproto/googleapis/type/latlng" + "google.golang.org/protobuf/types/known/apipb" "google.golang.org/protobuf/types/known/fieldmaskpb" + "google.golang.org/protobuf/types/known/sourcecontextpb" ) func TestValidator_Validate(t *testing.T) { @@ -143,9 +143,9 @@ func TestValidator_Validate_MultipleStepsTransitiveFieldConstraints(t *testing.T val, err := New() require.NoError(t, err) msg := &pb.MultipleStepsTransitiveFieldConstraints{ - Viewport: &viewport.Viewport{ - Low: &latlng.LatLng{ - Latitude: 30.0, + Api: &apipb.Api{ + SourceContext: &sourcecontextpb.SourceContext{ + FileName: "path/file", }, }, } From b97b3251fc87e2e6b19c9c7bb8e9b6b7fe195b61 Mon Sep 17 00:00:00 2001 From: Oliver Sun Date: Fri, 29 Sep 2023 10:48:13 -0400 Subject: [PATCH 7/7] c --- proto/buf.lock | 5 ----- 1 file changed, 5 deletions(-) diff --git a/proto/buf.lock b/proto/buf.lock index cdaff59..88097ab 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -16,8 +16,3 @@ deps: repository: protoc-gen-validate commit: eac44469a7af47e7839a7f1f3d7ac004 digest: shake256:0feabcde01b6b11e3c75a5e3f807968d5995626546f39c37e5d4205892b3a59cced0ed83b35a2eb9e6dddd3309660ad46b737c9dcd224b425de0a6654ce04417 - - remote: buf.build - owner: googleapis - repository: googleapis - commit: 28151c0d0a1641bf938a7672c500e01d - digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de