diff --git a/fieldbehavior/fieldbehavior_test.go b/fieldbehavior/fieldbehavior_test.go index 69667bfc35..d3fe5e3b85 100644 --- a/fieldbehavior/fieldbehavior_test.go +++ b/fieldbehavior/fieldbehavior_test.go @@ -13,8 +13,8 @@ import ( func TestValidateRequiredFields(t *testing.T) { t.Parallel() - assert.NilError(t, ValidateRequiredFields(&library.Book{Name: "testbook"})) - assert.Error(t, ValidateRequiredFields(&library.Book{}), "missing required field: name") + assert.NilError(t, ValidateRequiredFields(&examplefreightv1.GetShipmentRequest{Name: "testbook"})) + assert.Error(t, ValidateRequiredFields(&examplefreightv1.GetShipmentRequest{}), "missing required field: name") } func TestCopyFields(t *testing.T) { @@ -54,7 +54,7 @@ func TestValidateRequiredFieldsWithMask(t *testing.T) { assert.Error( t, ValidateRequiredFieldsWithMask( - &library.Book{}, + &examplefreightv1.GetShipmentRequest{}, &fieldmaskpb.FieldMask{Paths: []string{"*"}}, ), "missing required field: name", @@ -75,13 +75,12 @@ func TestValidateRequiredFieldsWithMask(t *testing.T) { assert.Error( t, ValidateRequiredFieldsWithMask( - &library.UpdateBookRequest{ - Name: "testname", - Book: &library.Book{}, + &examplefreightv1.UpdateShipmentRequest{ + Shipment: &examplefreightv1.Shipment{}, }, - &fieldmaskpb.FieldMask{Paths: []string{"book.name"}}, + &fieldmaskpb.FieldMask{Paths: []string{"shipment.origin_site"}}, ), - "missing required field: book.name", + "missing required field: shipment.origin_site", ) }) t.Run("missing nested not in mask", func(t *testing.T) { diff --git a/fieldmask/validate_test.go b/fieldmask/validate_test.go index 8d88fa3dd2..6ce9fe3d31 100644 --- a/fieldmask/validate_test.go +++ b/fieldmask/validate_test.go @@ -58,7 +58,7 @@ func TestValidate(t *testing.T) { { name: "valid nested", fieldMask: &fieldmaskpb.FieldMask{ - Paths: []string{"name", "book.name"}, + Paths: []string{"parent", "book.name"}, }, message: &library.CreateBookRequest{}, }, @@ -66,7 +66,7 @@ func TestValidate(t *testing.T) { { name: "invalid nested", fieldMask: &fieldmaskpb.FieldMask{ - Paths: []string{"name", "book.foo"}, + Paths: []string{"parent", "book.foo"}, }, message: &library.CreateBookRequest{}, errorContains: "invalid field path: book.foo", diff --git a/go.mod b/go.mod index 2bfbbd976c..5ae4fb3609 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.15 require ( github.com/golang/protobuf v1.5.1 github.com/google/uuid v1.2.0 - google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d + google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6 google.golang.org/grpc v1.36.0 google.golang.org/protobuf v1.26.0 gotest.tools/v3 v3.0.3 diff --git a/go.sum b/go.sum index e4048f9170..91887e27bd 100644 --- a/go.sum +++ b/go.sum @@ -70,8 +70,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d h1:HV9Z9qMhQEsdlvxNFELgQ11RkMzO3CMkjEySjCtuLes= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6 h1:4Xw2NwItrJOFR5s6PnK98PI6Bgw1LhMP1j/rO5WP0S4= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/ordering/orderby_test.go b/ordering/orderby_test.go index 39ed6b40a6..f64a0988c5 100644 --- a/ordering/orderby_test.go +++ b/ordering/orderby_test.go @@ -183,7 +183,7 @@ func TestOrderBy_ValidateForMessage(t *testing.T) { name: "valid nested", orderBy: OrderBy{ Fields: []Field{ - {Path: "name"}, + {Path: "parent"}, {Path: "book.name"}, }, }, @@ -194,7 +194,7 @@ func TestOrderBy_ValidateForMessage(t *testing.T) { name: "invalid nested", orderBy: OrderBy{ Fields: []Field{ - {Path: "name"}, + {Path: "parent"}, {Path: "book.foo"}, }, }, diff --git a/pagination/pagetoken_test.go b/pagination/pagetoken_test.go index 6b3d6d25ff..6b4bd04bf1 100644 --- a/pagination/pagetoken_test.go +++ b/pagination/pagetoken_test.go @@ -12,13 +12,13 @@ func TestParseOffsetPageToken(t *testing.T) { t.Run("valid checksums", func(t *testing.T) { t.Parallel() request1 := &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 10, } pageToken1, err := ParsePageToken(request1) assert.NilError(t, err) request2 := &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 20, PageToken: pageToken1.Next(request1).String(), } @@ -26,7 +26,7 @@ func TestParseOffsetPageToken(t *testing.T) { assert.NilError(t, err) assert.Equal(t, int64(10), pageToken2.Offset) request3 := &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 30, PageToken: pageToken2.Next(request2).String(), } @@ -38,7 +38,7 @@ func TestParseOffsetPageToken(t *testing.T) { t.Run("invalid format", func(t *testing.T) { t.Parallel() request := &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 10, PageToken: "invalid", } @@ -50,7 +50,7 @@ func TestParseOffsetPageToken(t *testing.T) { t.Run("invalid checksum", func(t *testing.T) { t.Parallel() request := &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 10, PageToken: EncodePageTokenStruct(&PageToken{ Offset: 100, diff --git a/pagination/request_test.go b/pagination/request_test.go index ba75996fa4..e340cca4bc 100644 --- a/pagination/request_test.go +++ b/pagination/request_test.go @@ -18,12 +18,12 @@ func TestCalculateRequestChecksum(t *testing.T) { { name: "same request", request1: &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 100, PageToken: "token", }, request2: &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 100, PageToken: "token", }, @@ -32,12 +32,12 @@ func TestCalculateRequestChecksum(t *testing.T) { { name: "different parents", request1: &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 100, PageToken: "token", }, request2: &library.ListBooksRequest{ - Name: "shelves/2", + Parent: "shelves/2", PageSize: 100, PageToken: "token", }, @@ -46,12 +46,12 @@ func TestCalculateRequestChecksum(t *testing.T) { { name: "different page sizes", request1: &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 100, PageToken: "token", }, request2: &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 200, PageToken: "token", }, @@ -60,12 +60,12 @@ func TestCalculateRequestChecksum(t *testing.T) { { name: "different page tokens", request1: &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 100, PageToken: "token", }, request2: &library.ListBooksRequest{ - Name: "shelves/1", + Parent: "shelves/1", PageSize: 100, PageToken: "token2", }, diff --git a/proto/gen/einride/example/freight/v1/freight_service_grpc.pb.go b/proto/gen/einride/example/freight/v1/freight_service_grpc.pb.go index 8169ccbcff..2546f52d46 100644 --- a/proto/gen/einride/example/freight/v1/freight_service_grpc.pb.go +++ b/proto/gen/einride/example/freight/v1/freight_service_grpc.pb.go @@ -11,6 +11,7 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // FreightServiceClient is the client API for FreightService service. @@ -322,7 +323,7 @@ type UnsafeFreightServiceServer interface { } func RegisterFreightServiceServer(s grpc.ServiceRegistrar, srv FreightServiceServer) { - s.RegisterService(&_FreightService_serviceDesc, srv) + s.RegisterService(&FreightService_ServiceDesc, srv) } func _FreightService_GetShipper_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -595,7 +596,10 @@ func _FreightService_DeleteShipment_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } -var _FreightService_serviceDesc = grpc.ServiceDesc{ +// FreightService_ServiceDesc is the grpc.ServiceDesc for FreightService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var FreightService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "einride.example.freight.v1.FreightService", HandlerType: (*FreightServiceServer)(nil), Methods: []grpc.MethodDesc{ diff --git a/tools/protoc-gen-go-grpc/go.mod b/tools/protoc-gen-go-grpc/go.mod index 147124aa04..12591e3f8b 100644 --- a/tools/protoc-gen-go-grpc/go.mod +++ b/tools/protoc-gen-go-grpc/go.mod @@ -2,4 +2,4 @@ module tools/grpc-go go 1.14 -require google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.1 +require google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 diff --git a/tools/protoc-gen-go-grpc/go.sum b/tools/protoc-gen-go-grpc/go.sum index 394c81277f..682c5041cf 100644 --- a/tools/protoc-gen-go-grpc/go.sum +++ b/tools/protoc-gen-go-grpc/go.sum @@ -9,8 +9,8 @@ github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.1 h1:M8spwkmx0pHrPq+uMdl22w5CvJ/Y+oAJTIs9oGoCpOE= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.1/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=