From 64863f0ee92e6ad236866e73c9c4dfb6d96a2f53 Mon Sep 17 00:00:00 2001 From: Ilya Alexin Date: Sun, 3 Sep 2023 12:59:59 +0200 Subject: [PATCH 01/10] changed to api v2 Signed-off-by: Ilya Alexin --- generator/generator.go | 15 ++++++++------- generator/generator_messages.go | 2 +- generator/generator_service.go | 8 +++----- generator/main.go | 2 +- generator/renderer.go | 5 +++-- go.sum | 13 ------------- 6 files changed, 16 insertions(+), 29 deletions(-) diff --git a/generator/generator.go b/generator/generator.go index 82f76f5..64560f7 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -21,13 +21,13 @@ import ( "sort" "strings" - "github.com/golang/protobuf/descriptor" - dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/golang/protobuf/ptypes/empty" + "github.com/google/gnostic-grpc/utils" surface_v1 "github.com/google/gnostic/surface" - "google.golang.org/genproto/googleapis/api/annotations" - "github.com/google/gnostic-grpc/utils" + "google.golang.org/genproto/googleapis/api/annotations" + "google.golang.org/protobuf/reflect/protodesc" + dpb "google.golang.org/protobuf/types/descriptorpb" ) // Gathers all symbolic references we generated in recursive calls. @@ -174,7 +174,7 @@ func buildDependencies() (dependencies []*dpb.FileDescriptorProto) { // 2. Problem: The name is set wrong. // 3. Problem: google/api/annotations.proto has a dependency to google/protobuf/descriptor.proto. http := annotations.Http{} - fd, _ := descriptor.MessageDescriptorProto(&http) + fd := protodesc.ToFileDescriptorProto(http.ProtoReflect().Descriptor().ParentFile()) extensionName := "http" n := "google/api/annotations.proto" @@ -199,8 +199,9 @@ func buildDependencies() (dependencies []*dpb.FileDescriptorProto) { // Build other required dependencies e := empty.Empty{} fdp := dpb.DescriptorProto{} - fd2, _ := descriptor.MessageDescriptorProto(&e) - fd3, _ := descriptor.MessageDescriptorProto(&fdp) + fd2 := protodesc.ToFileDescriptorProto(e.ProtoReflect().Descriptor().ParentFile()) + fd3 := protodesc.ToFileDescriptorProto(fdp.ProtoReflect().Type().Descriptor().ParentFile()) + dependencies = []*dpb.FileDescriptorProto{fd, fd2, fd3} return dependencies } diff --git a/generator/generator_messages.go b/generator/generator_messages.go index 20f40f9..67e59a3 100644 --- a/generator/generator_messages.go +++ b/generator/generator_messages.go @@ -5,9 +5,9 @@ import ( "log" "strings" - dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" surface_v1 "github.com/google/gnostic/surface" "google.golang.org/protobuf/types/descriptorpb" + dpb "google.golang.org/protobuf/types/descriptorpb" ) var protoBufScalarTypes = getProtobufTypes() diff --git a/generator/generator_service.go b/generator/generator_service.go index aeb984c..99225df 100644 --- a/generator/generator_service.go +++ b/generator/generator_service.go @@ -4,10 +4,10 @@ import ( "strconv" "strings" - "github.com/golang/protobuf/proto" - dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" surface_v1 "github.com/google/gnostic/surface" "google.golang.org/genproto/googleapis/api/annotations" + "google.golang.org/protobuf/proto" + dpb "google.golang.org/protobuf/types/descriptorpb" ) // buildAllServiceDescriptors builds a protobuf RPC service. For every method the corresponding gRPC-HTTP transcoding options (https://github.com/googleapis/googleapis/blob/master/google/api/http.proto) @@ -56,9 +56,7 @@ func buildMethodOptions(method *surface_v1.Method, types []*surface_v1.Type) (op options = &dpb.MethodOptions{} httpRule := getHttpRuleForMethod(method) httpRule.Body = getRequestBodyForRequestParameter(method.ParametersTypeName, types) - if err := proto.SetExtension(options, annotations.E_Http, &httpRule); err != nil { - return nil, err - } + proto.SetExtension(options, annotations.E_Http, &httpRule) return options, nil } diff --git a/generator/main.go b/generator/main.go index 8117f93..54f7dad 100644 --- a/generator/main.go +++ b/generator/main.go @@ -20,10 +20,10 @@ import ( "path/filepath" "strings" - "github.com/golang/protobuf/proto" openapiv3 "github.com/google/gnostic/openapiv3" plugins "github.com/google/gnostic/plugins" surface "github.com/google/gnostic/surface" + "google.golang.org/protobuf/proto" ) // RunProtoGenerator generates a FileDescriptorSet from a gnostic output file. diff --git a/generator/renderer.go b/generator/renderer.go index 908e558..a51456a 100644 --- a/generator/renderer.go +++ b/generator/renderer.go @@ -15,12 +15,13 @@ package generator import ( - "github.com/golang/protobuf/proto" - dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" plugins "github.com/google/gnostic/plugins" surface "github.com/google/gnostic/surface" prDesc "github.com/jhump/protoreflect/desc" prPrint "github.com/jhump/protoreflect/desc/protoprint" + + "google.golang.org/protobuf/proto" + dpb "google.golang.org/protobuf/types/descriptorpb" ) // Renderer generates a .proto file based on the information inside Model. diff --git a/go.sum b/go.sum index 899eed0..4dfbcec 100644 --- a/go.sum +++ b/go.sum @@ -81,13 +81,11 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1: github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -95,7 +93,6 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -106,10 +103,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -120,7 +115,6 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -129,19 +123,13 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -153,7 +141,6 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From f7b0acb197308442d89f195a7ed58fbbc94a69b1 Mon Sep 17 00:00:00 2001 From: Ilya Alexin Date: Sun, 3 Sep 2023 13:42:05 +0200 Subject: [PATCH 02/10] Changed empptypb to v2 --- generator/generator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generator/generator.go b/generator/generator.go index 64560f7..dd634e5 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -21,9 +21,9 @@ import ( "sort" "strings" - "github.com/golang/protobuf/ptypes/empty" "github.com/google/gnostic-grpc/utils" surface_v1 "github.com/google/gnostic/surface" + "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/genproto/googleapis/api/annotations" "google.golang.org/protobuf/reflect/protodesc" @@ -197,7 +197,7 @@ func buildDependencies() (dependencies []*dpb.FileDescriptorProto) { fd.Dependency = append(fd.Dependency, "google/protobuf/descriptor.proto") //3.rd Problem // Build other required dependencies - e := empty.Empty{} + e := emptypb.Empty{} fdp := dpb.DescriptorProto{} fd2 := protodesc.ToFileDescriptorProto(e.ProtoReflect().Descriptor().ParentFile()) fd3 := protodesc.ToFileDescriptorProto(fdp.ProtoReflect().Type().Descriptor().ParentFile()) From 9b5966868c293cf2b77aefce374ca946b35d720b Mon Sep 17 00:00:00 2001 From: Ilya Alexin Date: Sun, 3 Sep 2023 14:48:49 +0200 Subject: [PATCH 03/10] Upgraded bookstore server --- examples/end-to-end-grpc-gateway/README.md | 12 +- .../end-to-end-grpc-gateway/bookstore.proto | 39 +- .../bookstore/bookstore.pb.go | 1551 +++++++++-------- .../bookstore/bookstore.pb.gw.go | 618 ++++++- .../bookstore/bookstore_grpc.pb.go | 394 +++++ .../bookstore/proxy.go | 2 +- .../bookstore/server.go | 22 +- .../grpc-client/client.go | 4 +- examples/end-to-end-grpc-gateway/main.go | 2 +- examples/end-to-end/README.md | 2 +- examples/end-to-end/bookstore/server.go | 11 +- examples/end-to-end/grpc-client/client.go | 4 +- go.mod | 26 +- go.sum | 55 +- 14 files changed, 1816 insertions(+), 926 deletions(-) create mode 100644 examples/end-to-end-grpc-gateway/bookstore/bookstore_grpc.pb.go diff --git a/examples/end-to-end-grpc-gateway/README.md b/examples/end-to-end-grpc-gateway/README.md index 37e0d4e..4db4609 100644 --- a/examples/end-to-end-grpc-gateway/README.md +++ b/examples/end-to-end-grpc-gateway/README.md @@ -27,11 +27,11 @@ Install [gnostic](https://github.com/google/gnostic), [gnostic-grpc](https://git [go plugin for protoc](https://github.com/golang/protobuf/protoc-gen-go), [gRPC gateway plugin](https://github.com/grpc-ecosystem/grpc-gateway) and [gRPC](https://grpc.io/) - go get -u github.com/google/gnostic + go get -u github.com/google/gnostic@v0.6.9 go get -u github.com/google/gnostic-grpc - go get -u github.com/golang/protobuf/protoc-gen-go - go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway - go get -u google.golang.org/grpc + go get -u google.golang.org/protobuf/cmd/protoc-gen-go@v1.29.1 + go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v2.16.2 + go get -u google.golang.org/grpc@v1.41.0 For simplicity lets create a temporary environment variable inside your terminal: @@ -49,7 +49,7 @@ description (`bookstore.proto`) in the current directory: #### 2. Step Generate the gRPC stubs: - protoc --proto_path=. --proto_path=${ANNOTATIONS} --go_out=plugins=grpc:bookstore bookstore.proto + protoc --proto_path=. --proto_path=${ANNOTATIONS} --go_out=paths=source_relative:bookstore --go-grpc_out=paths=source_relative:bookstore bookstore.proto This generates `bookstore/bookstore.pb.go`. @@ -61,6 +61,8 @@ Generate the reverse proxy with the gRPC gateway plugin: protoc --proto_path=. --proto_path=${ANNOTATIONS} --grpc-gateway_out=bookstore bookstore.proto + protoc --proto_path=. --proto_path=${ANNOTATIONS} --grpc-gateway_out=bookstore bookstore.proto + This generates `bookstore/bookstore.pb.gw.go`. We provided a sample implementation on how to use the proxy inside `bookstore/proxy.go`. diff --git a/examples/end-to-end-grpc-gateway/bookstore.proto b/examples/end-to-end-grpc-gateway/bookstore.proto index 398d644..d31d947 100644 --- a/examples/end-to-end-grpc-gateway/bookstore.proto +++ b/examples/end-to-end-grpc-gateway/bookstore.proto @@ -4,9 +4,11 @@ package bookstore; import "google/api/annotations.proto"; +import "google/protobuf/descriptor.proto"; + import "google/protobuf/empty.proto"; -import "google/protobuf/descriptor.proto"; +option go_package = ".;bookstore"; message Book { string author = 1; @@ -36,35 +38,42 @@ message Error { string message = 2; } -message CreateShelfParameters { +//CreateShelfParameters holds parameters to CreateShelf +message CreateShelfRequest { Shelf shelf = 1; } -message GetShelfParameters { +//GetShelfParameters holds parameters to GetShelf +message GetShelfRequest { int64 shelf = 1; } -message DeleteShelfParameters { +//DeleteShelfParameters holds parameters to DeleteShelf +message DeleteShelfRequest { int64 shelf = 1; } -message ListBooksParameters { +//ListBooksParameters holds parameters to ListBooks +message ListBooksRequest { int64 shelf = 1; } -message CreateBookParameters { +//CreateBookParameters holds parameters to CreateBook +message CreateBookRequest { int64 shelf = 1; Book book = 2; } -message GetBookParameters { +//GetBookParameters holds parameters to GetBook +message GetBookRequest { int64 shelf = 1; int64 book = 2; } -message DeleteBookParameters { +//DeleteBookParameters holds parameters to DeleteBook +message DeleteBookRequest { int64 shelf = 1; int64 book = 2; @@ -75,7 +84,7 @@ service Bookstore { option (google.api.http) = { get:"/shelves" }; } - rpc CreateShelf ( CreateShelfParameters ) returns ( Shelf ) { + rpc CreateShelf ( CreateShelfRequest ) returns ( Shelf ) { option (google.api.http) = { post:"/shelves" body:"shelf" }; } @@ -83,27 +92,27 @@ service Bookstore { option (google.api.http) = { delete:"/shelves" }; } - rpc GetShelf ( GetShelfParameters ) returns ( Shelf ) { + rpc GetShelf ( GetShelfRequest ) returns ( Shelf ) { option (google.api.http) = { get:"/shelves/{shelf}" }; } - rpc DeleteShelf ( DeleteShelfParameters ) returns ( google.protobuf.Empty ) { + rpc DeleteShelf ( DeleteShelfRequest ) returns ( google.protobuf.Empty ) { option (google.api.http) = { delete:"/shelves/{shelf}" }; } - rpc ListBooks ( ListBooksParameters ) returns ( ListBooksResponse ) { + rpc ListBooks ( ListBooksRequest ) returns ( ListBooksResponse ) { option (google.api.http) = { get:"/shelves/{shelf}/books" }; } - rpc CreateBook ( CreateBookParameters ) returns ( Book ) { + rpc CreateBook ( CreateBookRequest ) returns ( Book ) { option (google.api.http) = { post:"/shelves/{shelf}/books" body:"book" }; } - rpc GetBook ( GetBookParameters ) returns ( Book ) { + rpc GetBook ( GetBookRequest ) returns ( Book ) { option (google.api.http) = { get:"/shelves/{shelf}/books/{book}" }; } - rpc DeleteBook ( DeleteBookParameters ) returns ( google.protobuf.Empty ) { + rpc DeleteBook ( DeleteBookRequest ) returns ( google.protobuf.Empty ) { option (google.api.http) = { delete:"/shelves/{shelf}/books/{book}" }; } } diff --git a/examples/end-to-end-grpc-gateway/bookstore/bookstore.pb.go b/examples/end-to-end-grpc-gateway/bookstore/bookstore.pb.go index 78c86b8..2643229 100644 --- a/examples/end-to-end-grpc-gateway/bookstore/bookstore.pb.go +++ b/examples/end-to-end-grpc-gateway/bookstore/bookstore.pb.go @@ -1,979 +1,992 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.29.1 +// protoc v3.21.9 // source: bookstore.proto package bookstore import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - _ "github.com/golang/protobuf/protoc-gen-go/descriptor" - empty "github.com/golang/protobuf/ptypes/empty" _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "google.golang.org/protobuf/types/descriptorpb" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Book struct { - Author string `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Book) Reset() { *m = Book{} } -func (m *Book) String() string { return proto.CompactTextString(m) } -func (*Book) ProtoMessage() {} -func (*Book) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{0} + Author string `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` } -func (m *Book) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Book.Unmarshal(m, b) -} -func (m *Book) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Book.Marshal(b, m, deterministic) -} -func (m *Book) XXX_Merge(src proto.Message) { - xxx_messageInfo_Book.Merge(m, src) +func (x *Book) Reset() { + *x = Book{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Book) XXX_Size() int { - return xxx_messageInfo_Book.Size(m) + +func (x *Book) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Book) XXX_DiscardUnknown() { - xxx_messageInfo_Book.DiscardUnknown(m) + +func (*Book) ProtoMessage() {} + +func (x *Book) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[0] + 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) } -var xxx_messageInfo_Book proto.InternalMessageInfo +// Deprecated: Use Book.ProtoReflect.Descriptor instead. +func (*Book) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{0} +} -func (m *Book) GetAuthor() string { - if m != nil { - return m.Author +func (x *Book) GetAuthor() string { + if x != nil { + return x.Author } return "" } -func (m *Book) GetName() string { - if m != nil { - return m.Name +func (x *Book) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *Book) GetTitle() string { - if m != nil { - return m.Title +func (x *Book) GetTitle() string { + if x != nil { + return x.Title } return "" } type ListBooksResponse struct { - Books []*Book `protobuf:"bytes,1,rep,name=books,proto3" json:"books,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *ListBooksResponse) Reset() { *m = ListBooksResponse{} } -func (m *ListBooksResponse) String() string { return proto.CompactTextString(m) } -func (*ListBooksResponse) ProtoMessage() {} -func (*ListBooksResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{1} + Books []*Book `protobuf:"bytes,1,rep,name=books,proto3" json:"books,omitempty"` } -func (m *ListBooksResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListBooksResponse.Unmarshal(m, b) -} -func (m *ListBooksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListBooksResponse.Marshal(b, m, deterministic) -} -func (m *ListBooksResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListBooksResponse.Merge(m, src) +func (x *ListBooksResponse) Reset() { + *x = ListBooksResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ListBooksResponse) XXX_Size() int { - return xxx_messageInfo_ListBooksResponse.Size(m) + +func (x *ListBooksResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ListBooksResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListBooksResponse.DiscardUnknown(m) + +func (*ListBooksResponse) ProtoMessage() {} + +func (x *ListBooksResponse) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[1] + 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) } -var xxx_messageInfo_ListBooksResponse proto.InternalMessageInfo +// Deprecated: Use ListBooksResponse.ProtoReflect.Descriptor instead. +func (*ListBooksResponse) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{1} +} -func (m *ListBooksResponse) GetBooks() []*Book { - if m != nil { - return m.Books +func (x *ListBooksResponse) GetBooks() []*Book { + if x != nil { + return x.Books } return nil } type ListShelvesResponse struct { - Shelves []*Shelf `protobuf:"bytes,1,rep,name=shelves,proto3" json:"shelves,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *ListShelvesResponse) Reset() { *m = ListShelvesResponse{} } -func (m *ListShelvesResponse) String() string { return proto.CompactTextString(m) } -func (*ListShelvesResponse) ProtoMessage() {} -func (*ListShelvesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{2} + Shelves []*Shelf `protobuf:"bytes,1,rep,name=shelves,proto3" json:"shelves,omitempty"` } -func (m *ListShelvesResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListShelvesResponse.Unmarshal(m, b) -} -func (m *ListShelvesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListShelvesResponse.Marshal(b, m, deterministic) -} -func (m *ListShelvesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListShelvesResponse.Merge(m, src) +func (x *ListShelvesResponse) Reset() { + *x = ListShelvesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ListShelvesResponse) XXX_Size() int { - return xxx_messageInfo_ListShelvesResponse.Size(m) + +func (x *ListShelvesResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ListShelvesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListShelvesResponse.DiscardUnknown(m) + +func (*ListShelvesResponse) ProtoMessage() {} + +func (x *ListShelvesResponse) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[2] + 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) } -var xxx_messageInfo_ListShelvesResponse proto.InternalMessageInfo +// Deprecated: Use ListShelvesResponse.ProtoReflect.Descriptor instead. +func (*ListShelvesResponse) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{2} +} -func (m *ListShelvesResponse) GetShelves() []*Shelf { - if m != nil { - return m.Shelves +func (x *ListShelvesResponse) GetShelves() []*Shelf { + if x != nil { + return x.Shelves } return nil } type Shelf struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Theme string `protobuf:"bytes,2,opt,name=theme,proto3" json:"theme,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Shelf) Reset() { *m = Shelf{} } -func (m *Shelf) String() string { return proto.CompactTextString(m) } -func (*Shelf) ProtoMessage() {} -func (*Shelf) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{3} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Theme string `protobuf:"bytes,2,opt,name=theme,proto3" json:"theme,omitempty"` } -func (m *Shelf) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Shelf.Unmarshal(m, b) -} -func (m *Shelf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Shelf.Marshal(b, m, deterministic) -} -func (m *Shelf) XXX_Merge(src proto.Message) { - xxx_messageInfo_Shelf.Merge(m, src) +func (x *Shelf) Reset() { + *x = Shelf{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Shelf) XXX_Size() int { - return xxx_messageInfo_Shelf.Size(m) + +func (x *Shelf) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Shelf) XXX_DiscardUnknown() { - xxx_messageInfo_Shelf.DiscardUnknown(m) + +func (*Shelf) ProtoMessage() {} + +func (x *Shelf) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[3] + 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) } -var xxx_messageInfo_Shelf proto.InternalMessageInfo +// Deprecated: Use Shelf.ProtoReflect.Descriptor instead. +func (*Shelf) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{3} +} -func (m *Shelf) GetName() string { - if m != nil { - return m.Name +func (x *Shelf) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *Shelf) GetTheme() string { - if m != nil { - return m.Theme +func (x *Shelf) GetTheme() string { + if x != nil { + return x.Theme } return "" } type Error struct { - Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Error) Reset() { *m = Error{} } -func (m *Error) String() string { return proto.CompactTextString(m) } -func (*Error) ProtoMessage() {} -func (*Error) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{4} + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` } -func (m *Error) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Error.Unmarshal(m, b) -} -func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Error.Marshal(b, m, deterministic) -} -func (m *Error) XXX_Merge(src proto.Message) { - xxx_messageInfo_Error.Merge(m, src) +func (x *Error) Reset() { + *x = Error{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Error) XXX_Size() int { - return xxx_messageInfo_Error.Size(m) + +func (x *Error) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Error) XXX_DiscardUnknown() { - xxx_messageInfo_Error.DiscardUnknown(m) + +func (*Error) ProtoMessage() {} + +func (x *Error) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[4] + 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) } -var xxx_messageInfo_Error proto.InternalMessageInfo +// Deprecated: Use Error.ProtoReflect.Descriptor instead. +func (*Error) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{4} +} -func (m *Error) GetCode() int32 { - if m != nil { - return m.Code +func (x *Error) GetCode() int32 { + if x != nil { + return x.Code } return 0 } -func (m *Error) GetMessage() string { - if m != nil { - return m.Message +func (x *Error) GetMessage() string { + if x != nil { + return x.Message } return "" } -type CreateShelfParameters struct { - Shelf *Shelf `protobuf:"bytes,1,opt,name=shelf,proto3" json:"shelf,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +// CreateShelfParameters holds parameters to CreateShelf +type CreateShelfRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *CreateShelfParameters) Reset() { *m = CreateShelfParameters{} } -func (m *CreateShelfParameters) String() string { return proto.CompactTextString(m) } -func (*CreateShelfParameters) ProtoMessage() {} -func (*CreateShelfParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{5} + Shelf *Shelf `protobuf:"bytes,1,opt,name=shelf,proto3" json:"shelf,omitempty"` } -func (m *CreateShelfParameters) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateShelfParameters.Unmarshal(m, b) -} -func (m *CreateShelfParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateShelfParameters.Marshal(b, m, deterministic) -} -func (m *CreateShelfParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateShelfParameters.Merge(m, src) -} -func (m *CreateShelfParameters) XXX_Size() int { - return xxx_messageInfo_CreateShelfParameters.Size(m) +func (x *CreateShelfRequest) Reset() { + *x = CreateShelfRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateShelfParameters) XXX_DiscardUnknown() { - xxx_messageInfo_CreateShelfParameters.DiscardUnknown(m) + +func (x *CreateShelfRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_CreateShelfParameters proto.InternalMessageInfo +func (*CreateShelfRequest) ProtoMessage() {} -func (m *CreateShelfParameters) GetShelf() *Shelf { - if m != nil { - return m.Shelf +func (x *CreateShelfRequest) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -type GetShelfParameters struct { - Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use CreateShelfRequest.ProtoReflect.Descriptor instead. +func (*CreateShelfRequest) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{5} } -func (m *GetShelfParameters) Reset() { *m = GetShelfParameters{} } -func (m *GetShelfParameters) String() string { return proto.CompactTextString(m) } -func (*GetShelfParameters) ProtoMessage() {} -func (*GetShelfParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{6} +func (x *CreateShelfRequest) GetShelf() *Shelf { + if x != nil { + return x.Shelf + } + return nil } -func (m *GetShelfParameters) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetShelfParameters.Unmarshal(m, b) -} -func (m *GetShelfParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetShelfParameters.Marshal(b, m, deterministic) -} -func (m *GetShelfParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetShelfParameters.Merge(m, src) -} -func (m *GetShelfParameters) XXX_Size() int { - return xxx_messageInfo_GetShelfParameters.Size(m) -} -func (m *GetShelfParameters) XXX_DiscardUnknown() { - xxx_messageInfo_GetShelfParameters.DiscardUnknown(m) -} +// GetShelfParameters holds parameters to GetShelf +type GetShelfRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -var xxx_messageInfo_GetShelfParameters proto.InternalMessageInfo + Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` +} -func (m *GetShelfParameters) GetShelf() int64 { - if m != nil { - return m.Shelf +func (x *GetShelfRequest) Reset() { + *x = GetShelfRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -type DeleteShelfParameters struct { - Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *GetShelfRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteShelfParameters) Reset() { *m = DeleteShelfParameters{} } -func (m *DeleteShelfParameters) String() string { return proto.CompactTextString(m) } -func (*DeleteShelfParameters) ProtoMessage() {} -func (*DeleteShelfParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{7} -} +func (*GetShelfRequest) ProtoMessage() {} -func (m *DeleteShelfParameters) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteShelfParameters.Unmarshal(m, b) -} -func (m *DeleteShelfParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteShelfParameters.Marshal(b, m, deterministic) -} -func (m *DeleteShelfParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteShelfParameters.Merge(m, src) -} -func (m *DeleteShelfParameters) XXX_Size() int { - return xxx_messageInfo_DeleteShelfParameters.Size(m) -} -func (m *DeleteShelfParameters) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteShelfParameters.DiscardUnknown(m) +func (x *GetShelfRequest) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[6] + 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) } -var xxx_messageInfo_DeleteShelfParameters proto.InternalMessageInfo +// Deprecated: Use GetShelfRequest.ProtoReflect.Descriptor instead. +func (*GetShelfRequest) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{6} +} -func (m *DeleteShelfParameters) GetShelf() int64 { - if m != nil { - return m.Shelf +func (x *GetShelfRequest) GetShelf() int64 { + if x != nil { + return x.Shelf } return 0 } -type ListBooksParameters struct { - Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +// DeleteShelfParameters holds parameters to DeleteShelf +type DeleteShelfRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *ListBooksParameters) Reset() { *m = ListBooksParameters{} } -func (m *ListBooksParameters) String() string { return proto.CompactTextString(m) } -func (*ListBooksParameters) ProtoMessage() {} -func (*ListBooksParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{8} + Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` } -func (m *ListBooksParameters) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListBooksParameters.Unmarshal(m, b) -} -func (m *ListBooksParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListBooksParameters.Marshal(b, m, deterministic) -} -func (m *ListBooksParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListBooksParameters.Merge(m, src) -} -func (m *ListBooksParameters) XXX_Size() int { - return xxx_messageInfo_ListBooksParameters.Size(m) -} -func (m *ListBooksParameters) XXX_DiscardUnknown() { - xxx_messageInfo_ListBooksParameters.DiscardUnknown(m) -} - -var xxx_messageInfo_ListBooksParameters proto.InternalMessageInfo - -func (m *ListBooksParameters) GetShelf() int64 { - if m != nil { - return m.Shelf +func (x *DeleteShelfRequest) Reset() { + *x = DeleteShelfRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -type CreateBookParameters struct { - Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` - Book *Book `protobuf:"bytes,2,opt,name=book,proto3" json:"book,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *DeleteShelfRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateBookParameters) Reset() { *m = CreateBookParameters{} } -func (m *CreateBookParameters) String() string { return proto.CompactTextString(m) } -func (*CreateBookParameters) ProtoMessage() {} -func (*CreateBookParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{9} -} +func (*DeleteShelfRequest) ProtoMessage() {} -func (m *CreateBookParameters) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateBookParameters.Unmarshal(m, b) -} -func (m *CreateBookParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateBookParameters.Marshal(b, m, deterministic) -} -func (m *CreateBookParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateBookParameters.Merge(m, src) -} -func (m *CreateBookParameters) XXX_Size() int { - return xxx_messageInfo_CreateBookParameters.Size(m) -} -func (m *CreateBookParameters) XXX_DiscardUnknown() { - xxx_messageInfo_CreateBookParameters.DiscardUnknown(m) +func (x *DeleteShelfRequest) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[7] + 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) } -var xxx_messageInfo_CreateBookParameters proto.InternalMessageInfo +// Deprecated: Use DeleteShelfRequest.ProtoReflect.Descriptor instead. +func (*DeleteShelfRequest) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{7} +} -func (m *CreateBookParameters) GetShelf() int64 { - if m != nil { - return m.Shelf +func (x *DeleteShelfRequest) GetShelf() int64 { + if x != nil { + return x.Shelf } return 0 } -func (m *CreateBookParameters) GetBook() *Book { - if m != nil { - return m.Book - } - return nil -} +// ListBooksParameters holds parameters to ListBooks +type ListBooksRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -type GetBookParameters struct { - Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` - Book int64 `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` } -func (m *GetBookParameters) Reset() { *m = GetBookParameters{} } -func (m *GetBookParameters) String() string { return proto.CompactTextString(m) } -func (*GetBookParameters) ProtoMessage() {} -func (*GetBookParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{10} +func (x *ListBooksRequest) Reset() { + *x = ListBooksRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetBookParameters) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetBookParameters.Unmarshal(m, b) -} -func (m *GetBookParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetBookParameters.Marshal(b, m, deterministic) -} -func (m *GetBookParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetBookParameters.Merge(m, src) -} -func (m *GetBookParameters) XXX_Size() int { - return xxx_messageInfo_GetBookParameters.Size(m) -} -func (m *GetBookParameters) XXX_DiscardUnknown() { - xxx_messageInfo_GetBookParameters.DiscardUnknown(m) +func (x *ListBooksRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_GetBookParameters proto.InternalMessageInfo +func (*ListBooksRequest) ProtoMessage() {} -func (m *GetBookParameters) GetShelf() int64 { - if m != nil { - return m.Shelf +func (x *ListBooksRequest) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_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 0 + return mi.MessageOf(x) +} + +// Deprecated: Use ListBooksRequest.ProtoReflect.Descriptor instead. +func (*ListBooksRequest) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{8} } -func (m *GetBookParameters) GetBook() int64 { - if m != nil { - return m.Book +func (x *ListBooksRequest) GetShelf() int64 { + if x != nil { + return x.Shelf } return 0 } -type DeleteBookParameters struct { - Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` - Book int64 `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +// CreateBookParameters holds parameters to CreateBook +type CreateBookRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *DeleteBookParameters) Reset() { *m = DeleteBookParameters{} } -func (m *DeleteBookParameters) String() string { return proto.CompactTextString(m) } -func (*DeleteBookParameters) ProtoMessage() {} -func (*DeleteBookParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_6f82f486e563a88c, []int{11} -} - -func (m *DeleteBookParameters) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteBookParameters.Unmarshal(m, b) -} -func (m *DeleteBookParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteBookParameters.Marshal(b, m, deterministic) -} -func (m *DeleteBookParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteBookParameters.Merge(m, src) -} -func (m *DeleteBookParameters) XXX_Size() int { - return xxx_messageInfo_DeleteBookParameters.Size(m) -} -func (m *DeleteBookParameters) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteBookParameters.DiscardUnknown(m) + Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` + Book *Book `protobuf:"bytes,2,opt,name=book,proto3" json:"book,omitempty"` } -var xxx_messageInfo_DeleteBookParameters proto.InternalMessageInfo - -func (m *DeleteBookParameters) GetShelf() int64 { - if m != nil { - return m.Shelf +func (x *CreateBookRequest) Reset() { + *x = CreateBookRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -func (m *DeleteBookParameters) GetBook() int64 { - if m != nil { - return m.Book - } - return 0 +func (x *CreateBookRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func init() { - proto.RegisterType((*Book)(nil), "bookstore.Book") - proto.RegisterType((*ListBooksResponse)(nil), "bookstore.ListBooksResponse") - proto.RegisterType((*ListShelvesResponse)(nil), "bookstore.ListShelvesResponse") - proto.RegisterType((*Shelf)(nil), "bookstore.Shelf") - proto.RegisterType((*Error)(nil), "bookstore.Error") - proto.RegisterType((*CreateShelfParameters)(nil), "bookstore.CreateShelfParameters") - proto.RegisterType((*GetShelfParameters)(nil), "bookstore.GetShelfParameters") - proto.RegisterType((*DeleteShelfParameters)(nil), "bookstore.DeleteShelfParameters") - proto.RegisterType((*ListBooksParameters)(nil), "bookstore.ListBooksParameters") - proto.RegisterType((*CreateBookParameters)(nil), "bookstore.CreateBookParameters") - proto.RegisterType((*GetBookParameters)(nil), "bookstore.GetBookParameters") - proto.RegisterType((*DeleteBookParameters)(nil), "bookstore.DeleteBookParameters") -} - -func init() { proto.RegisterFile("bookstore.proto", fileDescriptor_6f82f486e563a88c) } - -var fileDescriptor_6f82f486e563a88c = []byte{ - // 605 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xdd, 0x6e, 0x12, 0x51, - 0x10, 0x0e, 0xa5, 0x0b, 0x65, 0x88, 0x29, 0x8c, 0x14, 0x37, 0x2b, 0xa5, 0xe4, 0x68, 0x4d, 0x83, - 0x91, 0x8d, 0x35, 0xde, 0x90, 0x18, 0xb5, 0xda, 0xd4, 0x0b, 0x2f, 0x2c, 0xc6, 0x98, 0x78, 0x63, - 0x96, 0x72, 0x80, 0x4d, 0x81, 0x43, 0xf6, 0x9c, 0x9a, 0x98, 0xa6, 0x37, 0xbe, 0x82, 0x8f, 0xe6, - 0x2b, 0x78, 0xeb, 0x3b, 0x98, 0x9d, 0xb3, 0x7f, 0xec, 0x2e, 0xc5, 0x78, 0x05, 0x67, 0x66, 0xbe, - 0x6f, 0xbe, 0xd9, 0xf9, 0x06, 0x76, 0x87, 0x42, 0x5c, 0x4a, 0x25, 0x3c, 0xde, 0x5b, 0x7a, 0x42, - 0x09, 0xac, 0x44, 0x01, 0xab, 0x35, 0x11, 0x62, 0x32, 0xe3, 0xb6, 0xb3, 0x74, 0x6d, 0x67, 0xb1, - 0x10, 0xca, 0x51, 0xae, 0x58, 0x48, 0x5d, 0x68, 0xdd, 0x0f, 0xb2, 0xf4, 0x1a, 0x5e, 0x8d, 0x6d, - 0x3e, 0x5f, 0xaa, 0xef, 0x41, 0xb2, 0x93, 0x4e, 0x8e, 0xb8, 0xbc, 0xf0, 0xdc, 0xa5, 0x12, 0x9e, - 0xae, 0x60, 0xef, 0x60, 0xfb, 0x44, 0x88, 0x4b, 0x6c, 0x42, 0xc9, 0xb9, 0x52, 0x53, 0xe1, 0x99, - 0x85, 0x4e, 0xe1, 0xa8, 0x32, 0x08, 0x5e, 0x88, 0xb0, 0xbd, 0x70, 0xe6, 0xdc, 0xdc, 0xa2, 0x28, - 0xfd, 0xc7, 0x06, 0x18, 0xca, 0x55, 0x33, 0x6e, 0x16, 0x29, 0xa8, 0x1f, 0xac, 0x0f, 0xf5, 0xf7, - 0xae, 0x54, 0x3e, 0x9b, 0x1c, 0x70, 0xb9, 0x14, 0x0b, 0xc9, 0xf1, 0x10, 0x0c, 0x1a, 0xc4, 0x2c, - 0x74, 0x8a, 0x47, 0xd5, 0xe3, 0xdd, 0x5e, 0x3c, 0xa7, 0x5f, 0x38, 0xd0, 0x59, 0xf6, 0x1a, 0xee, - 0xfa, 0xd8, 0x8f, 0x53, 0x3e, 0xfb, 0xc6, 0x63, 0x74, 0x17, 0xca, 0x52, 0x87, 0x02, 0x7c, 0x2d, - 0x81, 0xf7, 0x8b, 0xc7, 0x83, 0xb0, 0x80, 0x3d, 0x05, 0x83, 0x22, 0x91, 0xe2, 0x42, 0x4a, 0xf1, - 0x94, 0x47, 0x63, 0xe8, 0x07, 0x7b, 0x0e, 0xc6, 0xa9, 0xe7, 0xe9, 0x21, 0x2f, 0xc4, 0x48, 0x43, - 0x8c, 0x01, 0xfd, 0x47, 0x13, 0xca, 0x73, 0x2e, 0xa5, 0x33, 0x09, 0x41, 0xe1, 0x93, 0xbd, 0x84, - 0xbd, 0x37, 0x1e, 0x77, 0x14, 0xa7, 0x7e, 0x1f, 0x1c, 0xcf, 0x99, 0x73, 0xc5, 0x3d, 0x89, 0x8f, - 0xc0, 0xf0, 0xd5, 0x8c, 0x89, 0x27, 0x4f, 0xac, 0x4e, 0xb3, 0x2e, 0xe0, 0x19, 0x57, 0x69, 0x74, - 0x23, 0x89, 0x2e, 0x86, 0xb5, 0x4f, 0x60, 0xef, 0x2d, 0x9f, 0xf1, 0x6c, 0xb3, 0xfc, 0xf2, 0xc7, - 0xfa, 0x43, 0xd2, 0x12, 0x36, 0x16, 0x9f, 0x43, 0x43, 0x0f, 0xe2, 0x97, 0x6f, 0xaa, 0xc6, 0x07, - 0xb0, 0xed, 0xcf, 0x43, 0x5f, 0x23, 0x67, 0x93, 0x94, 0x64, 0x2f, 0xa0, 0x7e, 0xc6, 0xd5, 0x3f, - 0xf1, 0x61, 0x82, 0xaf, 0x18, 0xc0, 0x5f, 0x41, 0x43, 0x4f, 0xfb, 0xbf, 0x0c, 0xc7, 0x7f, 0x4a, - 0x50, 0x39, 0x09, 0x95, 0xe1, 0x67, 0xa8, 0x26, 0x7c, 0x85, 0xcd, 0x9e, 0xbe, 0x87, 0x5e, 0x78, - 0x0f, 0xbd, 0x53, 0xff, 0x58, 0xac, 0x76, 0x62, 0x98, 0x1c, 0x1f, 0xb2, 0xda, 0x8f, 0x5f, 0xbf, - 0x7f, 0x6e, 0x01, 0xee, 0xd8, 0x81, 0xdb, 0xf0, 0x0b, 0x54, 0x13, 0x1e, 0xc0, 0x4e, 0x82, 0x20, - 0xd7, 0x1b, 0x56, 0xc6, 0x0c, 0xec, 0x1e, 0x91, 0xd6, 0x59, 0x44, 0xda, 0x0f, 0xc6, 0x3a, 0x87, - 0x3b, 0xf1, 0xca, 0x6f, 0x93, 0xbd, 0x26, 0x1e, 0xca, 0xed, 0xc6, 0x72, 0x3f, 0xc1, 0x4e, 0xe8, - 0x38, 0xdc, 0x4f, 0x28, 0xc9, 0xda, 0x30, 0x47, 0xa8, 0x49, 0x74, 0x88, 0xb5, 0x90, 0xce, 0xbe, - 0x26, 0xa1, 0x37, 0xe8, 0x40, 0x35, 0x61, 0xce, 0x95, 0xaf, 0x90, 0x6b, 0xda, 0xb5, 0x8a, 0x83, - 0x16, 0xdd, 0x6c, 0x0b, 0x17, 0x2a, 0x91, 0xa1, 0x31, 0xbd, 0xa7, 0x94, 0xcd, 0xad, 0x56, 0x5e, - 0x3e, 0xda, 0x62, 0x9b, 0x9a, 0x98, 0xd8, 0x4c, 0x37, 0xb1, 0x09, 0x85, 0x23, 0x80, 0xf8, 0x1c, - 0xf0, 0x20, 0xb3, 0xd2, 0x55, 0x4f, 0x5a, 0xe9, 0x0b, 0x60, 0x0f, 0x89, 0xbf, 0xcd, 0xd6, 0xf0, - 0xf7, 0xc9, 0xa0, 0xf8, 0x15, 0xca, 0xc1, 0x85, 0x60, 0x6b, 0x75, 0x13, 0x9b, 0xf8, 0x0f, 0x89, - 0xff, 0x00, 0xf7, 0xf3, 0xf9, 0xed, 0x6b, 0xff, 0xe7, 0x06, 0x67, 0x00, 0xf1, 0x0d, 0xad, 0x8c, - 0x91, 0x77, 0x5a, 0x6b, 0x57, 0x12, 0x74, 0xeb, 0xde, 0xde, 0x6d, 0x58, 0x22, 0xd8, 0xb3, 0xbf, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x75, 0xd6, 0x7d, 0xc1, 0x06, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// BookstoreClient is the client API for Bookstore service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type BookstoreClient interface { - ListShelves(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ListShelvesResponse, error) - CreateShelf(ctx context.Context, in *CreateShelfParameters, opts ...grpc.CallOption) (*Shelf, error) - DeleteShelves(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) - GetShelf(ctx context.Context, in *GetShelfParameters, opts ...grpc.CallOption) (*Shelf, error) - DeleteShelf(ctx context.Context, in *DeleteShelfParameters, opts ...grpc.CallOption) (*empty.Empty, error) - ListBooks(ctx context.Context, in *ListBooksParameters, opts ...grpc.CallOption) (*ListBooksResponse, error) - CreateBook(ctx context.Context, in *CreateBookParameters, opts ...grpc.CallOption) (*Book, error) - GetBook(ctx context.Context, in *GetBookParameters, opts ...grpc.CallOption) (*Book, error) - DeleteBook(ctx context.Context, in *DeleteBookParameters, opts ...grpc.CallOption) (*empty.Empty, error) -} - -type bookstoreClient struct { - cc *grpc.ClientConn -} - -func NewBookstoreClient(cc *grpc.ClientConn) BookstoreClient { - return &bookstoreClient{cc} -} - -func (c *bookstoreClient) ListShelves(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ListShelvesResponse, error) { - out := new(ListShelvesResponse) - err := c.cc.Invoke(ctx, "/bookstore.Bookstore/ListShelves", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *bookstoreClient) CreateShelf(ctx context.Context, in *CreateShelfParameters, opts ...grpc.CallOption) (*Shelf, error) { - out := new(Shelf) - err := c.cc.Invoke(ctx, "/bookstore.Bookstore/CreateShelf", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} +func (*CreateBookRequest) ProtoMessage() {} -func (c *bookstoreClient) DeleteShelves(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/bookstore.Bookstore/DeleteShelves", in, out, opts...) - if err != nil { - return nil, err +func (x *CreateBookRequest) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return out, nil + return mi.MessageOf(x) } -func (c *bookstoreClient) GetShelf(ctx context.Context, in *GetShelfParameters, opts ...grpc.CallOption) (*Shelf, error) { - out := new(Shelf) - err := c.cc.Invoke(ctx, "/bookstore.Bookstore/GetShelf", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// Deprecated: Use CreateBookRequest.ProtoReflect.Descriptor instead. +func (*CreateBookRequest) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{9} } -func (c *bookstoreClient) DeleteShelf(ctx context.Context, in *DeleteShelfParameters, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/bookstore.Bookstore/DeleteShelf", in, out, opts...) - if err != nil { - return nil, err +func (x *CreateBookRequest) GetShelf() int64 { + if x != nil { + return x.Shelf } - return out, nil + return 0 } -func (c *bookstoreClient) ListBooks(ctx context.Context, in *ListBooksParameters, opts ...grpc.CallOption) (*ListBooksResponse, error) { - out := new(ListBooksResponse) - err := c.cc.Invoke(ctx, "/bookstore.Bookstore/ListBooks", in, out, opts...) - if err != nil { - return nil, err +func (x *CreateBookRequest) GetBook() *Book { + if x != nil { + return x.Book } - return out, nil + return nil } -func (c *bookstoreClient) CreateBook(ctx context.Context, in *CreateBookParameters, opts ...grpc.CallOption) (*Book, error) { - out := new(Book) - err := c.cc.Invoke(ctx, "/bookstore.Bookstore/CreateBook", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} +// GetBookParameters holds parameters to GetBook +type GetBookRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (c *bookstoreClient) GetBook(ctx context.Context, in *GetBookParameters, opts ...grpc.CallOption) (*Book, error) { - out := new(Book) - err := c.cc.Invoke(ctx, "/bookstore.Bookstore/GetBook", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil + Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` + Book int64 `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"` } -func (c *bookstoreClient) DeleteBook(ctx context.Context, in *DeleteBookParameters, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/bookstore.Bookstore/DeleteBook", in, out, opts...) - if err != nil { - return nil, err +func (x *GetBookRequest) Reset() { + *x = GetBookRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return out, nil } -// BookstoreServer is the server API for Bookstore service. -type BookstoreServer interface { - ListShelves(context.Context, *empty.Empty) (*ListShelvesResponse, error) - CreateShelf(context.Context, *CreateShelfParameters) (*Shelf, error) - DeleteShelves(context.Context, *empty.Empty) (*empty.Empty, error) - GetShelf(context.Context, *GetShelfParameters) (*Shelf, error) - DeleteShelf(context.Context, *DeleteShelfParameters) (*empty.Empty, error) - ListBooks(context.Context, *ListBooksParameters) (*ListBooksResponse, error) - CreateBook(context.Context, *CreateBookParameters) (*Book, error) - GetBook(context.Context, *GetBookParameters) (*Book, error) - DeleteBook(context.Context, *DeleteBookParameters) (*empty.Empty, error) +func (x *GetBookRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -// UnimplementedBookstoreServer can be embedded to have forward compatible implementations. -type UnimplementedBookstoreServer struct { -} +func (*GetBookRequest) ProtoMessage() {} -func (*UnimplementedBookstoreServer) ListShelves(ctx context.Context, req *empty.Empty) (*ListShelvesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListShelves not implemented") -} -func (*UnimplementedBookstoreServer) CreateShelf(ctx context.Context, req *CreateShelfParameters) (*Shelf, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateShelf not implemented") -} -func (*UnimplementedBookstoreServer) DeleteShelves(ctx context.Context, req *empty.Empty) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteShelves not implemented") -} -func (*UnimplementedBookstoreServer) GetShelf(ctx context.Context, req *GetShelfParameters) (*Shelf, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetShelf not implemented") -} -func (*UnimplementedBookstoreServer) DeleteShelf(ctx context.Context, req *DeleteShelfParameters) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteShelf not implemented") -} -func (*UnimplementedBookstoreServer) ListBooks(ctx context.Context, req *ListBooksParameters) (*ListBooksResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListBooks not implemented") -} -func (*UnimplementedBookstoreServer) CreateBook(ctx context.Context, req *CreateBookParameters) (*Book, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateBook not implemented") -} -func (*UnimplementedBookstoreServer) GetBook(ctx context.Context, req *GetBookParameters) (*Book, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBook not implemented") -} -func (*UnimplementedBookstoreServer) DeleteBook(ctx context.Context, req *DeleteBookParameters) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteBook not implemented") +func (x *GetBookRequest) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[10] + 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) } -func RegisterBookstoreServer(s *grpc.Server, srv BookstoreServer) { - s.RegisterService(&_Bookstore_serviceDesc, srv) +// Deprecated: Use GetBookRequest.ProtoReflect.Descriptor instead. +func (*GetBookRequest) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{10} } -func _Bookstore_ListShelves_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BookstoreServer).ListShelves(ctx, in) +func (x *GetBookRequest) GetShelf() int64 { + if x != nil { + return x.Shelf } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/bookstore.Bookstore/ListShelves", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BookstoreServer).ListShelves(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) + return 0 } -func _Bookstore_CreateShelf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateShelfParameters) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BookstoreServer).CreateShelf(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/bookstore.Bookstore/CreateShelf", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BookstoreServer).CreateShelf(ctx, req.(*CreateShelfParameters)) +func (x *GetBookRequest) GetBook() int64 { + if x != nil { + return x.Book } - return interceptor(ctx, in, info, handler) + return 0 } -func _Bookstore_DeleteShelves_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BookstoreServer).DeleteShelves(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/bookstore.Bookstore/DeleteShelves", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BookstoreServer).DeleteShelves(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) +// DeleteBookParameters holds parameters to DeleteBook +type DeleteBookRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Shelf int64 `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"` + Book int64 `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"` } -func _Bookstore_GetShelf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetShelfParameters) - if err := dec(in); err != nil { - return nil, err +func (x *DeleteBookRequest) Reset() { + *x = DeleteBookRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bookstore_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - if interceptor == nil { - return srv.(BookstoreServer).GetShelf(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/bookstore.Bookstore/GetShelf", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BookstoreServer).GetShelf(ctx, req.(*GetShelfParameters)) - } - return interceptor(ctx, in, info, handler) } -func _Bookstore_DeleteShelf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteShelfParameters) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BookstoreServer).DeleteShelf(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/bookstore.Bookstore/DeleteShelf", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BookstoreServer).DeleteShelf(ctx, req.(*DeleteShelfParameters)) - } - return interceptor(ctx, in, info, handler) +func (x *DeleteBookRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func _Bookstore_ListBooks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListBooksParameters) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BookstoreServer).ListBooks(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/bookstore.Bookstore/ListBooks", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BookstoreServer).ListBooks(ctx, req.(*ListBooksParameters)) +func (*DeleteBookRequest) ProtoMessage() {} + +func (x *DeleteBookRequest) ProtoReflect() protoreflect.Message { + mi := &file_bookstore_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return interceptor(ctx, in, info, handler) + return mi.MessageOf(x) } -func _Bookstore_CreateBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateBookParameters) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BookstoreServer).CreateBook(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/bookstore.Bookstore/CreateBook", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BookstoreServer).CreateBook(ctx, req.(*CreateBookParameters)) - } - return interceptor(ctx, in, info, handler) +// Deprecated: Use DeleteBookRequest.ProtoReflect.Descriptor instead. +func (*DeleteBookRequest) Descriptor() ([]byte, []int) { + return file_bookstore_proto_rawDescGZIP(), []int{11} } -func _Bookstore_GetBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetBookParameters) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BookstoreServer).GetBook(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/bookstore.Bookstore/GetBook", +func (x *DeleteBookRequest) GetShelf() int64 { + if x != nil { + return x.Shelf } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BookstoreServer).GetBook(ctx, req.(*GetBookParameters)) - } - return interceptor(ctx, in, info, handler) + return 0 } -func _Bookstore_DeleteBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteBookParameters) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BookstoreServer).DeleteBook(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/bookstore.Bookstore/DeleteBook", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BookstoreServer).DeleteBook(ctx, req.(*DeleteBookParameters)) +func (x *DeleteBookRequest) GetBook() int64 { + if x != nil { + return x.Book } - return interceptor(ctx, in, info, handler) + return 0 } -var _Bookstore_serviceDesc = grpc.ServiceDesc{ - ServiceName: "bookstore.Bookstore", - HandlerType: (*BookstoreServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListShelves", - Handler: _Bookstore_ListShelves_Handler, - }, - { - MethodName: "CreateShelf", - Handler: _Bookstore_CreateShelf_Handler, - }, - { - MethodName: "DeleteShelves", - Handler: _Bookstore_DeleteShelves_Handler, - }, - { - MethodName: "GetShelf", - Handler: _Bookstore_GetShelf_Handler, - }, - { - MethodName: "DeleteShelf", - Handler: _Bookstore_DeleteShelf_Handler, - }, - { - MethodName: "ListBooks", - Handler: _Bookstore_ListBooks_Handler, - }, - { - MethodName: "CreateBook", - Handler: _Bookstore_CreateBook_Handler, - }, - { - MethodName: "GetBook", - Handler: _Bookstore_GetBook_Handler, - }, - { - MethodName: "DeleteBook", - Handler: _Bookstore_DeleteBook_Handler, +var File_bookstore_proto protoreflect.FileDescriptor + +var file_bookstore_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x09, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x1c, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x6f, + 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, + 0x74, 0x6c, 0x65, 0x22, 0x3a, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6b, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x22, + 0x41, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x07, 0x73, 0x68, 0x65, 0x6c, 0x76, + 0x65, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x35, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, + 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x3c, 0x0a, 0x12, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x26, 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x68, + 0x65, 0x6c, 0x66, 0x52, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x22, 0x27, 0x0a, 0x0f, 0x47, 0x65, + 0x74, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x68, + 0x65, 0x6c, 0x66, 0x22, 0x2a, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, + 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x65, + 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x22, + 0x28, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x22, 0x4e, 0x0a, 0x11, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, + 0x68, 0x65, 0x6c, 0x66, 0x12, 0x23, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x42, + 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x3a, 0x0a, 0x0e, 0x47, 0x65, 0x74, + 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, + 0x68, 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x68, 0x65, 0x6c, + 0x66, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x3d, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, + 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, + 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, + 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, + 0x62, 0x6f, 0x6f, 0x6b, 0x32, 0xd8, 0x06, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x12, 0x57, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, + 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1e, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x0a, 0x12, 0x08, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x0b, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x1d, 0x2e, 0x62, 0x6f, 0x6f, + 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, + 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x22, 0x17, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x11, 0x3a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x22, 0x08, 0x2f, 0x73, 0x68, 0x65, + 0x6c, 0x76, 0x65, 0x73, 0x12, 0x51, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, + 0x65, 0x6c, 0x76, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x2a, 0x08, 0x2f, + 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x12, 0x52, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x53, 0x68, + 0x65, 0x6c, 0x66, 0x12, 0x1a, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, + 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x10, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x68, 0x65, 0x6c, + 0x66, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x73, 0x68, 0x65, 0x6c, + 0x76, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x7d, 0x12, 0x5e, 0x0a, 0x0b, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x1d, 0x2e, 0x62, 0x6f, 0x6f, + 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, + 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x2a, 0x10, 0x2f, 0x73, 0x68, 0x65, 0x6c, + 0x76, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x7d, 0x12, 0x66, 0x0a, 0x09, 0x4c, + 0x69, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x1b, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x73, 0x68, + 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x7d, 0x2f, 0x62, 0x6f, + 0x6f, 0x6b, 0x73, 0x12, 0x61, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, + 0x6b, 0x12, 0x1c, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x0f, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, + 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x3a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x16, + 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x7d, + 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x5c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, + 0x6b, 0x12, 0x19, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, + 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x62, + 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x22, 0x25, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, + 0x7b, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x7d, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x2f, 0x7b, 0x62, + 0x6f, 0x6f, 0x6b, 0x7d, 0x12, 0x69, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, + 0x6f, 0x6b, 0x12, 0x1c, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, + 0x2a, 0x1d, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x6c, + 0x66, 0x7d, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, 0x7d, 0x42, + 0x0d, 0x5a, 0x0b, 0x2e, 0x3b, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_bookstore_proto_rawDescOnce sync.Once + file_bookstore_proto_rawDescData = file_bookstore_proto_rawDesc +) + +func file_bookstore_proto_rawDescGZIP() []byte { + file_bookstore_proto_rawDescOnce.Do(func() { + file_bookstore_proto_rawDescData = protoimpl.X.CompressGZIP(file_bookstore_proto_rawDescData) + }) + return file_bookstore_proto_rawDescData +} + +var file_bookstore_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_bookstore_proto_goTypes = []interface{}{ + (*Book)(nil), // 0: bookstore.Book + (*ListBooksResponse)(nil), // 1: bookstore.ListBooksResponse + (*ListShelvesResponse)(nil), // 2: bookstore.ListShelvesResponse + (*Shelf)(nil), // 3: bookstore.Shelf + (*Error)(nil), // 4: bookstore.Error + (*CreateShelfRequest)(nil), // 5: bookstore.CreateShelfRequest + (*GetShelfRequest)(nil), // 6: bookstore.GetShelfRequest + (*DeleteShelfRequest)(nil), // 7: bookstore.DeleteShelfRequest + (*ListBooksRequest)(nil), // 8: bookstore.ListBooksRequest + (*CreateBookRequest)(nil), // 9: bookstore.CreateBookRequest + (*GetBookRequest)(nil), // 10: bookstore.GetBookRequest + (*DeleteBookRequest)(nil), // 11: bookstore.DeleteBookRequest + (*emptypb.Empty)(nil), // 12: google.protobuf.Empty +} +var file_bookstore_proto_depIdxs = []int32{ + 0, // 0: bookstore.ListBooksResponse.books:type_name -> bookstore.Book + 3, // 1: bookstore.ListShelvesResponse.shelves:type_name -> bookstore.Shelf + 3, // 2: bookstore.CreateShelfRequest.shelf:type_name -> bookstore.Shelf + 0, // 3: bookstore.CreateBookRequest.book:type_name -> bookstore.Book + 12, // 4: bookstore.Bookstore.ListShelves:input_type -> google.protobuf.Empty + 5, // 5: bookstore.Bookstore.CreateShelf:input_type -> bookstore.CreateShelfRequest + 12, // 6: bookstore.Bookstore.DeleteShelves:input_type -> google.protobuf.Empty + 6, // 7: bookstore.Bookstore.GetShelf:input_type -> bookstore.GetShelfRequest + 7, // 8: bookstore.Bookstore.DeleteShelf:input_type -> bookstore.DeleteShelfRequest + 8, // 9: bookstore.Bookstore.ListBooks:input_type -> bookstore.ListBooksRequest + 9, // 10: bookstore.Bookstore.CreateBook:input_type -> bookstore.CreateBookRequest + 10, // 11: bookstore.Bookstore.GetBook:input_type -> bookstore.GetBookRequest + 11, // 12: bookstore.Bookstore.DeleteBook:input_type -> bookstore.DeleteBookRequest + 2, // 13: bookstore.Bookstore.ListShelves:output_type -> bookstore.ListShelvesResponse + 3, // 14: bookstore.Bookstore.CreateShelf:output_type -> bookstore.Shelf + 12, // 15: bookstore.Bookstore.DeleteShelves:output_type -> google.protobuf.Empty + 3, // 16: bookstore.Bookstore.GetShelf:output_type -> bookstore.Shelf + 12, // 17: bookstore.Bookstore.DeleteShelf:output_type -> google.protobuf.Empty + 1, // 18: bookstore.Bookstore.ListBooks:output_type -> bookstore.ListBooksResponse + 0, // 19: bookstore.Bookstore.CreateBook:output_type -> bookstore.Book + 0, // 20: bookstore.Bookstore.GetBook:output_type -> bookstore.Book + 12, // 21: bookstore.Bookstore.DeleteBook:output_type -> google.protobuf.Empty + 13, // [13:22] is the sub-list for method output_type + 4, // [4:13] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_bookstore_proto_init() } +func file_bookstore_proto_init() { + if File_bookstore_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_bookstore_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListBooksResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListShelvesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Shelf); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Error); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateShelfRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetShelfRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteShelfRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListBooksRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateBookRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBookRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bookstore_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteBookRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_bookstore_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "bookstore.proto", + GoTypes: file_bookstore_proto_goTypes, + DependencyIndexes: file_bookstore_proto_depIdxs, + MessageInfos: file_bookstore_proto_msgTypes, + }.Build() + File_bookstore_proto = out.File + file_bookstore_proto_rawDesc = nil + file_bookstore_proto_goTypes = nil + file_bookstore_proto_depIdxs = nil } diff --git a/examples/end-to-end-grpc-gateway/bookstore/bookstore.pb.gw.go b/examples/end-to-end-grpc-gateway/bookstore/bookstore.pb.gw.go index 0c439ee..7230e9d 100644 --- a/examples/end-to-end-grpc-gateway/bookstore/bookstore.pb.gw.go +++ b/examples/end-to-end-grpc-gateway/bookstore/bookstore.pb.gw.go @@ -13,24 +13,27 @@ import ( "io" "net/http" - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/empty" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/emptypb" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = metadata.Join func request_Bookstore_ListShelves_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.ListShelves(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -38,8 +41,17 @@ func request_Bookstore_ListShelves_0(ctx context.Context, marshaler runtime.Mars } +func local_request_Bookstore_ListShelves_0(ctx context.Context, marshaler runtime.Marshaler, server BookstoreServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq emptypb.Empty + var metadata runtime.ServerMetadata + + msg, err := server.ListShelves(ctx, &protoReq) + return msg, metadata, err + +} + func request_Bookstore_CreateShelf_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateShelfParameters + var protoReq CreateShelfRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -55,8 +67,25 @@ func request_Bookstore_CreateShelf_0(ctx context.Context, marshaler runtime.Mars } +func local_request_Bookstore_CreateShelf_0(ctx context.Context, marshaler runtime.Marshaler, server BookstoreServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateShelfRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Shelf); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateShelf(ctx, &protoReq) + return msg, metadata, err + +} + func request_Bookstore_DeleteShelves_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.DeleteShelves(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -64,8 +93,17 @@ func request_Bookstore_DeleteShelves_0(ctx context.Context, marshaler runtime.Ma } +func local_request_Bookstore_DeleteShelves_0(ctx context.Context, marshaler runtime.Marshaler, server BookstoreServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq emptypb.Empty + var metadata runtime.ServerMetadata + + msg, err := server.DeleteShelves(ctx, &protoReq) + return msg, metadata, err + +} + func request_Bookstore_GetShelf_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetShelfParameters + var protoReq GetShelfRequest var metadata runtime.ServerMetadata var ( @@ -81,7 +119,6 @@ func request_Bookstore_GetShelf_0(ctx context.Context, marshaler runtime.Marshal } protoReq.Shelf, err = runtime.Int64(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) } @@ -91,8 +128,8 @@ func request_Bookstore_GetShelf_0(ctx context.Context, marshaler runtime.Marshal } -func request_Bookstore_DeleteShelf_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq DeleteShelfParameters +func local_request_Bookstore_GetShelf_0(ctx context.Context, marshaler runtime.Marshaler, server BookstoreServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetShelfRequest var metadata runtime.ServerMetadata var ( @@ -108,7 +145,32 @@ func request_Bookstore_DeleteShelf_0(ctx context.Context, marshaler runtime.Mars } protoReq.Shelf, err = runtime.Int64(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) + } + + msg, err := server.GetShelf(ctx, &protoReq) + return msg, metadata, err +} + +func request_Bookstore_DeleteShelf_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteShelfRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["shelf"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shelf") + } + + protoReq.Shelf, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) } @@ -118,8 +180,8 @@ func request_Bookstore_DeleteShelf_0(ctx context.Context, marshaler runtime.Mars } -func request_Bookstore_ListBooks_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListBooksParameters +func local_request_Bookstore_DeleteShelf_0(ctx context.Context, marshaler runtime.Marshaler, server BookstoreServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteShelfRequest var metadata runtime.ServerMetadata var ( @@ -135,7 +197,32 @@ func request_Bookstore_ListBooks_0(ctx context.Context, marshaler runtime.Marsha } protoReq.Shelf, err = runtime.Int64(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) + } + msg, err := server.DeleteShelf(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Bookstore_ListBooks_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListBooksRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["shelf"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shelf") + } + + protoReq.Shelf, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) } @@ -145,8 +232,34 @@ func request_Bookstore_ListBooks_0(ctx context.Context, marshaler runtime.Marsha } +func local_request_Bookstore_ListBooks_0(ctx context.Context, marshaler runtime.Marshaler, server BookstoreServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListBooksRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["shelf"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shelf") + } + + protoReq.Shelf, err = runtime.Int64(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) + } + + msg, err := server.ListBooks(ctx, &protoReq) + return msg, metadata, err + +} + func request_Bookstore_CreateBook_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateBookParameters + var protoReq CreateBookRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -170,7 +283,6 @@ func request_Bookstore_CreateBook_0(ctx context.Context, marshaler runtime.Marsh } protoReq.Shelf, err = runtime.Int64(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) } @@ -180,10 +292,18 @@ func request_Bookstore_CreateBook_0(ctx context.Context, marshaler runtime.Marsh } -func request_Bookstore_GetBook_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetBookParameters +func local_request_Bookstore_CreateBook_0(ctx context.Context, marshaler runtime.Marshaler, server BookstoreServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateBookRequest var metadata runtime.ServerMetadata + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Book); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + var ( val string ok bool @@ -197,7 +317,32 @@ func request_Bookstore_GetBook_0(ctx context.Context, marshaler runtime.Marshale } protoReq.Shelf, err = runtime.Int64(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) + } + + msg, err := server.CreateBook(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Bookstore_GetBook_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetBookRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + val, ok = pathParams["shelf"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shelf") + } + + protoReq.Shelf, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) } @@ -208,7 +353,6 @@ func request_Bookstore_GetBook_0(ctx context.Context, marshaler runtime.Marshale } protoReq.Book, err = runtime.Int64(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "book", err) } @@ -218,8 +362,8 @@ func request_Bookstore_GetBook_0(ctx context.Context, marshaler runtime.Marshale } -func request_Bookstore_DeleteBook_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq DeleteBookParameters +func local_request_Bookstore_GetBook_0(ctx context.Context, marshaler runtime.Marshaler, server BookstoreServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetBookRequest var metadata runtime.ServerMetadata var ( @@ -235,7 +379,6 @@ func request_Bookstore_DeleteBook_0(ctx context.Context, marshaler runtime.Marsh } protoReq.Shelf, err = runtime.Int64(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) } @@ -246,7 +389,42 @@ func request_Bookstore_DeleteBook_0(ctx context.Context, marshaler runtime.Marsh } protoReq.Book, err = runtime.Int64(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "book", err) + } + + msg, err := server.GetBook(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Bookstore_DeleteBook_0(ctx context.Context, marshaler runtime.Marshaler, client BookstoreClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteBookRequest + var metadata runtime.ServerMetadata + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["shelf"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shelf") + } + + protoReq.Shelf, err = runtime.Int64(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) + } + + val, ok = pathParams["book"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "book") + } + + protoReq.Book, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "book", err) } @@ -256,10 +434,280 @@ func request_Bookstore_DeleteBook_0(ctx context.Context, marshaler runtime.Marsh } +func local_request_Bookstore_DeleteBook_0(ctx context.Context, marshaler runtime.Marshaler, server BookstoreServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteBookRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["shelf"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shelf") + } + + protoReq.Shelf, err = runtime.Int64(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shelf", err) + } + + val, ok = pathParams["book"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "book") + } + + protoReq.Book, err = runtime.Int64(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "book", err) + } + + msg, err := server.DeleteBook(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterBookstoreHandlerServer registers the http handlers for service Bookstore to "mux". +// UnaryRPC :call BookstoreServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBookstoreHandlerFromEndpoint instead. +func RegisterBookstoreHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BookstoreServer) error { + + mux.Handle("GET", pattern_Bookstore_ListShelves_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bookstore.Bookstore/ListShelves", runtime.WithHTTPPathPattern("/shelves")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Bookstore_ListShelves_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Bookstore_ListShelves_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Bookstore_CreateShelf_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bookstore.Bookstore/CreateShelf", runtime.WithHTTPPathPattern("/shelves")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Bookstore_CreateShelf_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Bookstore_CreateShelf_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_Bookstore_DeleteShelves_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bookstore.Bookstore/DeleteShelves", runtime.WithHTTPPathPattern("/shelves")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Bookstore_DeleteShelves_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Bookstore_DeleteShelves_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Bookstore_GetShelf_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bookstore.Bookstore/GetShelf", runtime.WithHTTPPathPattern("/shelves/{shelf}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Bookstore_GetShelf_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Bookstore_GetShelf_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_Bookstore_DeleteShelf_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bookstore.Bookstore/DeleteShelf", runtime.WithHTTPPathPattern("/shelves/{shelf}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Bookstore_DeleteShelf_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Bookstore_DeleteShelf_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Bookstore_ListBooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bookstore.Bookstore/ListBooks", runtime.WithHTTPPathPattern("/shelves/{shelf}/books")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Bookstore_ListBooks_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Bookstore_ListBooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Bookstore_CreateBook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bookstore.Bookstore/CreateBook", runtime.WithHTTPPathPattern("/shelves/{shelf}/books")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Bookstore_CreateBook_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Bookstore_CreateBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Bookstore_GetBook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bookstore.Bookstore/GetBook", runtime.WithHTTPPathPattern("/shelves/{shelf}/books/{book}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Bookstore_GetBook_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Bookstore_GetBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_Bookstore_DeleteBook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bookstore.Bookstore/DeleteBook", runtime.WithHTTPPathPattern("/shelves/{shelf}/books/{book}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Bookstore_DeleteBook_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Bookstore_DeleteBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + // RegisterBookstoreHandlerFromEndpoint is same as RegisterBookstoreHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterBookstoreHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) + conn, err := grpc.DialContext(ctx, endpoint, opts...) if err != nil { return err } @@ -298,19 +746,21 @@ func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bookstore.Bookstore/ListShelves", runtime.WithHTTPPathPattern("/shelves")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Bookstore_ListShelves_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_Bookstore_ListShelves_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Bookstore_ListShelves_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Bookstore_ListShelves_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -318,19 +768,21 @@ func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bookstore.Bookstore/CreateShelf", runtime.WithHTTPPathPattern("/shelves")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Bookstore_CreateShelf_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_Bookstore_CreateShelf_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Bookstore_CreateShelf_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Bookstore_CreateShelf_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -338,19 +790,21 @@ func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bookstore.Bookstore/DeleteShelves", runtime.WithHTTPPathPattern("/shelves")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Bookstore_DeleteShelves_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_Bookstore_DeleteShelves_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Bookstore_DeleteShelves_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Bookstore_DeleteShelves_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -358,19 +812,21 @@ func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bookstore.Bookstore/GetShelf", runtime.WithHTTPPathPattern("/shelves/{shelf}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Bookstore_GetShelf_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_Bookstore_GetShelf_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Bookstore_GetShelf_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Bookstore_GetShelf_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -378,19 +834,21 @@ func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bookstore.Bookstore/DeleteShelf", runtime.WithHTTPPathPattern("/shelves/{shelf}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Bookstore_DeleteShelf_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_Bookstore_DeleteShelf_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Bookstore_DeleteShelf_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Bookstore_DeleteShelf_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -398,19 +856,21 @@ func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bookstore.Bookstore/ListBooks", runtime.WithHTTPPathPattern("/shelves/{shelf}/books")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Bookstore_ListBooks_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_Bookstore_ListBooks_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Bookstore_ListBooks_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Bookstore_ListBooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -418,19 +878,21 @@ func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bookstore.Bookstore/CreateBook", runtime.WithHTTPPathPattern("/shelves/{shelf}/books")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Bookstore_CreateBook_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_Bookstore_CreateBook_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Bookstore_CreateBook_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Bookstore_CreateBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -438,19 +900,21 @@ func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bookstore.Bookstore/GetBook", runtime.WithHTTPPathPattern("/shelves/{shelf}/books/{book}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Bookstore_GetBook_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_Bookstore_GetBook_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Bookstore_GetBook_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Bookstore_GetBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -458,19 +922,21 @@ func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bookstore.Bookstore/DeleteBook", runtime.WithHTTPPathPattern("/shelves/{shelf}/books/{book}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Bookstore_DeleteBook_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_Bookstore_DeleteBook_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Bookstore_DeleteBook_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Bookstore_DeleteBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -478,23 +944,23 @@ func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, } var ( - pattern_Bookstore_ListShelves_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"shelves"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Bookstore_ListShelves_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"shelves"}, "")) - pattern_Bookstore_CreateShelf_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"shelves"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Bookstore_CreateShelf_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"shelves"}, "")) - pattern_Bookstore_DeleteShelves_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"shelves"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Bookstore_DeleteShelves_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"shelves"}, "")) - pattern_Bookstore_GetShelf_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"shelves", "shelf"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Bookstore_GetShelf_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"shelves", "shelf"}, "")) - pattern_Bookstore_DeleteShelf_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"shelves", "shelf"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Bookstore_DeleteShelf_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"shelves", "shelf"}, "")) - pattern_Bookstore_ListBooks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"shelves", "shelf", "books"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Bookstore_ListBooks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"shelves", "shelf", "books"}, "")) - pattern_Bookstore_CreateBook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"shelves", "shelf", "books"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Bookstore_CreateBook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"shelves", "shelf", "books"}, "")) - pattern_Bookstore_GetBook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"shelves", "shelf", "books", "book"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Bookstore_GetBook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"shelves", "shelf", "books", "book"}, "")) - pattern_Bookstore_DeleteBook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"shelves", "shelf", "books", "book"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Bookstore_DeleteBook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"shelves", "shelf", "books", "book"}, "")) ) var ( diff --git a/examples/end-to-end-grpc-gateway/bookstore/bookstore_grpc.pb.go b/examples/end-to-end-grpc-gateway/bookstore/bookstore_grpc.pb.go new file mode 100644 index 0000000..3601eca --- /dev/null +++ b/examples/end-to-end-grpc-gateway/bookstore/bookstore_grpc.pb.go @@ -0,0 +1,394 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.9 +// source: bookstore.proto + +package bookstore + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// 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 + +// BookstoreClient is the client API for Bookstore service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type BookstoreClient interface { + ListShelves(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListShelvesResponse, error) + CreateShelf(ctx context.Context, in *CreateShelfRequest, opts ...grpc.CallOption) (*Shelf, error) + DeleteShelves(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) + GetShelf(ctx context.Context, in *GetShelfRequest, opts ...grpc.CallOption) (*Shelf, error) + DeleteShelf(ctx context.Context, in *DeleteShelfRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + ListBooks(ctx context.Context, in *ListBooksRequest, opts ...grpc.CallOption) (*ListBooksResponse, error) + CreateBook(ctx context.Context, in *CreateBookRequest, opts ...grpc.CallOption) (*Book, error) + GetBook(ctx context.Context, in *GetBookRequest, opts ...grpc.CallOption) (*Book, error) + DeleteBook(ctx context.Context, in *DeleteBookRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) +} + +type bookstoreClient struct { + cc grpc.ClientConnInterface +} + +func NewBookstoreClient(cc grpc.ClientConnInterface) BookstoreClient { + return &bookstoreClient{cc} +} + +func (c *bookstoreClient) ListShelves(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListShelvesResponse, error) { + out := new(ListShelvesResponse) + err := c.cc.Invoke(ctx, "/bookstore.Bookstore/ListShelves", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bookstoreClient) CreateShelf(ctx context.Context, in *CreateShelfRequest, opts ...grpc.CallOption) (*Shelf, error) { + out := new(Shelf) + err := c.cc.Invoke(ctx, "/bookstore.Bookstore/CreateShelf", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bookstoreClient) DeleteShelves(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/bookstore.Bookstore/DeleteShelves", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bookstoreClient) GetShelf(ctx context.Context, in *GetShelfRequest, opts ...grpc.CallOption) (*Shelf, error) { + out := new(Shelf) + err := c.cc.Invoke(ctx, "/bookstore.Bookstore/GetShelf", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bookstoreClient) DeleteShelf(ctx context.Context, in *DeleteShelfRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/bookstore.Bookstore/DeleteShelf", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bookstoreClient) ListBooks(ctx context.Context, in *ListBooksRequest, opts ...grpc.CallOption) (*ListBooksResponse, error) { + out := new(ListBooksResponse) + err := c.cc.Invoke(ctx, "/bookstore.Bookstore/ListBooks", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bookstoreClient) CreateBook(ctx context.Context, in *CreateBookRequest, opts ...grpc.CallOption) (*Book, error) { + out := new(Book) + err := c.cc.Invoke(ctx, "/bookstore.Bookstore/CreateBook", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bookstoreClient) GetBook(ctx context.Context, in *GetBookRequest, opts ...grpc.CallOption) (*Book, error) { + out := new(Book) + err := c.cc.Invoke(ctx, "/bookstore.Bookstore/GetBook", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bookstoreClient) DeleteBook(ctx context.Context, in *DeleteBookRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/bookstore.Bookstore/DeleteBook", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BookstoreServer is the server API for Bookstore service. +// All implementations must embed UnimplementedBookstoreServer +// for forward compatibility +type BookstoreServer interface { + ListShelves(context.Context, *emptypb.Empty) (*ListShelvesResponse, error) + CreateShelf(context.Context, *CreateShelfRequest) (*Shelf, error) + DeleteShelves(context.Context, *emptypb.Empty) (*emptypb.Empty, error) + GetShelf(context.Context, *GetShelfRequest) (*Shelf, error) + DeleteShelf(context.Context, *DeleteShelfRequest) (*emptypb.Empty, error) + ListBooks(context.Context, *ListBooksRequest) (*ListBooksResponse, error) + CreateBook(context.Context, *CreateBookRequest) (*Book, error) + GetBook(context.Context, *GetBookRequest) (*Book, error) + DeleteBook(context.Context, *DeleteBookRequest) (*emptypb.Empty, error) + mustEmbedUnimplementedBookstoreServer() +} + +// UnimplementedBookstoreServer must be embedded to have forward compatible implementations. +type UnimplementedBookstoreServer struct { +} + +func (UnimplementedBookstoreServer) ListShelves(context.Context, *emptypb.Empty) (*ListShelvesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListShelves not implemented") +} +func (UnimplementedBookstoreServer) CreateShelf(context.Context, *CreateShelfRequest) (*Shelf, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateShelf not implemented") +} +func (UnimplementedBookstoreServer) DeleteShelves(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteShelves not implemented") +} +func (UnimplementedBookstoreServer) GetShelf(context.Context, *GetShelfRequest) (*Shelf, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetShelf not implemented") +} +func (UnimplementedBookstoreServer) DeleteShelf(context.Context, *DeleteShelfRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteShelf not implemented") +} +func (UnimplementedBookstoreServer) ListBooks(context.Context, *ListBooksRequest) (*ListBooksResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListBooks not implemented") +} +func (UnimplementedBookstoreServer) CreateBook(context.Context, *CreateBookRequest) (*Book, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBook not implemented") +} +func (UnimplementedBookstoreServer) GetBook(context.Context, *GetBookRequest) (*Book, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBook not implemented") +} +func (UnimplementedBookstoreServer) DeleteBook(context.Context, *DeleteBookRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteBook not implemented") +} +func (UnimplementedBookstoreServer) mustEmbedUnimplementedBookstoreServer() {} + +// UnsafeBookstoreServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to BookstoreServer will +// result in compilation errors. +type UnsafeBookstoreServer interface { + mustEmbedUnimplementedBookstoreServer() +} + +func RegisterBookstoreServer(s grpc.ServiceRegistrar, srv BookstoreServer) { + s.RegisterService(&Bookstore_ServiceDesc, srv) +} + +func _Bookstore_ListShelves_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BookstoreServer).ListShelves(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bookstore.Bookstore/ListShelves", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BookstoreServer).ListShelves(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _Bookstore_CreateShelf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateShelfRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BookstoreServer).CreateShelf(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bookstore.Bookstore/CreateShelf", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BookstoreServer).CreateShelf(ctx, req.(*CreateShelfRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Bookstore_DeleteShelves_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BookstoreServer).DeleteShelves(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bookstore.Bookstore/DeleteShelves", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BookstoreServer).DeleteShelves(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _Bookstore_GetShelf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetShelfRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BookstoreServer).GetShelf(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bookstore.Bookstore/GetShelf", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BookstoreServer).GetShelf(ctx, req.(*GetShelfRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Bookstore_DeleteShelf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteShelfRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BookstoreServer).DeleteShelf(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bookstore.Bookstore/DeleteShelf", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BookstoreServer).DeleteShelf(ctx, req.(*DeleteShelfRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Bookstore_ListBooks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListBooksRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BookstoreServer).ListBooks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bookstore.Bookstore/ListBooks", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BookstoreServer).ListBooks(ctx, req.(*ListBooksRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Bookstore_CreateBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateBookRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BookstoreServer).CreateBook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bookstore.Bookstore/CreateBook", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BookstoreServer).CreateBook(ctx, req.(*CreateBookRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Bookstore_GetBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBookRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BookstoreServer).GetBook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bookstore.Bookstore/GetBook", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BookstoreServer).GetBook(ctx, req.(*GetBookRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Bookstore_DeleteBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteBookRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BookstoreServer).DeleteBook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bookstore.Bookstore/DeleteBook", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BookstoreServer).DeleteBook(ctx, req.(*DeleteBookRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Bookstore_ServiceDesc is the grpc.ServiceDesc for Bookstore service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Bookstore_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bookstore.Bookstore", + HandlerType: (*BookstoreServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListShelves", + Handler: _Bookstore_ListShelves_Handler, + }, + { + MethodName: "CreateShelf", + Handler: _Bookstore_CreateShelf_Handler, + }, + { + MethodName: "DeleteShelves", + Handler: _Bookstore_DeleteShelves_Handler, + }, + { + MethodName: "GetShelf", + Handler: _Bookstore_GetShelf_Handler, + }, + { + MethodName: "DeleteShelf", + Handler: _Bookstore_DeleteShelf_Handler, + }, + { + MethodName: "ListBooks", + Handler: _Bookstore_ListBooks_Handler, + }, + { + MethodName: "CreateBook", + Handler: _Bookstore_CreateBook_Handler, + }, + { + MethodName: "GetBook", + Handler: _Bookstore_GetBook_Handler, + }, + { + MethodName: "DeleteBook", + Handler: _Bookstore_DeleteBook_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "bookstore.proto", +} diff --git a/examples/end-to-end-grpc-gateway/bookstore/proxy.go b/examples/end-to-end-grpc-gateway/bookstore/proxy.go index 7e5760d..fcdb560 100644 --- a/examples/end-to-end-grpc-gateway/bookstore/proxy.go +++ b/examples/end-to-end-grpc-gateway/bookstore/proxy.go @@ -20,7 +20,7 @@ import ( "net/http" "github.com/golang/glog" - "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/examples/end-to-end-grpc-gateway/bookstore/server.go b/examples/end-to-end-grpc-gateway/bookstore/server.go index df12196..33ff425 100644 --- a/examples/end-to-end-grpc-gateway/bookstore/server.go +++ b/examples/end-to-end-grpc-gateway/bookstore/server.go @@ -22,20 +22,20 @@ import ( "net" "sync" - "github.com/golang/protobuf/ptypes/empty" "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/emptypb" ) const ( port = ":50051" ) -// // The Service type implements a bookstore server. // All objects are managed in an in-memory non-persistent store. // // server is used to implement Bookstoreserver. type server struct { + UnimplementedBookstoreServer // shelves are stored in a map keyed by shelf id // books are stored in a two level map, keyed first by shelf id and then by book id Shelves map[int64]*Shelf @@ -45,7 +45,7 @@ type server struct { Mutex sync.Mutex // global mutex to synchronize service access } -func (s *server) ListShelves(context.Context, *empty.Empty) (*ListShelvesResponse, error) { +func (s *server) ListShelves(context.Context, *emptypb.Empty) (*ListShelvesResponse, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // copy shelf ids from Shelves map keys @@ -59,7 +59,7 @@ func (s *server) ListShelves(context.Context, *empty.Empty) (*ListShelvesRespons return response, nil } -func (s *server) CreateShelf(ctx context.Context, parameters *CreateShelfParameters) (*Shelf, error) { +func (s *server) CreateShelf(ctx context.Context, parameters *CreateShelfRequest) (*Shelf, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // assign an id and name to a shelf and add it to the Shelves map. @@ -72,7 +72,7 @@ func (s *server) CreateShelf(ctx context.Context, parameters *CreateShelfParamet } -func (s *server) DeleteShelves(context.Context, *empty.Empty) (*empty.Empty, error) { +func (s *server) DeleteShelves(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // delete everything by reinitializing the Shelves and Books maps. @@ -83,7 +83,7 @@ func (s *server) DeleteShelves(context.Context, *empty.Empty) (*empty.Empty, err return nil, nil } -func (s *server) GetShelf(ctx context.Context, parameters *GetShelfParameters) (*Shelf, error) { +func (s *server) GetShelf(ctx context.Context, parameters *GetShelfRequest) (*Shelf, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // look up a shelf from the Shelves map. @@ -95,7 +95,7 @@ func (s *server) GetShelf(ctx context.Context, parameters *GetShelfParameters) ( return shelf, nil } -func (s *server) DeleteShelf(ctx context.Context, parameters *DeleteShelfParameters) (*empty.Empty, error) { +func (s *server) DeleteShelf(ctx context.Context, parameters *DeleteShelfRequest) (*emptypb.Empty, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // delete a shelf by removing the shelf from the Shelves map and the associated books from the Books map. @@ -104,7 +104,7 @@ func (s *server) DeleteShelf(ctx context.Context, parameters *DeleteShelfParamet return nil, nil } -func (s *server) ListBooks(ctx context.Context, parameters *ListBooksParameters) (responses *ListBooksResponse, err error) { +func (s *server) ListBooks(ctx context.Context, parameters *ListBooksRequest) (responses *ListBooksResponse, err error) { s.Mutex.Lock() defer s.Mutex.Unlock() // list the books in a shelf @@ -124,7 +124,7 @@ func (s *server) ListBooks(ctx context.Context, parameters *ListBooksParameters) return response, nil } -func (s *server) CreateBook(ctx context.Context, parameters *CreateBookParameters) (*Book, error) { +func (s *server) CreateBook(ctx context.Context, parameters *CreateBookRequest) (*Book, error) { s.Mutex.Lock() defer s.Mutex.Unlock() _, err := s.getShelf(parameters.Shelf) @@ -143,7 +143,7 @@ func (s *server) CreateBook(ctx context.Context, parameters *CreateBookParameter return book, nil } -func (s *server) GetBook(ctx context.Context, parameters *GetBookParameters) (*Book, error) { +func (s *server) GetBook(ctx context.Context, parameters *GetBookRequest) (*Book, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // get a book from the Books map @@ -155,7 +155,7 @@ func (s *server) GetBook(ctx context.Context, parameters *GetBookParameters) (*B return book, nil } -func (s *server) DeleteBook(ctx context.Context, parameters *DeleteBookParameters) (*empty.Empty, error) { +func (s *server) DeleteBook(ctx context.Context, parameters *DeleteBookRequest) (*emptypb.Empty, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // delete a book by removing the book from the Books map. diff --git a/examples/end-to-end-grpc-gateway/grpc-client/client.go b/examples/end-to-end-grpc-gateway/grpc-client/client.go index 648e1f4..8fe36c4 100644 --- a/examples/end-to-end-grpc-gateway/grpc-client/client.go +++ b/examples/end-to-end-grpc-gateway/grpc-client/client.go @@ -21,10 +21,10 @@ import ( "log" "time" - "github.com/golang/protobuf/ptypes/empty" "google.golang.org/grpc" "github.com/google/gnostic-grpc/examples/end-to-end-grpc-gateway/bookstore" + "google.golang.org/protobuf/types/known/emptypb" ) var ( @@ -45,7 +45,7 @@ func main() { client := bookstore.NewBookstoreClient(conn) ctx, _ := context.WithTimeout(context.Background(), 10*time.Second) - res, err := client.ListShelves(ctx, &empty.Empty{}) + res, err := client.ListShelves(ctx, &emptypb.Empty{}) if res != nil { fmt.Println("The themes of your shelves:") for _, shelf := range res.Shelves { diff --git a/examples/end-to-end-grpc-gateway/main.go b/examples/end-to-end-grpc-gateway/main.go index 4efb6f7..961f892 100644 --- a/examples/end-to-end-grpc-gateway/main.go +++ b/examples/end-to-end-grpc-gateway/main.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package main +package bookstore import ( "github.com/google/gnostic-grpc/examples/end-to-end-grpc-gateway/bookstore" diff --git a/examples/end-to-end/README.md b/examples/end-to-end/README.md index e866844..d43d018 100644 --- a/examples/end-to-end/README.md +++ b/examples/end-to-end/README.md @@ -16,7 +16,7 @@ Install [gnostic](https://github.com/google/gnostic), [gnostic-grpc](https://git go get -u github.com/google/gnostic go get -u github.com/google/gnostic-grpc - go get -u github.com/golang/protobuf/protoc-gen-go + go get -u google.golang.org/protobuf/cmd/protoc-gen-go go get -u google.golang.org/grpc For simplicity lets create a temporary environment variable inside your terminal: diff --git a/examples/end-to-end/bookstore/server.go b/examples/end-to-end/bookstore/server.go index df12196..00b75b2 100644 --- a/examples/end-to-end/bookstore/server.go +++ b/examples/end-to-end/bookstore/server.go @@ -22,15 +22,14 @@ import ( "net" "sync" - "github.com/golang/protobuf/ptypes/empty" "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/emptypb" ) const ( port = ":50051" ) -// // The Service type implements a bookstore server. // All objects are managed in an in-memory non-persistent store. // @@ -45,7 +44,7 @@ type server struct { Mutex sync.Mutex // global mutex to synchronize service access } -func (s *server) ListShelves(context.Context, *empty.Empty) (*ListShelvesResponse, error) { +func (s *server) ListShelves(context.Context, *emptypb.Empty) (*ListShelvesResponse, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // copy shelf ids from Shelves map keys @@ -72,7 +71,7 @@ func (s *server) CreateShelf(ctx context.Context, parameters *CreateShelfParamet } -func (s *server) DeleteShelves(context.Context, *empty.Empty) (*empty.Empty, error) { +func (s *server) DeleteShelves(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // delete everything by reinitializing the Shelves and Books maps. @@ -95,7 +94,7 @@ func (s *server) GetShelf(ctx context.Context, parameters *GetShelfParameters) ( return shelf, nil } -func (s *server) DeleteShelf(ctx context.Context, parameters *DeleteShelfParameters) (*empty.Empty, error) { +func (s *server) DeleteShelf(ctx context.Context, parameters *DeleteShelfParameters) (*emptypb.Empty, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // delete a shelf by removing the shelf from the Shelves map and the associated books from the Books map. @@ -155,7 +154,7 @@ func (s *server) GetBook(ctx context.Context, parameters *GetBookParameters) (*B return book, nil } -func (s *server) DeleteBook(ctx context.Context, parameters *DeleteBookParameters) (*empty.Empty, error) { +func (s *server) DeleteBook(ctx context.Context, parameters *DeleteBookParameters) (*emptypb.Empty, error) { s.Mutex.Lock() defer s.Mutex.Unlock() // delete a book by removing the book from the Books map. diff --git a/examples/end-to-end/grpc-client/client.go b/examples/end-to-end/grpc-client/client.go index c58aa18..ec0686a 100644 --- a/examples/end-to-end/grpc-client/client.go +++ b/examples/end-to-end/grpc-client/client.go @@ -21,8 +21,8 @@ import ( "log" "time" - "github.com/golang/protobuf/ptypes/empty" "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/emptypb" "github.com/google/gnostic-grpc/examples/end-to-end/bookstore" ) @@ -45,7 +45,7 @@ func main() { client := bookstore.NewBookstoreClient(conn) ctx, _ := context.WithTimeout(context.Background(), 10*time.Second) - res, err := client.ListShelves(ctx, &empty.Empty{}) + res, err := client.ListShelves(ctx, &emptypb.Empty{}) if res != nil { fmt.Println("The themes of your shelves:") for _, shelf := range res.Shelves { diff --git a/go.mod b/go.mod index a79d392..2d7e3a9 100644 --- a/go.mod +++ b/go.mod @@ -3,21 +3,23 @@ module github.com/google/gnostic-grpc go 1.20 require ( - github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b - github.com/golang/protobuf v1.5.2 + github.com/golang/glog v1.1.0 + github.com/golang/protobuf v1.5.3 github.com/google/gnostic v0.6.9 - github.com/google/go-cmp v0.5.6 - github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/google/go-cmp v0.5.9 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1 github.com/jhump/protoreflect v1.10.0 - golang.org/x/net v0.7.0 - google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 - google.golang.org/grpc v1.41.0 - google.golang.org/protobuf v1.27.1 - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b + golang.org/x/net v0.14.0 + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d + google.golang.org/grpc v1.57.0 + google.golang.org/protobuf v1.31.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect + google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect ) diff --git a/go.sum b/go.sum index 4dfbcec..cdd8dd1 100644 --- a/go.sum +++ b/go.sum @@ -6,12 +6,10 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= @@ -20,12 +18,12 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -39,8 +37,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -49,19 +48,20 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1 h1:LSsiG61v9IzzxMkqEr6nrix4miJI62xlRjwT7BYD2SM= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1/go.mod h1:Hbb13e3/WtqQ8U5hLGkek9gJvBLasHuPFI0UEGfnQ10= github.com/jhump/protoreflect v1.10.0 h1:mbS/mqFrJSliRdPuNP+LY0JqitVP0SW58GQ7A2l2dTI= github.com/jhump/protoreflect v1.10.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -70,12 +70,13 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= @@ -105,8 +106,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -123,15 +124,15 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -144,7 +145,6 @@ golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -152,8 +152,13 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 h1:Et6SkiuvnBn+SgrSYXs/BrUpGB4mbdwt4R3vaPIlicA= google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +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-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= 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= @@ -161,8 +166,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= -google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= 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= @@ -175,19 +180,19 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= From 8da9e47d8fbe3612c31a79818c54b4d80c2e4fc6 Mon Sep 17 00:00:00 2001 From: Ilya Alexin Date: Sun, 3 Sep 2023 14:49:26 +0200 Subject: [PATCH 04/10] upgraded deps --- COMPILE-PROTOS.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COMPILE-PROTOS.sh b/COMPILE-PROTOS.sh index ddcd99b..3e29d54 100755 --- a/COMPILE-PROTOS.sh +++ b/COMPILE-PROTOS.sh @@ -3,7 +3,7 @@ TMP_GOBIN=$(mktemp -d -t gnostic-grpc.XXXXXXXXXX) GOBIN=${TMP_GOBIN} go install ./search -GOBIN=${TMP_GOBIN} go install -mod=mod github.com/golang/protobuf/protoc-gen-go@v1.5.2 +GOBIN=${TMP_GOBIN} go install -mod=mod google.golang.org/protobuf/cmd/protoc-gen-go@v1.29.1 PATH="$TMP_GOBIN:$PATH" protoc --go_out=incompatibility/ ./incompatibility/incompatibility-report.proto rm -rf "${TMP_GOBIN}" From eeeffc5e36688be96d1619205943e631f02dd8a6 Mon Sep 17 00:00:00 2001 From: Ilya Alexin Date: Sun, 3 Sep 2023 16:58:09 +0200 Subject: [PATCH 05/10] changed links in e2e tests --- examples/end-to-end-grpc-gateway/README.md | 4 +--- examples/end-to-end-grpc-gateway/main.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/end-to-end-grpc-gateway/README.md b/examples/end-to-end-grpc-gateway/README.md index 4db4609..bd7e65c 100644 --- a/examples/end-to-end-grpc-gateway/README.md +++ b/examples/end-to-end-grpc-gateway/README.md @@ -24,7 +24,7 @@ This tutorial has six steps: #### Prerequisite Install [gnostic](https://github.com/google/gnostic), [gnostic-grpc](https://github.com/google/gnostic-grpc), -[go plugin for protoc](https://github.com/golang/protobuf/protoc-gen-go), [gRPC gateway plugin](https://github.com/grpc-ecosystem/grpc-gateway) +[go plugin for protoc](https://github.com/protocolbuffers/protobuf-go/tree/master/cmd/protoc-gen-go), [gRPC gateway plugin](https://github.com/grpc-ecosystem/grpc-gateway) and [gRPC](https://grpc.io/) go get -u github.com/google/gnostic@v0.6.9 @@ -59,8 +59,6 @@ We added an example implementation of the server using the generated gRPC stubs #### 4. Step Generate the reverse proxy with the gRPC gateway plugin: - protoc --proto_path=. --proto_path=${ANNOTATIONS} --grpc-gateway_out=bookstore bookstore.proto - protoc --proto_path=. --proto_path=${ANNOTATIONS} --grpc-gateway_out=bookstore bookstore.proto This generates `bookstore/bookstore.pb.gw.go`. diff --git a/examples/end-to-end-grpc-gateway/main.go b/examples/end-to-end-grpc-gateway/main.go index 961f892..4efb6f7 100644 --- a/examples/end-to-end-grpc-gateway/main.go +++ b/examples/end-to-end-grpc-gateway/main.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package bookstore +package main import ( "github.com/google/gnostic-grpc/examples/end-to-end-grpc-gateway/bookstore" From 584338b478e8cb612dfd545f8181b210f25a9cba Mon Sep 17 00:00:00 2001 From: Ilya Alexin Date: Thu, 14 Sep 2023 10:36:49 +0200 Subject: [PATCH 06/10] changed github workflow rule --- .github/workflows/go.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 24e8ab1..16adf84 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,7 +2,11 @@ name: Go on: push: - workflow_dispatch: + branches: + - master + pull_request: + branches: + - master jobs: test: From 037fd4a942c8f4006048871604f7b748e62dc34c Mon Sep 17 00:00:00 2001 From: Ilya Alexin Date: Thu, 14 Sep 2023 10:45:59 +0200 Subject: [PATCH 07/10] added workflow dispatch trigger --- .github/workflows/go.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 16adf84..824203a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - master + workflow_dispatch: jobs: test: From f8a1eef5c918821934b959a3b0cc297c98588552 Mon Sep 17 00:00:00 2001 From: Ilya Alexin Date: Thu, 14 Sep 2023 10:50:16 +0200 Subject: [PATCH 08/10] upgrade golang in github action --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 824203a..e9c6143 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.17 + go-version: 1.20 - name: Check out code into the Go module directory uses: actions/checkout@v3 From bde9aabddef88a12f6740019ebd65b2c4b456140 Mon Sep 17 00:00:00 2001 From: Ilya Alexin Date: Sun, 8 Oct 2023 23:40:31 +0200 Subject: [PATCH 09/10] delete workflow dispatch option --- .github/workflows/go.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e9c6143..f6f0d1d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,7 +7,6 @@ on: pull_request: branches: - master - workflow_dispatch: jobs: test: From 7a8a96a3b70f150563d257ce24c4f7f8ca855580 Mon Sep 17 00:00:00 2001 From: Ilya Alexin Date: Sun, 8 Oct 2023 23:42:04 +0200 Subject: [PATCH 10/10] renamed mr branch in github flow --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f6f0d1d..2d1fa06 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -3,10 +3,10 @@ name: Go on: push: branches: - - master + - main pull_request: branches: - - master + - main jobs: test: