From 91ecb14e94822d8f55cf68959c285349c6d7c521 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Wed, 7 Jan 2026 16:51:07 -0500 Subject: [PATCH 01/18] fix(gengateway): honor opaque setters [WHY] Opaque-enabled protos expose nested fields only through getter/setter chains, so generated Setkey.* calls failed to compile yet path params remained unset. [WHAT] Added FieldPath helpers to build setter chains, swapped template setter sites to the helper, and codified the behavior with unit tests. [HOW] Build the accessor expression once from the descriptor so every opaque path-param assignment reuses it. [TEST] go test ./internal/descriptor; go test ./protoc-gen-grpc-gateway/internal/gengateway [RISK] low; changes affect only opaque path-param generation paths. [RAG] finxact_engineering_domain_customerv1poc_proto::module::buf|1.30,finxact_engineering_domain_customerv1poc_proto::module::finxact_type|1.59,finxact_engineering_domain_customerv1poc_gen_go::repo_overview|1.70 --- internal/descriptor/types.go | 33 +++++++++++++++++-- internal/descriptor/types_test.go | 33 +++++++++++++++++++ .../internal/gengateway/template.go | 15 +++++---- 3 files changed, 73 insertions(+), 8 deletions(-) diff --git a/internal/descriptor/types.go b/internal/descriptor/types.go index 5a43472baa3..3b10fdd3c8b 100644 --- a/internal/descriptor/types.go +++ b/internal/descriptor/types.go @@ -293,7 +293,8 @@ func (p Parameter) ConvertFuncExpr() (string, error) { conv, ok = wellKnownTypeConv[p.Target.GetTypeName()] } if !ok { - return "", fmt.Errorf("unsupported field type %s of parameter %s in %s.%s", typ, p.FieldPath, p.Method.Service.GetName(), p.Method.GetName()) + return "", fmt.Errorf("unsupported field type %s of parameter %s in %s.%s", typ, p.FieldPath, + p.Method.Service.GetName(), p.Method.GetName()) } return conv, nil } @@ -430,7 +431,9 @@ func (p FieldPath) AssignableExprPrep(msgExpr string, currentPackage string) str return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *%s, but: %%t\n",%s) }` - preparations = append(preparations, fmt.Sprintf(s, components, components, oneofFieldName, components, oneofFieldName, oneofFieldName, components)) + preparations = append(preparations, + fmt.Sprintf(s, components, components, oneofFieldName, components, oneofFieldName, oneofFieldName, + components)) components = components + ".(*" + oneofFieldName + ")" } @@ -444,6 +447,32 @@ func (p FieldPath) AssignableExprPrep(msgExpr string, currentPackage string) str return strings.Join(preparations, "\n") } +// OpaqueSetterExpr returns the Go expression to invoke the generated setter for +// the final component in the path while respecting nested getters required by +// the opaque API. +func (p FieldPath) OpaqueSetterExpr(msgExpr string) string { + if len(p) == 0 { + return msgExpr + } + + return fmt.Sprintf("%s.Set%s", p.opaqueOwnerExpr(msgExpr), casing.Camel(p[len(p)-1].Name)) +} + +// opaqueOwnerExpr builds the Go expression for the message that owns the final +// component in the path by chaining the generated getters. +func (p FieldPath) opaqueOwnerExpr(msgExpr string) string { + owner := msgExpr + if len(p) <= 1 { + return owner + } + + for _, component := range p[:len(p)-1] { + owner = fmt.Sprintf("%s.Get%s()", owner, casing.Camel(component.Name)) + } + + return owner +} + // FieldPathComponent is a path component in FieldPath type FieldPathComponent struct { // Name is a name of the proto field which this component corresponds to. diff --git a/internal/descriptor/types_test.go b/internal/descriptor/types_test.go index ba9737a17d3..53b7a363aa5 100644 --- a/internal/descriptor/types_test.go +++ b/internal/descriptor/types_test.go @@ -205,6 +205,39 @@ func TestFieldPath(t *testing.T) { } } +func TestFieldPathOpaqueSetterExpr(t *testing.T) { + t.Parallel() + + testCases := map[string]struct { + fieldPath FieldPath + msgExpr string + want string + }{ + "top-level field": { + fieldPath: FieldPath{{Name: "data"}}, + msgExpr: "req", + want: "req.SetData", + }, + "nested field": { + fieldPath: FieldPath{{Name: "key"}, {Name: "date_type"}}, + msgExpr: "req", + want: "req.GetKey().SetDateType", + }, + } + + for name, tc := range testCases { + tc := tc + t.Run(name, func(t *testing.T) { + t.Parallel() + + got := tc.fieldPath.OpaqueSetterExpr(tc.msgExpr) + if got != tc.want { + t.Fatalf("OpaqueSetterExpr(%q) = %q; want %q", tc.msgExpr, got, tc.want) + } + }) + } +} + func TestGoType(t *testing.T) { src := ` name: 'example.proto' diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template.go b/protoc-gen-grpc-gateway/internal/gengateway/template.go index df69e78e6a9..a08e0b45090 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template.go @@ -358,6 +358,9 @@ func request_{{ .Method.Service.GetName }}_{{ .Method.GetName }}_{{ .Index }}(ct funcMap template.FuncMap = map[string]interface{}{ "camelIdentifier": casing.CamelIdentifier, + "opaqueSetter": func(p descriptor.FieldPath, msgExpr string) string { + return p.OpaqueSetterExpr(msgExpr) + }, "toHTTPMethod": func(method string) string { return httpMethods[method] }, @@ -499,7 +502,7 @@ var filter_{{ .Method.Service.GetName }}_{{ .Method.GetName }}_{{ .Index }} = {{ if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{ $param | printf "%q"}}, err) } - protoReq.Set{{ $param.FieldPath.String | camelIdentifier }}(converted{{ $param.FieldPath.String | camelIdentifier }}) + {{ opaqueSetter $param.FieldPath "protoReq" }}(converted{{ $param.FieldPath.String | camelIdentifier }}) {{- else }} {{ $param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path }}, err = {{ $param.ConvertFuncExpr }}(val{{ if $param.IsRepeated }}, {{ $binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q" }}{{ end }}) if err != nil { @@ -513,13 +516,13 @@ var filter_{{ .Method.Service.GetName }}_{{ .Method.GetName }}_{{ .Index }} = {{ s[i] = {{ $enum.GoType $param.Method.Service.File.GoPkg.Path}}(v) } {{- if $UseOpaqueAPI }} - protoReq.Set{{ $param.FieldPath.String | camelIdentifier }}(s) + {{ opaqueSetter $param.FieldPath "protoReq" }}(s) {{- else }} {{ $param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path }} = s {{- end }} {{- else if $enum}} {{- if $UseOpaqueAPI }} - protoReq.Set{{ $param.FieldPath.String | camelIdentifier }}({{ $enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier }}(e)) + {{ opaqueSetter $param.FieldPath "protoReq" }}({{ $enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier }}(e)) {{- else }} {{ $param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path }} = {{ $enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier }}(e) {{- end }} @@ -734,7 +737,7 @@ func local_request_{{ .Method.Service.GetName }}_{{ .Method.GetName }}_{{ .Index if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{ $param | printf "%q"}}, err) } - protoReq.Set{{ $param.FieldPath.String | camelIdentifier }}(converted{{ $param.FieldPath.String | camelIdentifier }}) + {{ opaqueSetter $param.FieldPath "protoReq" }}(converted{{ $param.FieldPath.String | camelIdentifier }}) {{- else }} {{ $param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path }}, err = {{ $param.ConvertFuncExpr }}(val{{ if $param.IsRepeated }}, {{ $binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q" }}{{ end }}) if err != nil { @@ -748,13 +751,13 @@ func local_request_{{ .Method.Service.GetName }}_{{ .Method.GetName }}_{{ .Index s[i] = {{ $enum.GoType $param.Method.Service.File.GoPkg.Path }}(v) } {{- if $UseOpaqueAPI }} - protoReq.Set{{ $param.FieldPath.String | camelIdentifier }}(s) + {{ opaqueSetter $param.FieldPath "protoReq" }}(s) {{- else }} {{ $param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path }} = s {{- end }} {{- else if $enum }} {{- if $UseOpaqueAPI }} - protoReq.Set{{ $param.FieldPath.String | camelIdentifier }}({{ $enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier }}(e)) + {{ opaqueSetter $param.FieldPath "protoReq" }}({{ $enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier }}(e)) {{- else }} {{ $param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path }} = {{ $enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier }}(e) {{- end }} From 2b92e8b9ba244832bdde96632b14540f1c201225 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Wed, 7 Jan 2026 17:03:20 -0500 Subject: [PATCH 02/18] test(gengateway): cover opaque enum path params [WHY] Prevent regressions for the nested enum path-param case that triggered the bug. [WHAT] Add a generator test that synthesizes a proto3 file with an opaque nested enum binding and asserts the emitted setter chain. [HOW] Load the fake file into the descriptor registry so LookupEnum succeeds and search for the expected SetKind expression. [TEST] go test ./protoc-gen-grpc-gateway/internal/gengateway [RISK] none; test-only change [RAG] finxact_engineering_domain_customerv1poc_proto::module::buf|1.30,finxact_engineering_domain_customerv1poc_proto::module::finxact_type|1.59,finxact_engineering_domain_customerv1poc_gen_go::repo_overview|1.70 --- .../internal/gengateway/template_test.go | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go index 2ee159e4a93..799a3ae17dc 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go @@ -8,6 +8,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { @@ -272,6 +273,157 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { } } +func TestApplyTemplateOpaqueNestedEnumPathParam(t *testing.T) { + t.Parallel() + + enumdesc := &descriptorpb.EnumDescriptorProto{ + Name: proto.String("Color"), + Value: []*descriptorpb.EnumValueDescriptorProto{ + { + Name: proto.String("COLOR_UNSPECIFIED"), + Number: proto.Int32(0), + }, + { + Name: proto.String("COLOR_RED"), + Number: proto.Int32(1), + }, + }, + } + nesteddesc := &descriptorpb.DescriptorProto{ + Name: proto.String("NestedMessage"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: proto.String("kind"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), + TypeName: proto.String(".example.NestedMessage.Color"), + Number: proto.Int32(1), + }, + }, + EnumType: []*descriptorpb.EnumDescriptorProto{enumdesc}, + } + msgdesc := &descriptorpb.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: proto.String("nested"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String(".example.NestedMessage"), + Number: proto.Int32(1), + }, + }, + } + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: proto.String("example.proto"), + Package: proto.String("example"), + Syntax: proto.String("proto3"), + MessageType: []*descriptorpb.DescriptorProto{msgdesc, nesteddesc}, + Options: &descriptorpb.FileOptions{ + GoPackage: proto.String("example.com/path/to/example/example.pb;example_pb"), + }, + } + meth := &descriptorpb.MethodDescriptorProto{ + Name: proto.String("PatchThing"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + } + svc := &descriptorpb.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*descriptorpb.MethodDescriptorProto{meth}, + } + file := descriptor.File{ + FileDescriptorProto: fileDesc, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{ + { + DescriptorProto: msgdesc, + }, + { + DescriptorProto: nesteddesc, + }, + }, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: &descriptor.Message{ + DescriptorProto: msgdesc, + }, + ResponseType: &descriptor.Message{ + DescriptorProto: msgdesc, + }, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "PATCH", + PathTmpl: compilePath(t, "/v1/{nested.kind}"), + PathParams: []descriptor.Parameter{{}}, + }, + }, + }, + }, + }, + }, + } + + msg := file.Messages[0] + nested := file.Messages[1] + nestedField := &descriptor.Field{ + Message: msg, + FieldDescriptorProto: msgdesc.Field[0], + } + enumField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nesteddesc.Field[0], + } + file.Messages[0] = msg + file.Messages[1] = nested + file.Services[0].Methods[0].RequestType = msg + file.Services[0].Methods[0].ResponseType = msg + file.Services[0].Methods[0].Bindings[0].PathParams[0] = descriptor.Parameter{ + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "kind", + Target: enumField, + }, + }), + Target: enumField, + } + file.Services[0].Methods[0].Bindings[0].PathParams[0].Method = file.Services[0].Methods[0] + + reg := descriptor.NewRegistry() + req := &pluginpb.CodeGeneratorRequest{ + FileToGenerate: []string{"example.proto"}, + ProtoFile: []*descriptorpb.FileDescriptorProto{fileDesc}, + } + if err := reg.Load(req); err != nil { + t.Fatalf("registry load failed: %v", err) + } + + got, err := applyTemplate(param{ + File: crossLinkFixture(&file), + RegisterFuncSuffix: "Handler", + AllowPatchFeature: true, + UseOpaqueAPI: true, + }, reg) + if err != nil { + t.Fatalf("applyTemplate failed: %v", err) + } + + if want := `protoReq.GetNested().SetKind(NestedMessage_Color(e))`; !strings.Contains(got, want) { + t.Fatalf("generated code missing setter: %s", got) + } +} + func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), From ce80ff326f2b819c5dd918b6f2122b304432a421 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Thu, 8 Jan 2026 10:04:44 -0500 Subject: [PATCH 03/18] test(gengateway): cover opaque path params generically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [WHY] The opaque setter bug isn’t limited to enums or PATCH bindings, so tests should cover both scalar and enum parameters across HTTP methods. [WHAT] Simplified the generator test to synthesize a proto with top-level path params and assert the opaque setter is emitted for GET (string) and PATCH (enum). [HOW] Build descriptors directly, cross-link them once, and verify the generated code contains the expected setter expression for each case. [TEST] go test ./protoc-gen-grpc-gateway/internal/gengateway [RISK] none; test-only change [RAG] finxact_engineering_domain_customerv1poc_proto::module::buf|1.30,finxact_engineering_domain_customerv1poc_proto::module::finxact_type|1.59,finxact_engineering_domain_customerv1poc_gen_go::repo_overview|1.70 --- .../internal/gengateway/template_test.go | 250 +++++++++--------- 1 file changed, 131 insertions(+), 119 deletions(-) diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go index 799a3ae17dc..420ff2141a3 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go @@ -273,7 +273,7 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { } } -func TestApplyTemplateOpaqueNestedEnumPathParam(t *testing.T) { +func TestApplyTemplateOpaquePathParams(t *testing.T) { t.Parallel() enumdesc := &descriptorpb.EnumDescriptorProto{ @@ -289,138 +289,150 @@ func TestApplyTemplateOpaqueNestedEnumPathParam(t *testing.T) { }, }, } - nesteddesc := &descriptorpb.DescriptorProto{ - Name: proto.String("NestedMessage"), - Field: []*descriptorpb.FieldDescriptorProto{ - { - Name: proto.String("kind"), - Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), - Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), - TypeName: proto.String(".example.NestedMessage.Color"), - Number: proto.Int32(1), - }, - }, - EnumType: []*descriptorpb.EnumDescriptorProto{enumdesc}, - } - msgdesc := &descriptorpb.DescriptorProto{ - Name: proto.String("ExampleMessage"), - Field: []*descriptorpb.FieldDescriptorProto{ - { - Name: proto.String("nested"), - Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), - Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), - TypeName: proto.String(".example.NestedMessage"), - Number: proto.Int32(1), - }, + + baseField := &descriptorpb.FieldDescriptorProto{ + Name: proto.String("kind"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + } + enumField := proto.Clone(baseField).(*descriptorpb.FieldDescriptorProto) + enumField.Type = descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum() + enumField.TypeName = proto.String(".example.Color") + + cases := []struct { + name string + field *descriptorpb.FieldDescriptorProto + enumDesc *descriptorpb.EnumDescriptorProto + httpMethod string + expect string + }{ + { + name: "scalar GET", + field: baseField, + httpMethod: "GET", + expect: "protoReq.SetKind(convertedKind)", }, - } - fileDesc := &descriptorpb.FileDescriptorProto{ - Name: proto.String("example.proto"), - Package: proto.String("example"), - Syntax: proto.String("proto3"), - MessageType: []*descriptorpb.DescriptorProto{msgdesc, nesteddesc}, - Options: &descriptorpb.FileOptions{ - GoPackage: proto.String("example.com/path/to/example/example.pb;example_pb"), + { + name: "enum PATCH", + field: enumField, + enumDesc: enumdesc, + httpMethod: "PATCH", + expect: "protoReq.SetKind(Color(e))", }, } - meth := &descriptorpb.MethodDescriptorProto{ - Name: proto.String("PatchThing"), - InputType: proto.String("ExampleMessage"), - OutputType: proto.String("ExampleMessage"), - } - svc := &descriptorpb.ServiceDescriptorProto{ - Name: proto.String("ExampleService"), - Method: []*descriptorpb.MethodDescriptorProto{meth}, - } - file := descriptor.File{ - FileDescriptorProto: fileDesc, - GoPkg: descriptor.GoPackage{ - Path: "example.com/path/to/example/example.pb", - Name: "example_pb", - }, - Messages: []*descriptor.Message{ - { + + for _, tc := range cases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + msgdesc := &descriptorpb.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*descriptorpb.FieldDescriptorProto{ + proto.Clone(tc.field).(*descriptorpb.FieldDescriptorProto), + }, + } + if tc.enumDesc != nil { + msgdesc.EnumType = []*descriptorpb.EnumDescriptorProto{proto.Clone(tc.enumDesc).(*descriptorpb.EnumDescriptorProto)} + } + + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: proto.String("example.proto"), + Package: proto.String("example"), + Syntax: proto.String("proto3"), + MessageType: []*descriptorpb.DescriptorProto{msgdesc}, + Options: &descriptorpb.FileOptions{ + GoPackage: proto.String("example.com/path/to/example/example.pb;example_pb"), + }, + } + if tc.enumDesc != nil { + fileDesc.EnumType = []*descriptorpb.EnumDescriptorProto{proto.Clone(tc.enumDesc).(*descriptorpb.EnumDescriptorProto)} + } + + meth := &descriptorpb.MethodDescriptorProto{ + Name: proto.String("DoThing"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + } + svc := &descriptorpb.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*descriptorpb.MethodDescriptorProto{meth}, + } + + msg := &descriptor.Message{ DescriptorProto: msgdesc, - }, - { - DescriptorProto: nesteddesc, - }, - }, - Services: []*descriptor.Service{ - { - ServiceDescriptorProto: svc, - Methods: []*descriptor.Method{ + } + field := &descriptor.Field{ + Message: msg, + FieldDescriptorProto: msgdesc.Field[0], + } + msg.Fields = []*descriptor.Field{field} + + file := descriptor.File{ + FileDescriptorProto: fileDesc, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg}, + Services: []*descriptor.Service{ { - MethodDescriptorProto: meth, - RequestType: &descriptor.Message{ - DescriptorProto: msgdesc, - }, - ResponseType: &descriptor.Message{ - DescriptorProto: msgdesc, - }, - Bindings: []*descriptor.Binding{ + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ { - HTTPMethod: "PATCH", - PathTmpl: compilePath(t, "/v1/{nested.kind}"), - PathParams: []descriptor.Parameter{{}}, + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: tc.httpMethod, + PathTmpl: compilePath(t, "/v1/{kind}"), + PathParams: []descriptor.Parameter{ + { + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "kind", + Target: field, + }, + }), + Target: field, + }, + }, + }, + }, }, }, }, }, - }, - }, - } + } - msg := file.Messages[0] - nested := file.Messages[1] - nestedField := &descriptor.Field{ - Message: msg, - FieldDescriptorProto: msgdesc.Field[0], - } - enumField := &descriptor.Field{ - Message: nested, - FieldDescriptorProto: nesteddesc.Field[0], - } - file.Messages[0] = msg - file.Messages[1] = nested - file.Services[0].Methods[0].RequestType = msg - file.Services[0].Methods[0].ResponseType = msg - file.Services[0].Methods[0].Bindings[0].PathParams[0] = descriptor.Parameter{ - FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ - { - Name: "nested", - Target: nestedField, - }, - { - Name: "kind", - Target: enumField, - }, - }), - Target: enumField, - } - file.Services[0].Methods[0].Bindings[0].PathParams[0].Method = file.Services[0].Methods[0] + reg := descriptor.NewRegistry() + req := &pluginpb.CodeGeneratorRequest{ + FileToGenerate: []string{"example.proto"}, + ProtoFile: []*descriptorpb.FileDescriptorProto{fileDesc}, + } + if err := reg.Load(req); err != nil { + t.Fatalf("registry load failed: %v", err) + } - reg := descriptor.NewRegistry() - req := &pluginpb.CodeGeneratorRequest{ - FileToGenerate: []string{"example.proto"}, - ProtoFile: []*descriptorpb.FileDescriptorProto{fileDesc}, - } - if err := reg.Load(req); err != nil { - t.Fatalf("registry load failed: %v", err) - } + cloned := crossLinkFixture(&file) + cloned.Services[0].Methods[0].Bindings[0].PathParams[0].Method = cloned.Services[0].Methods[0] - got, err := applyTemplate(param{ - File: crossLinkFixture(&file), - RegisterFuncSuffix: "Handler", - AllowPatchFeature: true, - UseOpaqueAPI: true, - }, reg) - if err != nil { - t.Fatalf("applyTemplate failed: %v", err) - } + got, err := applyTemplate(param{ + File: cloned, + RegisterFuncSuffix: "Handler", + AllowPatchFeature: true, + UseOpaqueAPI: true, + }, reg) + if err != nil { + t.Fatalf("applyTemplate failed: %v", err) + } - if want := `protoReq.GetNested().SetKind(NestedMessage_Color(e))`; !strings.Contains(got, want) { - t.Fatalf("generated code missing setter: %s", got) + if !strings.Contains(got, tc.expect) { + t.Fatalf("generated code missing %q: %s", tc.expect, got) + } + }) } } From ff11551db79d0b491cfe75f16c384489609baf11 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Thu, 8 Jan 2026 10:11:10 -0500 Subject: [PATCH 04/18] test(tests): improve formatting consistency and simplify parallel test cases --- internal/descriptor/types_test.go | 18 ++-- .../internal/gengateway/template_test.go | 90 +++++++++++-------- 2 files changed, 62 insertions(+), 46 deletions(-) diff --git a/internal/descriptor/types_test.go b/internal/descriptor/types_test.go index 53b7a363aa5..4bd14dd9d9c 100644 --- a/internal/descriptor/types_test.go +++ b/internal/descriptor/types_test.go @@ -185,7 +185,8 @@ func TestFieldPath(t *testing.T) { Target: nest1.Fields[1], }, } - if got, want := fp.AssignableExpr("resp", "example"), "resp.GetNestField().Nest2Field.GetNestField().TerminalField"; got != want { + if got, want := fp.AssignableExpr("resp", + "example"), "resp.GetNestField().Nest2Field.GetNestField().TerminalField"; got != want { t.Errorf("fp.AssignableExpr(%q) = %q; want %q", "resp", got, want) } @@ -195,7 +196,8 @@ func TestFieldPath(t *testing.T) { Target: nest2.Fields[1], }, } - if got, want := fp2.AssignableExpr("resp", "example"), "resp.Nest2Field.GetNestField().Nest2Field.TerminalField"; got != want { + if got, want := fp2.AssignableExpr("resp", + "example"), "resp.Nest2Field.GetNestField().Nest2Field.TerminalField"; got != want { t.Errorf("fp2.AssignableExpr(%q) = %q; want %q", "resp", got, want) } @@ -206,9 +208,7 @@ func TestFieldPath(t *testing.T) { } func TestFieldPathOpaqueSetterExpr(t *testing.T) { - t.Parallel() - - testCases := map[string]struct { + tcs := map[string]struct { fieldPath FieldPath msgExpr string want string @@ -225,13 +225,9 @@ func TestFieldPathOpaqueSetterExpr(t *testing.T) { }, } - for name, tc := range testCases { - tc := tc + for name, tc := range tcs { t.Run(name, func(t *testing.T) { - t.Parallel() - - got := tc.fieldPath.OpaqueSetterExpr(tc.msgExpr) - if got != tc.want { + if got := tc.fieldPath.OpaqueSetterExpr(tc.msgExpr); got != tc.want { t.Fatalf("OpaqueSetterExpr(%q) = %q; want %q", tc.msgExpr, got, tc.want) } }) diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go index 420ff2141a3..44099c909a4 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go @@ -86,7 +86,9 @@ func TestApplyTemplateHeader(t *testing.T) { }, }, } - got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) + got, err := applyTemplate(param{ + File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, + }, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -238,7 +240,9 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { }, }, } - got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) + got, err := applyTemplate(param{ + File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, + }, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -255,13 +259,16 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { if want := `protoReq.GetNested().Int32, err = runtime.Int32P(val)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { + if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, + want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, want) { + if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, + want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/example.ExampleService/Echo", runtime.WithHTTPPathPattern("/v1"))`; !strings.Contains(got, want) { + if want := `annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/example.ExampleService/Echo", runtime.WithHTTPPathPattern("/v1"))`; !strings.Contains(got, + want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { @@ -274,9 +281,7 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { } func TestApplyTemplateOpaquePathParams(t *testing.T) { - t.Parallel() - - enumdesc := &descriptorpb.EnumDescriptorProto{ + enumDesc := &descriptorpb.EnumDescriptorProto{ Name: proto.String("Color"), Value: []*descriptorpb.EnumValueDescriptorProto{ { @@ -300,33 +305,27 @@ func TestApplyTemplateOpaquePathParams(t *testing.T) { enumField.Type = descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum() enumField.TypeName = proto.String(".example.Color") - cases := []struct { - name string + tcs := map[string]struct { field *descriptorpb.FieldDescriptorProto enumDesc *descriptorpb.EnumDescriptorProto httpMethod string expect string }{ - { - name: "scalar GET", + "scalar GET": { field: baseField, httpMethod: "GET", expect: "protoReq.SetKind(convertedKind)", }, - { - name: "enum PATCH", + "enum PATCH": { field: enumField, - enumDesc: enumdesc, + enumDesc: enumDesc, httpMethod: "PATCH", expect: "protoReq.SetKind(Color(e))", }, } - for _, tc := range cases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - + for name, tc := range tcs { + t.Run(name, func(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ @@ -571,7 +570,9 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { }, }, } - got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) + got, err := applyTemplate(param{ + File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, + }, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -579,10 +580,12 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { if want := spec.sigWant; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { + if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, + want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, want) { + if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, + want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { @@ -752,7 +755,9 @@ func TestApplyTemplateInProcess(t *testing.T) { }, }, } - got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) + got, err := applyTemplate(param{ + File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, + }, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -764,7 +769,8 @@ func TestApplyTemplateInProcess(t *testing.T) { } } - if want := `func RegisterExampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServiceServer) error {`; !strings.Contains(got, want) { + if want := `func RegisterExampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServiceServer) error {`; !strings.Contains(got, + want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { @@ -828,10 +834,14 @@ func TestAllowPatchFeature(t *testing.T) { Bindings: []*descriptor.Binding{ { HTTPMethod: "PATCH", - Body: &descriptor.Body{FieldPath: descriptor.FieldPath{descriptor.FieldPathComponent{ - Name: "abe", - Target: msg.Fields[0], - }}}, + Body: &descriptor.Body{ + FieldPath: descriptor.FieldPath{ + descriptor.FieldPathComponent{ + Name: "abe", + Target: msg.Fields[0], + }, + }, + }, }, }, }, @@ -841,7 +851,9 @@ func TestAllowPatchFeature(t *testing.T) { } want := "if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {\n" for _, allowPatchFeature := range []bool{true, false} { - got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: allowPatchFeature}, descriptor.NewRegistry()) + got, err := applyTemplate(param{ + File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: allowPatchFeature, + }, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -943,15 +955,19 @@ func TestIdentifierCapitalization(t *testing.T) { }, } - got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) + got, err := applyTemplate(param{ + File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, + }, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } - if want := `msg, err := client.ExampleGe2T(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, want) { + if want := `msg, err := client.ExampleGe2T(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, + want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `msg, err := client.ExamplEPost(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, want) { + if want := `msg, err := client.ExamplEPost(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, + want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `var ( @@ -1042,7 +1058,9 @@ func TestDuplicatePathsInSameService(t *testing.T) { }, }, } - _, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) + _, err := applyTemplate(param{ + File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, + }, descriptor.NewRegistry()) if err == nil { t.Errorf("applyTemplate(%#v) succeeded; want an error", file) return @@ -1127,7 +1145,9 @@ func TestDuplicatePathsInDifferentService(t *testing.T) { }, }, } - _, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) + _, err := applyTemplate(param{ + File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, + }, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed; want success - %s", file, err) return From 957356cbc80bea3a8f98197a5e22e7d02541d88a Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Thu, 8 Jan 2026 13:12:57 -0500 Subject: [PATCH 05/18] refactor(descriptor): simplify opaqueOwnerExpr --- internal/descriptor/types.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/internal/descriptor/types.go b/internal/descriptor/types.go index 3b10fdd3c8b..7c1c14c1ad3 100644 --- a/internal/descriptor/types.go +++ b/internal/descriptor/types.go @@ -461,16 +461,19 @@ func (p FieldPath) OpaqueSetterExpr(msgExpr string) string { // opaqueOwnerExpr builds the Go expression for the message that owns the final // component in the path by chaining the generated getters. func (p FieldPath) opaqueOwnerExpr(msgExpr string) string { - owner := msgExpr if len(p) <= 1 { - return owner + return msgExpr } - for _, component := range p[:len(p)-1] { - owner = fmt.Sprintf("%s.Get%s()", owner, casing.Camel(component.Name)) + var sb strings.Builder + sb.WriteString(msgExpr) + for i := range len(p) - 1 { + sb.WriteString(".Get") + sb.WriteString(casing.Camel(p[i].Name)) + sb.WriteString("()") } - return owner + return sb.String() } // FieldPathComponent is a path component in FieldPath From 6e699908e016ed1924e2e0f7be988ff823e74be7 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Mon, 12 Jan 2026 10:02:41 -0500 Subject: [PATCH 06/18] fix(format): revert accidental ide formatting changes --- internal/descriptor/types.go | 7 +- internal/descriptor/types_test.go | 6 +- .../internal/gengateway/template_test.go | 68 ++++++------------- 3 files changed, 24 insertions(+), 57 deletions(-) diff --git a/internal/descriptor/types.go b/internal/descriptor/types.go index 7c1c14c1ad3..43eb776ea72 100644 --- a/internal/descriptor/types.go +++ b/internal/descriptor/types.go @@ -293,8 +293,7 @@ func (p Parameter) ConvertFuncExpr() (string, error) { conv, ok = wellKnownTypeConv[p.Target.GetTypeName()] } if !ok { - return "", fmt.Errorf("unsupported field type %s of parameter %s in %s.%s", typ, p.FieldPath, - p.Method.Service.GetName(), p.Method.GetName()) + return "", fmt.Errorf("unsupported field type %s of parameter %s in %s.%s", typ, p.FieldPath, p.Method.Service.GetName(), p.Method.GetName()) } return conv, nil } @@ -431,9 +430,7 @@ func (p FieldPath) AssignableExprPrep(msgExpr string, currentPackage string) str return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *%s, but: %%t\n",%s) }` - preparations = append(preparations, - fmt.Sprintf(s, components, components, oneofFieldName, components, oneofFieldName, oneofFieldName, - components)) + preparations = append(preparations, fmt.Sprintf(s, components, components, oneofFieldName, components, oneofFieldName, oneofFieldName, components)) components = components + ".(*" + oneofFieldName + ")" } diff --git a/internal/descriptor/types_test.go b/internal/descriptor/types_test.go index 4bd14dd9d9c..53e07ec5a93 100644 --- a/internal/descriptor/types_test.go +++ b/internal/descriptor/types_test.go @@ -185,8 +185,7 @@ func TestFieldPath(t *testing.T) { Target: nest1.Fields[1], }, } - if got, want := fp.AssignableExpr("resp", - "example"), "resp.GetNestField().Nest2Field.GetNestField().TerminalField"; got != want { + if got, want := fp.AssignableExpr("resp", "example"), "resp.GetNestField().Nest2Field.GetNestField().TerminalField"; got != want { t.Errorf("fp.AssignableExpr(%q) = %q; want %q", "resp", got, want) } @@ -196,8 +195,7 @@ func TestFieldPath(t *testing.T) { Target: nest2.Fields[1], }, } - if got, want := fp2.AssignableExpr("resp", - "example"), "resp.Nest2Field.GetNestField().Nest2Field.TerminalField"; got != want { + if got, want := fp2.AssignableExpr("resp", "example"), "resp.Nest2Field.GetNestField().Nest2Field.TerminalField"; got != want { t.Errorf("fp2.AssignableExpr(%q) = %q; want %q", "resp", got, want) } diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go index 44099c909a4..4dd23de960d 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go @@ -86,9 +86,7 @@ func TestApplyTemplateHeader(t *testing.T) { }, }, } - got, err := applyTemplate(param{ - File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, - }, descriptor.NewRegistry()) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -240,9 +238,7 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { }, }, } - got, err := applyTemplate(param{ - File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, - }, descriptor.NewRegistry()) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -259,16 +255,13 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { if want := `protoReq.GetNested().Int32, err = runtime.Int32P(val)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, - want) { + if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, - want) { + if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/example.ExampleService/Echo", runtime.WithHTTPPathPattern("/v1"))`; !strings.Contains(got, - want) { + if want := `annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/example.ExampleService/Echo", runtime.WithHTTPPathPattern("/v1"))`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { @@ -570,9 +563,7 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { }, }, } - got, err := applyTemplate(param{ - File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, - }, descriptor.NewRegistry()) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -580,12 +571,10 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { if want := spec.sigWant; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, - want) { + if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, - want) { + if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { @@ -755,9 +744,7 @@ func TestApplyTemplateInProcess(t *testing.T) { }, }, } - got, err := applyTemplate(param{ - File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, - }, descriptor.NewRegistry()) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -769,8 +756,7 @@ func TestApplyTemplateInProcess(t *testing.T) { } } - if want := `func RegisterExampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServiceServer) error {`; !strings.Contains(got, - want) { + if want := `func RegisterExampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServiceServer) error {`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { @@ -834,14 +820,10 @@ func TestAllowPatchFeature(t *testing.T) { Bindings: []*descriptor.Binding{ { HTTPMethod: "PATCH", - Body: &descriptor.Body{ - FieldPath: descriptor.FieldPath{ - descriptor.FieldPathComponent{ - Name: "abe", - Target: msg.Fields[0], - }, - }, - }, + Body: &descriptor.Body{FieldPath: descriptor.FieldPath{descriptor.FieldPathComponent{ + Name: "abe", + Target: msg.Fields[0], + }}}, }, }, }, @@ -851,9 +833,7 @@ func TestAllowPatchFeature(t *testing.T) { } want := "if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {\n" for _, allowPatchFeature := range []bool{true, false} { - got, err := applyTemplate(param{ - File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: allowPatchFeature, - }, descriptor.NewRegistry()) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: allowPatchFeature}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -955,19 +935,15 @@ func TestIdentifierCapitalization(t *testing.T) { }, } - got, err := applyTemplate(param{ - File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, - }, descriptor.NewRegistry()) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } - if want := `msg, err := client.ExampleGe2T(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, - want) { + if want := `msg, err := client.ExampleGe2T(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `msg, err := client.ExamplEPost(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, - want) { + if want := `msg, err := client.ExamplEPost(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `var ( @@ -1058,9 +1034,7 @@ func TestDuplicatePathsInSameService(t *testing.T) { }, }, } - _, err := applyTemplate(param{ - File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, - }, descriptor.NewRegistry()) + _, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err == nil { t.Errorf("applyTemplate(%#v) succeeded; want an error", file) return @@ -1145,9 +1119,7 @@ func TestDuplicatePathsInDifferentService(t *testing.T) { }, }, } - _, err := applyTemplate(param{ - File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true, - }, descriptor.NewRegistry()) + _, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed; want success - %s", file, err) return From d5d503cf3416b1e461c750d8c58888d24395107e Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Mon, 12 Jan 2026 10:14:33 -0500 Subject: [PATCH 07/18] refactor(examples): add example of opaque api with nested enum params in the path --- examples/internal/proto/examplepb/opaque.proto | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/examples/internal/proto/examplepb/opaque.proto b/examples/internal/proto/examplepb/opaque.proto index 11e79ff7037..535ef956323 100644 --- a/examples/internal/proto/examplepb/opaque.proto +++ b/examples/internal/proto/examplepb/opaque.proto @@ -69,6 +69,12 @@ service OpaqueEcommerceService { }; option (google.api.method_signature) = "product,update_mask"; } + + // OpaqueSearchOrders - Unary request, unary response + // Uses enum params (both top level and nested) to populate fields to test opaque get chain + rpc OpaqueSearchOrders(OpaqueSearchOrdersRequest) returns (OpaqueSearchOrdersResponse) { + option (google.api.http) = {get: "/v1/orders/search/{order.status}/shipAddressType/{order.shipping_address.address_type}"}; + } } // OpaqueUpdateProductRequest represents a request to update a product @@ -171,6 +177,16 @@ message OpaqueStreamCustomerActivityResponse { OpaqueActivityUpdate event = 2; } +// OpaqueSearchOrdersRequest represents queryable information to find orders +message OpaqueSearchOrdersRequest { + OpaqueOrder order = 1; +} + +// OpaqueSearchOrdersResponse represents a list of orders found +message OpaqueSearchOrdersResponse { + repeated OpaqueOrder orders = 1; +} + // OpaqueAddress represents a physical address message OpaqueAddress { string street_line1 = 1; From ccb5ebd9a924ae138f64951eefed3e3901bbde5b Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Fri, 16 Jan 2026 08:48:38 -0500 Subject: [PATCH 08/18] chore: update Bazel deps, regen swagger, and fix opaque proto format --- .../proto/examplepb/opaque.swagger.json | 392 ++++++++++++++++++ .../internal/gengateway/BUILD.bazel | 1 + 2 files changed, 393 insertions(+) diff --git a/examples/internal/proto/examplepb/opaque.swagger.json b/examples/internal/proto/examplepb/opaque.swagger.json index 8ee44854791..dfacb9cfe88 100644 --- a/examples/internal/proto/examplepb/opaque.swagger.json +++ b/examples/internal/proto/examplepb/opaque.swagger.json @@ -93,6 +93,385 @@ ] } }, + "/v1/orders/search/{order.status}/shipAddressType/{order.shippingAddress.addressType}": { + "get": { + "summary": "OpaqueSearchOrders - Unary request, unary response\nUses enum params (both top level and nested) to populate fields to test opaque get chain", + "operationId": "OpaqueEcommerceService_OpaqueSearchOrders", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbOpaqueSearchOrdersResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googleRpcStatus" + } + } + }, + "parameters": [ + { + "name": "order.status", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "OPAQUE_ORDER_STATUS_UNSPECIFIED", + "OPAQUE_ORDER_STATUS_PENDING", + "OPAQUE_ORDER_STATUS_PROCESSING", + "OPAQUE_ORDER_STATUS_SHIPPED", + "OPAQUE_ORDER_STATUS_DELIVERED", + "OPAQUE_ORDER_STATUS_CANCELLED", + "OPAQUE_ORDER_STATUS_RETURNED" + ] + }, + { + "name": "order.shippingAddress.addressType", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "OPAQUE_ADDRESS_TYPE_UNSPECIFIED", + "OPAQUE_ADDRESS_TYPE_RESIDENTIAL", + "OPAQUE_ADDRESS_TYPE_BUSINESS", + "OPAQUE_ADDRESS_TYPE_SHIPPING", + "OPAQUE_ADDRESS_TYPE_BILLING" + ] + }, + { + "name": "order.orderId", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.customerId", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.subtotal.amount", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "order.subtotal.currencyCode", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.subtotal.isDiscounted", + "in": "query", + "required": false, + "type": "boolean" + }, + { + "name": "order.subtotal.originalAmount", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "order.subtotal.priceValidUntil", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "order.tax.amount", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "order.tax.currencyCode", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.tax.isDiscounted", + "in": "query", + "required": false, + "type": "boolean" + }, + { + "name": "order.tax.originalAmount", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "order.tax.priceValidUntil", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "order.shipping.amount", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "order.shipping.currencyCode", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.shipping.isDiscounted", + "in": "query", + "required": false, + "type": "boolean" + }, + { + "name": "order.shipping.originalAmount", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "order.shipping.priceValidUntil", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "order.total.amount", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "order.total.currencyCode", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.total.isDiscounted", + "in": "query", + "required": false, + "type": "boolean" + }, + { + "name": "order.total.originalAmount", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "order.total.priceValidUntil", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "order.shippingAddress.streetLine1", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.shippingAddress.streetLine2", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.shippingAddress.city", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.shippingAddress.state", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.shippingAddress.country", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.shippingAddress.postalCode", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.shippingAddress.isDefault", + "in": "query", + "required": false, + "type": "boolean" + }, + { + "name": "order.shippingAddress.metadata", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.billingAddress.streetLine1", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.billingAddress.streetLine2", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.billingAddress.city", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.billingAddress.state", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.billingAddress.country", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.billingAddress.postalCode", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.billingAddress.isDefault", + "in": "query", + "required": false, + "type": "boolean" + }, + { + "name": "order.billingAddress.metadata", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.paymentMethodId", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.trackingNumber", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.createdAt", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "order.updatedAt", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "order.shippedAt", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "order.deliveredAt", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "order.shippingInfo.carrier", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.shippingInfo.method", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.shippingInfo.estimatedDeliveryTime", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.shippingInfo.trackingUrls", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "order.metadata", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.couponCode", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "order.promotionId", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "OpaqueEcommerceService" + ] + } + }, "/v1/products": { "post": { "summary": "OpaqueCreateProduct - Unary request with body field, unary response\nCreates a new product with the product details in the body", @@ -1224,6 +1603,19 @@ }, "title": "OpaqueProductVariant represents a specific variant of a product" }, + "examplepbOpaqueSearchOrdersResponse": { + "type": "object", + "properties": { + "orders": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/examplepbOpaqueOrder" + } + } + }, + "title": "OpaqueSearchOrdersResponse represents a list of orders found" + }, "examplepbOpaqueSearchProductsResponse": { "type": "object", "properties": { diff --git a/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel b/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel index a5dc9e80b9e..752a4c02e12 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel @@ -35,6 +35,7 @@ go_test( "//internal/httprule", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//types/descriptorpb", + "@org_golang_google_protobuf//types/pluginpb", ], ) From 39715cbbbd6938338884aafa6a4a6a85c180ee7d Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Tue, 20 Jan 2026 12:33:36 -0500 Subject: [PATCH 09/18] chore: rebase onto latest main and regenerate examples --- .../internal/proto/examplepb/opaque.pb.go | 494 +++++++++++------- .../internal/proto/examplepb/opaque.pb.gw.go | 130 +++++ .../proto/examplepb/opaque_grpc.pb.go | 42 ++ 3 files changed, 489 insertions(+), 177 deletions(-) diff --git a/examples/internal/proto/examplepb/opaque.pb.go b/examples/internal/proto/examplepb/opaque.pb.go index 53a32299dd5..dae9a3c54ae 100644 --- a/examples/internal/proto/examplepb/opaque.pb.go +++ b/examples/internal/proto/examplepb/opaque.pb.go @@ -1945,6 +1945,135 @@ func (b0 OpaqueStreamCustomerActivityResponse_builder) Build() *OpaqueStreamCust return m0 } +// OpaqueSearchOrdersRequest represents queryable information to find orders +type OpaqueSearchOrdersRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Order *OpaqueOrder `protobuf:"bytes,1,opt,name=order"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpaqueSearchOrdersRequest) Reset() { + *x = OpaqueSearchOrdersRequest{} + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpaqueSearchOrdersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpaqueSearchOrdersRequest) ProtoMessage() {} + +func (x *OpaqueSearchOrdersRequest) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *OpaqueSearchOrdersRequest) GetOrder() *OpaqueOrder { + if x != nil { + return x.xxx_hidden_Order + } + return nil +} + +func (x *OpaqueSearchOrdersRequest) SetOrder(v *OpaqueOrder) { + x.xxx_hidden_Order = v +} + +func (x *OpaqueSearchOrdersRequest) HasOrder() bool { + if x == nil { + return false + } + return x.xxx_hidden_Order != nil +} + +func (x *OpaqueSearchOrdersRequest) ClearOrder() { + x.xxx_hidden_Order = nil +} + +type OpaqueSearchOrdersRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Order *OpaqueOrder +} + +func (b0 OpaqueSearchOrdersRequest_builder) Build() *OpaqueSearchOrdersRequest { + m0 := &OpaqueSearchOrdersRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Order = b.Order + return m0 +} + +// OpaqueSearchOrdersResponse represents a list of orders found +type OpaqueSearchOrdersResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Orders *[]*OpaqueOrder `protobuf:"bytes,1,rep,name=orders"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpaqueSearchOrdersResponse) Reset() { + *x = OpaqueSearchOrdersResponse{} + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpaqueSearchOrdersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpaqueSearchOrdersResponse) ProtoMessage() {} + +func (x *OpaqueSearchOrdersResponse) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *OpaqueSearchOrdersResponse) GetOrders() []*OpaqueOrder { + if x != nil { + if x.xxx_hidden_Orders != nil { + return *x.xxx_hidden_Orders + } + } + return nil +} + +func (x *OpaqueSearchOrdersResponse) SetOrders(v []*OpaqueOrder) { + x.xxx_hidden_Orders = &v +} + +type OpaqueSearchOrdersResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Orders []*OpaqueOrder +} + +func (b0 OpaqueSearchOrdersResponse_builder) Build() *OpaqueSearchOrdersResponse { + m0 := &OpaqueSearchOrdersResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Orders = &b.Orders + return m0 +} + // OpaqueAddress represents a physical address type OpaqueAddress struct { state protoimpl.MessageState `protogen:"opaque.v1"` @@ -1965,7 +2094,7 @@ type OpaqueAddress struct { func (x *OpaqueAddress) Reset() { *x = OpaqueAddress{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[14] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1977,7 +2106,7 @@ func (x *OpaqueAddress) String() string { func (*OpaqueAddress) ProtoMessage() {} func (x *OpaqueAddress) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[14] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2276,7 +2405,7 @@ type OpaquePrice struct { func (x *OpaquePrice) Reset() { *x = OpaquePrice{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[15] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2288,7 +2417,7 @@ func (x *OpaquePrice) String() string { func (*OpaquePrice) ProtoMessage() {} func (x *OpaquePrice) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[15] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2467,7 +2596,7 @@ type OpaqueProductCategory struct { func (x *OpaqueProductCategory) Reset() { *x = OpaqueProductCategory{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2479,7 +2608,7 @@ func (x *OpaqueProductCategory) String() string { func (*OpaqueProductCategory) ProtoMessage() {} func (x *OpaqueProductCategory) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2704,7 +2833,7 @@ type OpaqueProductVariant struct { func (x *OpaqueProductVariant) Reset() { *x = OpaqueProductVariant{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2716,7 +2845,7 @@ func (x *OpaqueProductVariant) String() string { func (*OpaqueProductVariant) ProtoMessage() {} func (x *OpaqueProductVariant) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3066,7 +3195,7 @@ func (b0 OpaqueProductVariant_builder) Build() *OpaqueProductVariant { type case_OpaqueProductVariant_DiscountInfo protoreflect.FieldNumber func (x case_OpaqueProductVariant_DiscountInfo) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19].Descriptor() if x == 0 { return "not set" } @@ -3119,7 +3248,7 @@ type OpaqueProduct struct { func (x *OpaqueProduct) Reset() { *x = OpaqueProduct{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3131,7 +3260,7 @@ func (x *OpaqueProduct) String() string { func (*OpaqueProduct) ProtoMessage() {} func (x *OpaqueProduct) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3689,7 +3818,7 @@ func (b0 OpaqueProduct_builder) Build() *OpaqueProduct { type case_OpaqueProduct_TaxInfo protoreflect.FieldNumber func (x case_OpaqueProduct_TaxInfo) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20].Descriptor() if x == 0 { return "not set" } @@ -3735,7 +3864,7 @@ type OpaqueCustomer struct { func (x *OpaqueCustomer) Reset() { *x = OpaqueCustomer{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3747,7 +3876,7 @@ func (x *OpaqueCustomer) String() string { func (*OpaqueCustomer) ProtoMessage() {} func (x *OpaqueCustomer) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4096,7 +4225,7 @@ type OpaqueOrderItem struct { func (x *OpaqueOrderItem) Reset() { *x = OpaqueOrderItem{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4108,7 +4237,7 @@ func (x *OpaqueOrderItem) String() string { func (*OpaqueOrderItem) ProtoMessage() {} func (x *OpaqueOrderItem) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4403,7 +4532,7 @@ type OpaqueOrder struct { func (x *OpaqueOrder) Reset() { *x = OpaqueOrder{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4415,7 +4544,7 @@ func (x *OpaqueOrder) String() string { func (*OpaqueOrder) ProtoMessage() {} func (x *OpaqueOrder) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4985,7 +5114,7 @@ func (b0 OpaqueOrder_builder) Build() *OpaqueOrder { type case_OpaqueOrder_DiscountApplied protoreflect.FieldNumber func (x case_OpaqueOrder_DiscountApplied) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23].Descriptor() if x == 0 { return "not set" } @@ -5027,7 +5156,7 @@ type OpaqueOrderSummary struct { func (x *OpaqueOrderSummary) Reset() { *x = OpaqueOrderSummary{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5039,7 +5168,7 @@ func (x *OpaqueOrderSummary) String() string { func (*OpaqueOrderSummary) ProtoMessage() {} func (x *OpaqueOrderSummary) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5262,7 +5391,7 @@ type OpaqueCustomerEvent struct { func (x *OpaqueCustomerEvent) Reset() { *x = OpaqueCustomerEvent{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5274,7 +5403,7 @@ func (x *OpaqueCustomerEvent) String() string { func (*OpaqueCustomerEvent) ProtoMessage() {} func (x *OpaqueCustomerEvent) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5707,7 +5836,7 @@ type OpaqueActivityUpdate struct { func (x *OpaqueActivityUpdate) Reset() { *x = OpaqueActivityUpdate{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5719,7 +5848,7 @@ func (x *OpaqueActivityUpdate) String() string { func (*OpaqueActivityUpdate) ProtoMessage() {} func (x *OpaqueActivityUpdate) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6182,7 +6311,7 @@ func (b0 OpaqueActivityUpdate_builder) Build() *OpaqueActivityUpdate { type case_OpaqueActivityUpdate_ActionData protoreflect.FieldNumber func (x case_OpaqueActivityUpdate_ActionData) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26].Descriptor() if x == 0 { return "not set" } @@ -6220,7 +6349,7 @@ type OpaqueProduct_OpaqueProductDimensions struct { func (x *OpaqueProduct_OpaqueProductDimensions) Reset() { *x = OpaqueProduct_OpaqueProductDimensions{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[30] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6232,7 +6361,7 @@ func (x *OpaqueProduct_OpaqueProductDimensions) String() string { func (*OpaqueProduct_OpaqueProductDimensions) ProtoMessage() {} func (x *OpaqueProduct_OpaqueProductDimensions) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[30] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[32] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6416,7 +6545,7 @@ type OpaqueCustomer_OpaqueLoyaltyInfo struct { func (x *OpaqueCustomer_OpaqueLoyaltyInfo) Reset() { *x = OpaqueCustomer_OpaqueLoyaltyInfo{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[31] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6428,7 +6557,7 @@ func (x *OpaqueCustomer_OpaqueLoyaltyInfo) String() string { func (*OpaqueCustomer_OpaqueLoyaltyInfo) ProtoMessage() {} func (x *OpaqueCustomer_OpaqueLoyaltyInfo) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[31] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[33] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6565,7 +6694,7 @@ type OpaqueCustomer_OpaquePaymentMethod struct { func (x *OpaqueCustomer_OpaquePaymentMethod) Reset() { *x = OpaqueCustomer_OpaquePaymentMethod{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[33] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6577,7 +6706,7 @@ func (x *OpaqueCustomer_OpaquePaymentMethod) String() string { func (*OpaqueCustomer_OpaquePaymentMethod) ProtoMessage() {} func (x *OpaqueCustomer_OpaquePaymentMethod) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[33] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6795,7 +6924,7 @@ type OpaqueOrder_OpaqueShippingInfo struct { func (x *OpaqueOrder_OpaqueShippingInfo) Reset() { *x = OpaqueOrder_OpaqueShippingInfo{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6807,7 +6936,7 @@ func (x *OpaqueOrder_OpaqueShippingInfo) String() string { func (*OpaqueOrder_OpaqueShippingInfo) ProtoMessage() {} func (x *OpaqueOrder_OpaqueShippingInfo) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[37] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6944,7 +7073,7 @@ type OpaqueOrderSummary_OpaqueOrderError struct { func (x *OpaqueOrderSummary_OpaqueOrderError) Reset() { *x = OpaqueOrderSummary_OpaqueOrderError{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[38] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6956,7 +7085,7 @@ func (x *OpaqueOrderSummary_OpaqueOrderError) String() string { func (*OpaqueOrderSummary_OpaqueOrderError) ProtoMessage() {} func (x *OpaqueOrderSummary_OpaqueOrderError) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[38] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[40] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7143,7 +7272,11 @@ const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "#OpaqueStreamCustomerActivityRequest\x12Y\n" + "\x05event\x18\x01 \x01(\v2C.grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEventR\x05event\"\x82\x01\n" + "$OpaqueStreamCustomerActivityResponse\x12Z\n" + - "\x05event\x18\x02 \x01(\v2D.grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdateR\x05event\"\xd4\x05\n" + + "\x05event\x18\x02 \x01(\v2D.grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdateR\x05event\"n\n" + + "\x19OpaqueSearchOrdersRequest\x12Q\n" + + "\x05order\x18\x01 \x01(\v2;.grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderR\x05order\"q\n" + + "\x1aOpaqueSearchOrdersResponse\x12S\n" + + "\x06orders\x18\x01 \x03(\v2;.grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderR\x06orders\"\xd4\x05\n" + "\rOpaqueAddress\x12!\n" + "\fstreet_line1\x18\x01 \x01(\tR\vstreetLine1\x12!\n" + "\fstreet_line2\x18\x02 \x01(\tR\vstreetLine2\x12\x12\n" + @@ -7452,7 +7585,7 @@ const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "#OPAQUE_UPDATE_TYPE_INVENTORY_UPDATE\x10\x04\x12#\n" + "\x1fOPAQUE_UPDATE_TYPE_PRICE_CHANGE\x10\x05\x12$\n" + " OPAQUE_UPDATE_TYPE_CART_REMINDER\x10\x06B\r\n" + - "\vaction_data2\xa3\f\n" + + "\vaction_data2\xb1\x0e\n" + "\x16OpaqueEcommerceService\x12\xc8\x01\n" + "\x10OpaqueGetProduct\x12G.grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductRequest\x1aH.grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse\"!\x82\xd3\xe4\x93\x02\x1b\x12\x19/v1/products/{product_id}\x12\xd0\x01\n" + "\x14OpaqueSearchProducts\x12K.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest\x1aL.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/v1/products/search0\x01\x12\xc7\x01\n" + @@ -7460,10 +7593,11 @@ const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "\x18OpaqueCreateProductField\x12O.grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest\x1aP.grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse\"\"\x82\xd3\xe4\x93\x02\x1c:\aproduct\"\x11/v1/productsField\x12\xcf\x01\n" + "\x13OpaqueProcessOrders\x12J.grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest\x1aK.grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/v1/orders/process(\x01\x12\xef\x01\n" + "\x1cOpaqueStreamCustomerActivity\x12S.grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest\x1aT.grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/v1/customer/activity(\x010\x01\x12\xf8\x01\n" + - "\x13OpaqueUpdateProduct\x12J.grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest\x1aK.grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse\"H\xdaA\x13product,update_mask\x82\xd3\xe4\x93\x02,:\aproduct2!/v1/products/{product.product_id}BMZKgithub.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepbb\beditionsp\xe8\a" + "\x13OpaqueUpdateProduct\x12J.grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest\x1aK.grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse\"H\xdaA\x13product,update_mask\x82\xd3\xe4\x93\x02,:\aproduct2!/v1/products/{product.product_id}\x12\x8b\x02\n" + + "\x12OpaqueSearchOrders\x12I.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest\x1aJ.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse\"^\x82\xd3\xe4\x93\x02X\x12V/v1/orders/search/{order.status}/shipAddressType/{order.shipping_address.address_type}BMZKgithub.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepbb\beditionsp\xe8\a" var file_examples_internal_proto_examplepb_opaque_proto_enumTypes = make([]protoimpl.EnumInfo, 8) -var file_examples_internal_proto_examplepb_opaque_proto_msgTypes = make([]protoimpl.MessageInfo, 41) +var file_examples_internal_proto_examplepb_opaque_proto_msgTypes = make([]protoimpl.MessageInfo, 43) var file_examples_internal_proto_examplepb_opaque_proto_goTypes = []any{ (OpaqueSearchProductsRequest_OpaqueSortOrder)(0), // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.OpaqueSortOrder (OpaqueAddress_OpaqueAddressType)(0), // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.OpaqueAddressType @@ -7487,141 +7621,147 @@ var file_examples_internal_proto_examplepb_opaque_proto_goTypes = []any{ (*OpaqueProcessOrdersResponse)(nil), // 19: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse (*OpaqueStreamCustomerActivityRequest)(nil), // 20: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest (*OpaqueStreamCustomerActivityResponse)(nil), // 21: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse - (*OpaqueAddress)(nil), // 22: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - (*OpaquePrice)(nil), // 23: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - (*OpaqueProductCategory)(nil), // 24: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory - (*OpaqueProductVariant)(nil), // 25: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant - (*OpaqueProduct)(nil), // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - (*OpaqueCustomer)(nil), // 27: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer - (*OpaqueOrderItem)(nil), // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem - (*OpaqueOrder)(nil), // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder - (*OpaqueOrderSummary)(nil), // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary - (*OpaqueCustomerEvent)(nil), // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent - (*OpaqueActivityUpdate)(nil), // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate - nil, // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry - nil, // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry - nil, // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry - nil, // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry - nil, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry - (*OpaqueProduct_OpaqueProductDimensions)(nil), // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions - (*OpaqueCustomer_OpaqueLoyaltyInfo)(nil), // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo - nil, // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry - (*OpaqueCustomer_OpaquePaymentMethod)(nil), // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod - nil, // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry - (*OpaqueOrder_OpaqueShippingInfo)(nil), // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo - nil, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry - nil, // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry - (*OpaqueOrderSummary_OpaqueOrderError)(nil), // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError - nil, // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry - nil, // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry - (*fieldmaskpb.FieldMask)(nil), // 49: google.protobuf.FieldMask - (*wrapperspb.BoolValue)(nil), // 50: google.protobuf.BoolValue - (*wrapperspb.DoubleValue)(nil), // 51: google.protobuf.DoubleValue - (*timestamppb.Timestamp)(nil), // 52: google.protobuf.Timestamp - (*durationpb.Duration)(nil), // 53: google.protobuf.Duration + (*OpaqueSearchOrdersRequest)(nil), // 22: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest + (*OpaqueSearchOrdersResponse)(nil), // 23: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse + (*OpaqueAddress)(nil), // 24: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + (*OpaquePrice)(nil), // 25: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + (*OpaqueProductCategory)(nil), // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory + (*OpaqueProductVariant)(nil), // 27: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant + (*OpaqueProduct)(nil), // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + (*OpaqueCustomer)(nil), // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer + (*OpaqueOrderItem)(nil), // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem + (*OpaqueOrder)(nil), // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + (*OpaqueOrderSummary)(nil), // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary + (*OpaqueCustomerEvent)(nil), // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent + (*OpaqueActivityUpdate)(nil), // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate + nil, // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry + nil, // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry + nil, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry + nil, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry + nil, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry + (*OpaqueProduct_OpaqueProductDimensions)(nil), // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions + (*OpaqueCustomer_OpaqueLoyaltyInfo)(nil), // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo + nil, // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry + (*OpaqueCustomer_OpaquePaymentMethod)(nil), // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod + nil, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry + (*OpaqueOrder_OpaqueShippingInfo)(nil), // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo + nil, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry + nil, // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry + (*OpaqueOrderSummary_OpaqueOrderError)(nil), // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError + nil, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry + nil, // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry + (*fieldmaskpb.FieldMask)(nil), // 51: google.protobuf.FieldMask + (*wrapperspb.BoolValue)(nil), // 52: google.protobuf.BoolValue + (*wrapperspb.DoubleValue)(nil), // 53: google.protobuf.DoubleValue + (*timestamppb.Timestamp)(nil), // 54: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 55: google.protobuf.Duration } var file_examples_internal_proto_examplepb_opaque_proto_depIdxs = []int32{ - 26, // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 49, // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.update_mask:type_name -> google.protobuf.FieldMask - 26, // 2: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 26, // 3: grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 23, // 4: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.min_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 23, // 5: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.max_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 28, // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 51, // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.update_mask:type_name -> google.protobuf.FieldMask + 28, // 2: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 28, // 3: grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 25, // 4: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.min_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 25, // 5: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.max_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice 0, // 6: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.sort_by:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.OpaqueSortOrder - 49, // 7: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.field_mask:type_name -> google.protobuf.FieldMask - 33, // 8: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.filters:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry - 26, // 9: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 26, // 10: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 26, // 11: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 26, // 12: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 26, // 13: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 29, // 14: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder - 30, // 15: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse.summary:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary - 31, // 16: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent - 32, // 17: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate - 1, // 18: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.address_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.OpaqueAddressType - 50, // 19: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.is_default:type_name -> google.protobuf.BoolValue - 34, // 20: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry - 51, // 21: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.original_amount:type_name -> google.protobuf.DoubleValue - 52, // 22: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.price_valid_until:type_name -> google.protobuf.Timestamp - 24, // 23: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.parent_category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory - 52, // 24: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.created_at:type_name -> google.protobuf.Timestamp - 52, // 25: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.updated_at:type_name -> google.protobuf.Timestamp - 23, // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 35, // 27: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry - 50, // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.is_available:type_name -> google.protobuf.BoolValue - 23, // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.base_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 24, // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory - 25, // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.variants:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant - 50, // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.is_featured:type_name -> google.protobuf.BoolValue - 52, // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.created_at:type_name -> google.protobuf.Timestamp - 52, // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.updated_at:type_name -> google.protobuf.Timestamp - 53, // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.average_shipping_time:type_name -> google.protobuf.Duration - 2, // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductStatus - 36, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry - 37, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.regional_prices:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry - 38, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.dimensions:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions - 22, // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.addresses:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - 52, // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.created_at:type_name -> google.protobuf.Timestamp - 52, // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.last_login:type_name -> google.protobuf.Timestamp - 4, // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueCustomerStatus - 39, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.loyalty_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo - 40, // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.preferences:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry - 41, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.payment_methods:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod - 23, // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.unit_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 23, // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.total_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 42, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.selected_attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry - 50, // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.gift_wrapped:type_name -> google.protobuf.BoolValue - 28, // 51: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.items:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem - 23, // 52: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.subtotal:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 23, // 53: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.tax:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 23, // 54: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 23, // 55: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.total:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 22, // 56: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - 22, // 57: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.billing_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - 5, // 58: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueOrderStatus - 52, // 59: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.created_at:type_name -> google.protobuf.Timestamp - 52, // 60: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.updated_at:type_name -> google.protobuf.Timestamp - 52, // 61: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipped_at:type_name -> google.protobuf.Timestamp - 52, // 62: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.delivered_at:type_name -> google.protobuf.Timestamp - 43, // 63: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo - 44, // 64: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry - 23, // 65: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.total_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 45, // 66: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.error_details:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry - 52, // 67: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.processing_time:type_name -> google.protobuf.Timestamp - 46, // 68: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.errors:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError - 6, // 69: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.OpaqueEventType - 52, // 70: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.timestamp:type_name -> google.protobuf.Timestamp - 47, // 71: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry - 7, // 72: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.OpaqueUpdateType - 52, // 73: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.timestamp:type_name -> google.protobuf.Timestamp - 23, // 74: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.price_update:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 53, // 75: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.offer_expiry:type_name -> google.protobuf.Duration - 48, // 76: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry - 23, // 77: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry.value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 3, // 78: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.unit:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.OpaqueUnit - 52, // 79: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo.tier_expiry:type_name -> google.protobuf.Timestamp - 52, // 80: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod.expires_at:type_name -> google.protobuf.Timestamp - 53, // 81: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo.estimated_delivery_time:type_name -> google.protobuf.Duration - 10, // 82: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductRequest - 12, // 83: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest - 14, // 84: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest - 16, // 85: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest - 18, // 86: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest - 20, // 87: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest - 8, // 88: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest - 11, // 89: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse - 13, // 90: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse - 15, // 91: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse - 17, // 92: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse - 19, // 93: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse - 21, // 94: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse - 9, // 95: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse - 89, // [89:96] is the sub-list for method output_type - 82, // [82:89] is the sub-list for method input_type - 82, // [82:82] is the sub-list for extension type_name - 82, // [82:82] is the sub-list for extension extendee - 0, // [0:82] is the sub-list for field type_name + 51, // 7: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.field_mask:type_name -> google.protobuf.FieldMask + 35, // 8: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.filters:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry + 28, // 9: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 28, // 10: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 28, // 11: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 28, // 12: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 28, // 13: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 31, // 14: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + 32, // 15: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse.summary:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary + 33, // 16: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent + 34, // 17: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate + 31, // 18: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + 31, // 19: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse.orders:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + 1, // 20: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.address_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.OpaqueAddressType + 52, // 21: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.is_default:type_name -> google.protobuf.BoolValue + 36, // 22: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry + 53, // 23: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.original_amount:type_name -> google.protobuf.DoubleValue + 54, // 24: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.price_valid_until:type_name -> google.protobuf.Timestamp + 26, // 25: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.parent_category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory + 54, // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.created_at:type_name -> google.protobuf.Timestamp + 54, // 27: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.updated_at:type_name -> google.protobuf.Timestamp + 25, // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 37, // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry + 52, // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.is_available:type_name -> google.protobuf.BoolValue + 25, // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.base_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 26, // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory + 27, // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.variants:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant + 52, // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.is_featured:type_name -> google.protobuf.BoolValue + 54, // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.created_at:type_name -> google.protobuf.Timestamp + 54, // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.updated_at:type_name -> google.protobuf.Timestamp + 55, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.average_shipping_time:type_name -> google.protobuf.Duration + 2, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductStatus + 38, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry + 39, // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.regional_prices:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry + 40, // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.dimensions:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions + 24, // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.addresses:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + 54, // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.created_at:type_name -> google.protobuf.Timestamp + 54, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.last_login:type_name -> google.protobuf.Timestamp + 4, // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueCustomerStatus + 41, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.loyalty_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo + 42, // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.preferences:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry + 43, // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.payment_methods:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod + 25, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.unit_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 25, // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.total_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 44, // 51: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.selected_attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry + 52, // 52: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.gift_wrapped:type_name -> google.protobuf.BoolValue + 30, // 53: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.items:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem + 25, // 54: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.subtotal:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 25, // 55: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.tax:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 25, // 56: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 25, // 57: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.total:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 24, // 58: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + 24, // 59: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.billing_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + 5, // 60: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueOrderStatus + 54, // 61: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.created_at:type_name -> google.protobuf.Timestamp + 54, // 62: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.updated_at:type_name -> google.protobuf.Timestamp + 54, // 63: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipped_at:type_name -> google.protobuf.Timestamp + 54, // 64: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.delivered_at:type_name -> google.protobuf.Timestamp + 45, // 65: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo + 46, // 66: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry + 25, // 67: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.total_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 47, // 68: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.error_details:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry + 54, // 69: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.processing_time:type_name -> google.protobuf.Timestamp + 48, // 70: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.errors:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError + 6, // 71: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.OpaqueEventType + 54, // 72: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.timestamp:type_name -> google.protobuf.Timestamp + 49, // 73: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry + 7, // 74: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.OpaqueUpdateType + 54, // 75: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.timestamp:type_name -> google.protobuf.Timestamp + 25, // 76: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.price_update:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 55, // 77: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.offer_expiry:type_name -> google.protobuf.Duration + 50, // 78: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry + 25, // 79: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry.value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 3, // 80: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.unit:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.OpaqueUnit + 54, // 81: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo.tier_expiry:type_name -> google.protobuf.Timestamp + 54, // 82: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod.expires_at:type_name -> google.protobuf.Timestamp + 55, // 83: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo.estimated_delivery_time:type_name -> google.protobuf.Duration + 10, // 84: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductRequest + 12, // 85: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest + 14, // 86: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest + 16, // 87: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest + 18, // 88: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest + 20, // 89: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest + 8, // 90: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest + 22, // 91: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest + 11, // 92: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse + 13, // 93: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse + 15, // 94: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse + 17, // 95: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse + 19, // 96: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse + 21, // 97: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse + 9, // 98: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse + 23, // 99: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse + 92, // [92:100] is the sub-list for method output_type + 84, // [84:92] is the sub-list for method input_type + 84, // [84:84] is the sub-list for extension type_name + 84, // [84:84] is the sub-list for extension extendee + 0, // [0:84] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_opaque_proto_init() } @@ -7629,19 +7769,19 @@ func file_examples_internal_proto_examplepb_opaque_proto_init() { if File_examples_internal_proto_examplepb_opaque_proto != nil { return } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19].OneofWrappers = []any{ (*opaqueProductVariant_PercentageOff)(nil), (*opaqueProductVariant_FixedAmountOff)(nil), } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20].OneofWrappers = []any{ (*opaqueProduct_TaxPercentage)(nil), (*opaqueProduct_TaxExempt)(nil), } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23].OneofWrappers = []any{ (*opaqueOrder_CouponCode)(nil), (*opaqueOrder_PromotionId)(nil), } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26].OneofWrappers = []any{ (*opaqueActivityUpdate_RedirectUrl)(nil), (*opaqueActivityUpdate_NotificationId)(nil), } @@ -7651,7 +7791,7 @@ func file_examples_internal_proto_examplepb_opaque_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_examples_internal_proto_examplepb_opaque_proto_rawDesc), len(file_examples_internal_proto_examplepb_opaque_proto_rawDesc)), NumEnums: 8, - NumMessages: 41, + NumMessages: 43, NumExtensions: 0, NumServices: 1, }, diff --git a/examples/internal/proto/examplepb/opaque.pb.gw.go b/examples/internal/proto/examplepb/opaque.pb.gw.go index 46d61ca6357..046989e905c 100644 --- a/examples/internal/proto/examplepb/opaque.pb.gw.go +++ b/examples/internal/proto/examplepb/opaque.pb.gw.go @@ -363,6 +363,97 @@ func local_request_OpaqueEcommerceService_OpaqueUpdateProduct_0(ctx context.Cont return msg, metadata, err } +var filter_OpaqueEcommerceService_OpaqueSearchOrders_0 = &utilities.DoubleArray{Encoding: map[string]int{"order": 0, "status": 1, "shipping_address": 2, "address_type": 3}, Base: []int{1, 1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 2, 2, 4, 3, 5}} + +func request_OpaqueEcommerceService_OpaqueSearchOrders_0(ctx context.Context, marshaler runtime.Marshaler, client OpaqueEcommerceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq OpaqueSearchOrdersRequest + metadata runtime.ServerMetadata + e int32 + err error + ) + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + val, ok := pathParams["order.status"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "order.status") + } + err = runtime.PopulateFieldFromPath(&protoReq, "order.status", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "order.status", err) + } + e, err = runtime.Enum(val, OpaqueOrder_OpaqueOrderStatus_value) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "could not parse path as enum value, parameter: %s, error: %v", "order.status", err) + } + protoReq.GetOrder().SetStatus(OpaqueOrder_OpaqueOrderStatus(e)) + val, ok = pathParams["order.shipping_address.address_type"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "order.shipping_address.address_type") + } + err = runtime.PopulateFieldFromPath(&protoReq, "order.shipping_address.address_type", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "order.shipping_address.address_type", err) + } + e, err = runtime.Enum(val, OpaqueAddress_OpaqueAddressType_value) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "could not parse path as enum value, parameter: %s, error: %v", "order.shipping_address.address_type", err) + } + protoReq.GetOrder().GetShippingAddress().SetAddressType(OpaqueAddress_OpaqueAddressType(e)) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_OpaqueEcommerceService_OpaqueSearchOrders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.OpaqueSearchOrders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_OpaqueEcommerceService_OpaqueSearchOrders_0(ctx context.Context, marshaler runtime.Marshaler, server OpaqueEcommerceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq OpaqueSearchOrdersRequest + metadata runtime.ServerMetadata + e int32 + err error + ) + val, ok := pathParams["order.status"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "order.status") + } + err = runtime.PopulateFieldFromPath(&protoReq, "order.status", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "order.status", err) + } + e, err = runtime.Enum(val, OpaqueOrder_OpaqueOrderStatus_value) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "could not parse path as enum value, parameter: %s, error: %v", "order.status", err) + } + protoReq.GetOrder().SetStatus(OpaqueOrder_OpaqueOrderStatus(e)) + val, ok = pathParams["order.shipping_address.address_type"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "order.shipping_address.address_type") + } + err = runtime.PopulateFieldFromPath(&protoReq, "order.shipping_address.address_type", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "order.shipping_address.address_type", err) + } + e, err = runtime.Enum(val, OpaqueAddress_OpaqueAddressType_value) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "could not parse path as enum value, parameter: %s, error: %v", "order.shipping_address.address_type", err) + } + protoReq.GetOrder().GetShippingAddress().SetAddressType(OpaqueAddress_OpaqueAddressType(e)) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_OpaqueEcommerceService_OpaqueSearchOrders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.OpaqueSearchOrders(ctx, &protoReq) + return msg, metadata, err +} + // RegisterOpaqueEcommerceServiceHandlerServer registers the http handlers for service OpaqueEcommerceService to "mux". // UnaryRPC :call OpaqueEcommerceServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -470,6 +561,26 @@ func RegisterOpaqueEcommerceServiceHandlerServer(ctx context.Context, mux *runti } forward_OpaqueEcommerceService_OpaqueUpdateProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodGet, pattern_OpaqueEcommerceService_OpaqueSearchOrders_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) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueSearchOrders", runtime.WithHTTPPathPattern("/v1/orders/search/{order.status}/shipAddressType/{order.shipping_address.address_type}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_OpaqueEcommerceService_OpaqueSearchOrders_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_OpaqueEcommerceService_OpaqueSearchOrders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -629,6 +740,23 @@ func RegisterOpaqueEcommerceServiceHandlerClient(ctx context.Context, mux *runti } forward_OpaqueEcommerceService_OpaqueUpdateProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodGet, pattern_OpaqueEcommerceService_OpaqueSearchOrders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueSearchOrders", runtime.WithHTTPPathPattern("/v1/orders/search/{order.status}/shipAddressType/{order.shipping_address.address_type}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_OpaqueEcommerceService_OpaqueSearchOrders_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_OpaqueEcommerceService_OpaqueSearchOrders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -640,6 +768,7 @@ var ( pattern_OpaqueEcommerceService_OpaqueProcessOrders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "orders", "process"}, "")) pattern_OpaqueEcommerceService_OpaqueStreamCustomerActivity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "customer", "activity"}, "")) pattern_OpaqueEcommerceService_OpaqueUpdateProduct_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "products", "product.product_id"}, "")) + pattern_OpaqueEcommerceService_OpaqueSearchOrders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "orders", "search", "order.status", "shipAddressType", "order.shipping_address.address_type"}, "")) ) var ( @@ -650,4 +779,5 @@ var ( forward_OpaqueEcommerceService_OpaqueProcessOrders_0 = runtime.ForwardResponseMessage forward_OpaqueEcommerceService_OpaqueStreamCustomerActivity_0 = runtime.ForwardResponseStream forward_OpaqueEcommerceService_OpaqueUpdateProduct_0 = runtime.ForwardResponseMessage + forward_OpaqueEcommerceService_OpaqueSearchOrders_0 = runtime.ForwardResponseMessage ) diff --git a/examples/internal/proto/examplepb/opaque_grpc.pb.go b/examples/internal/proto/examplepb/opaque_grpc.pb.go index c6ebb39b3da..397d83e1cbc 100644 --- a/examples/internal/proto/examplepb/opaque_grpc.pb.go +++ b/examples/internal/proto/examplepb/opaque_grpc.pb.go @@ -26,6 +26,7 @@ const ( OpaqueEcommerceService_OpaqueProcessOrders_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueProcessOrders" OpaqueEcommerceService_OpaqueStreamCustomerActivity_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueStreamCustomerActivity" OpaqueEcommerceService_OpaqueUpdateProduct_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueUpdateProduct" + OpaqueEcommerceService_OpaqueSearchOrders_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueSearchOrders" ) // OpaqueEcommerceServiceClient is the client API for OpaqueEcommerceService service. @@ -54,6 +55,9 @@ type OpaqueEcommerceServiceClient interface { // OpaqueUpdateProduct - PATCH request with FieldMask and body field mapping // to reproduce the compilation issue with bodyData as a value type. OpaqueUpdateProduct(ctx context.Context, in *OpaqueUpdateProductRequest, opts ...grpc.CallOption) (*OpaqueUpdateProductResponse, error) + // OpaqueSearchOrders - Unary request, unary response + // Uses enum params (both top level and nested) to populate fields to test opaque get chain + OpaqueSearchOrders(ctx context.Context, in *OpaqueSearchOrdersRequest, opts ...grpc.CallOption) (*OpaqueSearchOrdersResponse, error) } type opaqueEcommerceServiceClient struct { @@ -149,6 +153,16 @@ func (c *opaqueEcommerceServiceClient) OpaqueUpdateProduct(ctx context.Context, return out, nil } +func (c *opaqueEcommerceServiceClient) OpaqueSearchOrders(ctx context.Context, in *OpaqueSearchOrdersRequest, opts ...grpc.CallOption) (*OpaqueSearchOrdersResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(OpaqueSearchOrdersResponse) + err := c.cc.Invoke(ctx, OpaqueEcommerceService_OpaqueSearchOrders_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // OpaqueEcommerceServiceServer is the server API for OpaqueEcommerceService service. // All implementations should embed UnimplementedOpaqueEcommerceServiceServer // for forward compatibility. @@ -175,6 +189,9 @@ type OpaqueEcommerceServiceServer interface { // OpaqueUpdateProduct - PATCH request with FieldMask and body field mapping // to reproduce the compilation issue with bodyData as a value type. OpaqueUpdateProduct(context.Context, *OpaqueUpdateProductRequest) (*OpaqueUpdateProductResponse, error) + // OpaqueSearchOrders - Unary request, unary response + // Uses enum params (both top level and nested) to populate fields to test opaque get chain + OpaqueSearchOrders(context.Context, *OpaqueSearchOrdersRequest) (*OpaqueSearchOrdersResponse, error) } // UnimplementedOpaqueEcommerceServiceServer should be embedded to have @@ -205,6 +222,9 @@ func (UnimplementedOpaqueEcommerceServiceServer) OpaqueStreamCustomerActivity(gr func (UnimplementedOpaqueEcommerceServiceServer) OpaqueUpdateProduct(context.Context, *OpaqueUpdateProductRequest) (*OpaqueUpdateProductResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OpaqueUpdateProduct not implemented") } +func (UnimplementedOpaqueEcommerceServiceServer) OpaqueSearchOrders(context.Context, *OpaqueSearchOrdersRequest) (*OpaqueSearchOrdersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpaqueSearchOrders not implemented") +} func (UnimplementedOpaqueEcommerceServiceServer) testEmbeddedByValue() {} // UnsafeOpaqueEcommerceServiceServer may be embedded to opt out of forward compatibility for this service. @@ -322,6 +342,24 @@ func _OpaqueEcommerceService_OpaqueUpdateProduct_Handler(srv interface{}, ctx co return interceptor(ctx, in, info, handler) } +func _OpaqueEcommerceService_OpaqueSearchOrders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpaqueSearchOrdersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OpaqueEcommerceServiceServer).OpaqueSearchOrders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OpaqueEcommerceService_OpaqueSearchOrders_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OpaqueEcommerceServiceServer).OpaqueSearchOrders(ctx, req.(*OpaqueSearchOrdersRequest)) + } + return interceptor(ctx, in, info, handler) +} + // OpaqueEcommerceService_ServiceDesc is the grpc.ServiceDesc for OpaqueEcommerceService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -345,6 +383,10 @@ var OpaqueEcommerceService_ServiceDesc = grpc.ServiceDesc{ MethodName: "OpaqueUpdateProduct", Handler: _OpaqueEcommerceService_OpaqueUpdateProduct_Handler, }, + { + MethodName: "OpaqueSearchOrders", + Handler: _OpaqueEcommerceService_OpaqueSearchOrders_Handler, + }, }, Streams: []grpc.StreamDesc{ { From 76d7d8f74d10a371578eb16aee6722fd160ea597 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Mon, 26 Jan 2026 13:48:25 -0500 Subject: [PATCH 10/18] feat(generator): harden opaque imports and casing [WHY] Opaque handlers were missing imports for nested body types and snake_case messages/enums produced invalid Go identifiers, causing broken builds when `--use_opaque_api` was enabled. [WHAT] Camel-case message/enum GoType helpers, register body-field packages during generation, and add example protos under `examples/internal/proto/examplepb` (opaque import + snake-case service/RPC names) and `examples/internal/proto/sub` (snake-case type) so `go test ./...` guards the regressions without extra generator-only tests. [HOW] Relocated the opaque example, regenerated it against the opaque API, extended the gateway generator to track external body packages, and leaned on the compiled examples instead of bespoke generator tests. [TEST] go test ./... [RISK] Low; scoped to generators/examples. Fixes #6276, #6277 --- Makefile | 3 + buf.yaml | 18 + examples/internal/proto/examplepb/BUILD.bazel | 3 + .../proto/examplepb/camel_case_service.pb.go | 336 ++++++++++++++++++ .../examplepb/camel_case_service.pb.gw.go | 240 +++++++++++++ .../proto/examplepb/camel_case_service.proto | 42 +++ .../examplepb/camel_case_service.swagger.json | 158 ++++++++ .../examplepb/camel_case_service_grpc.pb.go | 165 +++++++++ .../examplepb/opaque_body_import.buf.gen.yaml | 17 + .../proto/examplepb/opaque_body_import.pb.go | 213 +++++++++++ .../examplepb/opaque_body_import.pb.gw.go | 162 +++++++++ .../proto/examplepb/opaque_body_import.proto | 28 ++ .../examplepb/opaque_body_import.swagger.json | 108 ++++++ .../examplepb/opaque_body_import_grpc.pb.go | 127 +++++++ examples/internal/proto/sub/BUILD.bazel | 5 +- .../proto/sub/camel_case_message.pb.go | 199 +++++++++++ .../proto/sub/camel_case_message.proto | 17 + .../proto/sub/camel_case_message.swagger.json | 44 +++ internal/descriptor/types.go | 22 +- internal/descriptor/types_test.go | 31 +- .../internal/gengateway/generator.go | 39 ++ 21 files changed, 1964 insertions(+), 13 deletions(-) create mode 100644 examples/internal/proto/examplepb/camel_case_service.pb.go create mode 100644 examples/internal/proto/examplepb/camel_case_service.pb.gw.go create mode 100644 examples/internal/proto/examplepb/camel_case_service.proto create mode 100644 examples/internal/proto/examplepb/camel_case_service.swagger.json create mode 100644 examples/internal/proto/examplepb/camel_case_service_grpc.pb.go create mode 100644 examples/internal/proto/examplepb/opaque_body_import.buf.gen.yaml create mode 100644 examples/internal/proto/examplepb/opaque_body_import.pb.go create mode 100644 examples/internal/proto/examplepb/opaque_body_import.pb.gw.go create mode 100644 examples/internal/proto/examplepb/opaque_body_import.proto create mode 100644 examples/internal/proto/examplepb/opaque_body_import.swagger.json create mode 100644 examples/internal/proto/examplepb/opaque_body_import_grpc.pb.go create mode 100644 examples/internal/proto/sub/camel_case_message.pb.go create mode 100644 examples/internal/proto/sub/camel_case_message.proto create mode 100644 examples/internal/proto/sub/camel_case_message.swagger.json diff --git a/Makefile b/Makefile index 2caf27e1765..5cbc03385dc 100644 --- a/Makefile +++ b/Makefile @@ -154,6 +154,9 @@ proto: buf generate \ --template ./examples/internal/proto/examplepb/opaque.buf.gen.yaml \ --path examples/internal/proto/examplepb/opaque.proto + buf generate \ + --template ./examples/internal/proto/examplepb/opaque_body_import.buf.gen.yaml \ + --path examples/internal/proto/examplepb/opaque_body_import.proto generate: proto $(ECHO_EXAMPLE_SRCS) $(ABE_EXAMPLE_SRCS) $(UNANNOTATED_ECHO_EXAMPLE_SRCS) $(RESPONSE_BODY_EXAMPLE_SRCS) $(GENERATE_UNBOUND_METHODS_EXAMPLE_SRCS) diff --git a/buf.yaml b/buf.yaml index 80e405f6d80..3344c9938fa 100644 --- a/buf.yaml +++ b/buf.yaml @@ -11,6 +11,7 @@ lint: ignore_only: DIRECTORY_SAME_PACKAGE: - examples/internal/proto/examplepb/a_bit_of_everything.proto + - examples/internal/proto/examplepb/camel_case_service.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/enum_with_single_value.proto - examples/internal/proto/examplepb/flow_combination.proto @@ -19,6 +20,7 @@ lint: - examples/internal/proto/examplepb/excess_body.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/opaque.proto + - examples/internal/proto/examplepb/opaque_body_import.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto @@ -29,6 +31,8 @@ lint: - examples/internal/proto/examplepb/ignore_comment.proto - examples/internal/proto/examplepb/remove_internal_comment.proto - examples/internal/proto/examplepb/wrappers.proto + ENUM_PASCAL_CASE: + - examples/internal/proto/sub/camel_case_message.proto ENUM_VALUE_PREFIX: - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/response_body_service.proto @@ -49,9 +53,12 @@ lint: - examples/internal/proto/examplepb/non_standard_names.proto - runtime/internal/examplepb/example.proto - runtime/internal/examplepb/non_standard_names.proto + MESSAGE_PASCAL_CASE: + - examples/internal/proto/sub/camel_case_message.proto PACKAGE_DIRECTORY_MATCH: - examples/internal/helloworld/helloworld.proto - examples/internal/proto/examplepb/a_bit_of_everything.proto + - examples/internal/proto/examplepb/camel_case_service.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/enum_with_single_value.proto - examples/internal/proto/examplepb/flow_combination.proto @@ -60,6 +67,7 @@ lint: - examples/internal/proto/examplepb/excess_body.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/opaque.proto + - examples/internal/proto/examplepb/opaque_body_import.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto @@ -72,6 +80,7 @@ lint: - examples/internal/proto/examplepb/wrappers.proto - examples/internal/proto/oneofenum/oneof_enum.proto - examples/internal/proto/pathenum/path_enum.proto + - examples/internal/proto/sub/camel_case_message.proto - examples/internal/proto/sub/message.proto - examples/internal/proto/sub2/message.proto - internal/descriptor/apiconfig/apiconfig.proto @@ -84,6 +93,7 @@ lint: - runtime/internal/examplepb/proto3.proto PACKAGE_SAME_GO_PACKAGE: - examples/internal/proto/examplepb/a_bit_of_everything.proto + - examples/internal/proto/examplepb/camel_case_service.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/enum_with_single_value.proto - examples/internal/proto/examplepb/flow_combination.proto @@ -92,6 +102,7 @@ lint: - examples/internal/proto/examplepb/excess_body.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/opaque.proto + - examples/internal/proto/examplepb/opaque_body_import.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/examplepb/stream.proto - examples/internal/proto/examplepb/unannotated_echo_service.proto @@ -107,6 +118,7 @@ lint: PACKAGE_VERSION_SUFFIX: - examples/internal/helloworld/helloworld.proto - examples/internal/proto/examplepb/a_bit_of_everything.proto + - examples/internal/proto/examplepb/camel_case_service.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/enum_with_single_value.proto - examples/internal/proto/examplepb/flow_combination.proto @@ -115,6 +127,7 @@ lint: - examples/internal/proto/examplepb/excess_body.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/opaque.proto + - examples/internal/proto/examplepb/opaque_body_import.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto @@ -127,6 +140,7 @@ lint: - examples/internal/proto/examplepb/wrappers.proto - examples/internal/proto/oneofenum/oneof_enum.proto - examples/internal/proto/pathenum/path_enum.proto + - examples/internal/proto/sub/camel_case_message.proto - examples/internal/proto/sub/message.proto - examples/internal/proto/sub2/message.proto - internal/descriptor/apiconfig/apiconfig.proto @@ -137,6 +151,8 @@ lint: - runtime/internal/examplepb/non_standard_names.proto - runtime/internal/examplepb/proto2.proto - runtime/internal/examplepb/proto3.proto + RPC_PASCAL_CASE: + - examples/internal/proto/examplepb/camel_case_service.proto RPC_REQUEST_RESPONSE_UNIQUE: - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/echo_service.proto @@ -190,9 +206,11 @@ lint: - runtime/internal/examplepb/non_standard_names.proto SERVICE_PASCAL_CASE: - examples/internal/proto/examplepb/a_bit_of_everything.proto + - examples/internal/proto/examplepb/camel_case_service.proto SERVICE_SUFFIX: - examples/internal/helloworld/helloworld.proto - examples/internal/proto/examplepb/a_bit_of_everything.proto + - examples/internal/proto/examplepb/camel_case_service.proto - examples/internal/proto/examplepb/flow_combination.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto diff --git a/examples/internal/proto/examplepb/BUILD.bazel b/examples/internal/proto/examplepb/BUILD.bazel index 4bd36f4b514..0d1107386da 100644 --- a/examples/internal/proto/examplepb/BUILD.bazel +++ b/examples/internal/proto/examplepb/BUILD.bazel @@ -56,6 +56,8 @@ proto_library( name = "examplepb_proto", srcs = [ "a_bit_of_everything.proto", + "camel_case_message.proto", + "camel_case_service.proto", "echo_service.proto", "enum_with_single_value.proto", "excess_body.proto", @@ -64,6 +66,7 @@ proto_library( "generated_output.proto", "ignore_comment.proto", "non_standard_names.proto", + "opaque_body_import.proto", "remove_internal_comment.proto", "response_body_service.proto", "stream.proto", diff --git a/examples/internal/proto/examplepb/camel_case_service.pb.go b/examples/internal/proto/examplepb/camel_case_service.pb.go new file mode 100644 index 00000000000..b14f3d06c5c --- /dev/null +++ b/examples/internal/proto/examplepb/camel_case_service.pb.go @@ -0,0 +1,336 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.1 +// protoc (unknown) +// source: examples/internal/proto/examplepb/camel_case_service.proto + +package examplepb + +import ( + sub "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 GetStatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State sub.StatusEnum `protobuf:"varint,1,opt,name=state,proto3,enum=grpc.gateway.examples.internal.proto.sub.StatusEnum" json:"state,omitempty"` +} + +func (x *GetStatusRequest) Reset() { + *x = GetStatusRequest{} + mi := &file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStatusRequest) ProtoMessage() {} + +func (x *GetStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStatusRequest.ProtoReflect.Descriptor instead. +func (*GetStatusRequest) Descriptor() ([]byte, []int) { + return file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescGZIP(), []int{0} +} + +func (x *GetStatusRequest) GetState() sub.StatusEnum { + if x != nil { + return x.State + } + return sub.StatusEnum(0) +} + +type GetStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State sub.StatusEnum `protobuf:"varint,1,opt,name=state,proto3,enum=grpc.gateway.examples.internal.proto.sub.StatusEnum" json:"state,omitempty"` +} + +func (x *GetStatusResponse) Reset() { + *x = GetStatusResponse{} + mi := &file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStatusResponse) ProtoMessage() {} + +func (x *GetStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStatusResponse.ProtoReflect.Descriptor instead. +func (*GetStatusResponse) Descriptor() ([]byte, []int) { + return file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescGZIP(), []int{1} +} + +func (x *GetStatusResponse) GetState() sub.StatusEnum { + if x != nil { + return x.State + } + return sub.StatusEnum(0) +} + +type PostBookRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Book *sub.CreateBook `protobuf:"bytes,1,opt,name=book,proto3" json:"book,omitempty"` +} + +func (x *PostBookRequest) Reset() { + *x = PostBookRequest{} + mi := &file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PostBookRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostBookRequest) ProtoMessage() {} + +func (x *PostBookRequest) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PostBookRequest.ProtoReflect.Descriptor instead. +func (*PostBookRequest) Descriptor() ([]byte, []int) { + return file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescGZIP(), []int{2} +} + +func (x *PostBookRequest) GetBook() *sub.CreateBook { + if x != nil { + return x.Book + } + return nil +} + +type PostBookResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Book *sub.CreateBook `protobuf:"bytes,1,opt,name=book,proto3" json:"book,omitempty"` +} + +func (x *PostBookResponse) Reset() { + *x = PostBookResponse{} + mi := &file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PostBookResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostBookResponse) ProtoMessage() {} + +func (x *PostBookResponse) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PostBookResponse.ProtoReflect.Descriptor instead. +func (*PostBookResponse) Descriptor() ([]byte, []int) { + return file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescGZIP(), []int{3} +} + +func (x *PostBookResponse) GetBook() *sub.CreateBook { + if x != nil { + return x.Book + } + return nil +} + +var File_examples_internal_proto_examplepb_camel_case_service_proto protoreflect.FileDescriptor + +var file_examples_internal_proto_examplepb_camel_case_service_proto_rawDesc = []byte{ + 0x0a, 0x3a, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, + 0x65, 0x70, 0x62, 0x2f, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 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, 0x34, 0x65, 0x78, 0x61, 0x6d, + 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x63, 0x61, + 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x5f, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x4b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x22, 0x60, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x22, 0x5c, 0x0a, 0x0f, 0x50, 0x6f, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x49, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, + 0x6b, 0x22, 0x5d, 0x0a, 0x10, 0x50, 0x6f, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, + 0x32, 0xfd, 0x02, 0x0a, 0x12, 0x43, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x43, 0x61, 0x73, 0x65, 0x5f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb1, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, + 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x63, + 0x61, 0x73, 0x65, 0x2f, 0x7b, 0x73, 0x74, 0x61, 0x74, 0x65, 0x7d, 0x12, 0xb2, 0x01, 0x0a, 0x09, + 0x50, 0x6f, 0x73, 0x74, 0x5f, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x3f, 0x2e, 0x67, 0x72, 0x70, 0x63, + 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, + 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x42, + 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, + 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, + 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x73, 0x74, + 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x1c, 0x3a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, + 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, + 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescOnce sync.Once + file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescData = file_examples_internal_proto_examplepb_camel_case_service_proto_rawDesc +) + +func file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescGZIP() []byte { + file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescOnce.Do(func() { + file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescData) + }) + return file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescData +} + +var file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_examples_internal_proto_examplepb_camel_case_service_proto_goTypes = []any{ + (*GetStatusRequest)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.GetStatusRequest + (*GetStatusResponse)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.GetStatusResponse + (*PostBookRequest)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.PostBookRequest + (*PostBookResponse)(nil), // 3: grpc.gateway.examples.internal.proto.examplepb.PostBookResponse + (sub.StatusEnum)(0), // 4: grpc.gateway.examples.internal.proto.sub.Status_enum + (*sub.CreateBook)(nil), // 5: grpc.gateway.examples.internal.proto.sub.Create_book +} +var file_examples_internal_proto_examplepb_camel_case_service_proto_depIdxs = []int32{ + 4, // 0: grpc.gateway.examples.internal.proto.examplepb.GetStatusRequest.state:type_name -> grpc.gateway.examples.internal.proto.sub.Status_enum + 4, // 1: grpc.gateway.examples.internal.proto.examplepb.GetStatusResponse.state:type_name -> grpc.gateway.examples.internal.proto.sub.Status_enum + 5, // 2: grpc.gateway.examples.internal.proto.examplepb.PostBookRequest.book:type_name -> grpc.gateway.examples.internal.proto.sub.Create_book + 5, // 3: grpc.gateway.examples.internal.proto.examplepb.PostBookResponse.book:type_name -> grpc.gateway.examples.internal.proto.sub.Create_book + 0, // 4: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Get_status:input_type -> grpc.gateway.examples.internal.proto.examplepb.GetStatusRequest + 2, // 5: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Post_Book:input_type -> grpc.gateway.examples.internal.proto.examplepb.PostBookRequest + 1, // 6: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Get_status:output_type -> grpc.gateway.examples.internal.proto.examplepb.GetStatusResponse + 3, // 7: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Post_Book:output_type -> grpc.gateway.examples.internal.proto.examplepb.PostBookResponse + 6, // [6:8] is the sub-list for method output_type + 4, // [4:6] 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_examples_internal_proto_examplepb_camel_case_service_proto_init() } +func file_examples_internal_proto_examplepb_camel_case_service_proto_init() { + if File_examples_internal_proto_examplepb_camel_case_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_examples_internal_proto_examplepb_camel_case_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_examples_internal_proto_examplepb_camel_case_service_proto_goTypes, + DependencyIndexes: file_examples_internal_proto_examplepb_camel_case_service_proto_depIdxs, + MessageInfos: file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes, + }.Build() + File_examples_internal_proto_examplepb_camel_case_service_proto = out.File + file_examples_internal_proto_examplepb_camel_case_service_proto_rawDesc = nil + file_examples_internal_proto_examplepb_camel_case_service_proto_goTypes = nil + file_examples_internal_proto_examplepb_camel_case_service_proto_depIdxs = nil +} diff --git a/examples/internal/proto/examplepb/camel_case_service.pb.gw.go b/examples/internal/proto/examplepb/camel_case_service.pb.gw.go new file mode 100644 index 00000000000..b204a27e9b8 --- /dev/null +++ b/examples/internal/proto/examplepb/camel_case_service.pb.gw.go @@ -0,0 +1,240 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: examples/internal/proto/examplepb/camel_case_service.proto + +/* +Package examplepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package examplepb + +import ( + "context" + "errors" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" + "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" +) + +// Suppress "imported and not used" errors +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = errors.New + _ = runtime.String + _ = utilities.NewDoubleArray + _ = metadata.Join +) + +func request_Camel_CaseService_GetStatus_0(ctx context.Context, marshaler runtime.Marshaler, client Camel_CaseServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetStatusRequest + metadata runtime.ServerMetadata + e int32 + err error + ) + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + val, ok := pathParams["state"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "state") + } + e, err = runtime.Enum(val, sub.StatusEnum_value) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "state", err) + } + protoReq.State = sub.StatusEnum(e) + msg, err := client.GetStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_Camel_CaseService_GetStatus_0(ctx context.Context, marshaler runtime.Marshaler, server Camel_CaseServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetStatusRequest + metadata runtime.ServerMetadata + e int32 + err error + ) + val, ok := pathParams["state"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "state") + } + e, err = runtime.Enum(val, sub.StatusEnum_value) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "state", err) + } + protoReq.State = sub.StatusEnum(e) + msg, err := server.GetStatus(ctx, &protoReq) + return msg, metadata, err +} + +func request_Camel_CaseService_Post_Book_0(ctx context.Context, marshaler runtime.Marshaler, client Camel_CaseServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq PostBookRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Book); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.Post_Book(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_Camel_CaseService_Post_Book_0(ctx context.Context, marshaler runtime.Marshaler, server Camel_CaseServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq PostBookRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Book); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.Post_Book(ctx, &protoReq) + return msg, metadata, err +} + +// RegisterCamel_CaseServiceHandlerServer registers the http handlers for service Camel_CaseService to "mux". +// UnaryRPC :call Camel_CaseServiceServer 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 RegisterCamel_CaseServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterCamel_CaseServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server Camel_CaseServiceServer) error { + mux.Handle(http.MethodGet, pattern_Camel_CaseService_GetStatus_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) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.Camel_CaseService/GetStatus", runtime.WithHTTPPathPattern("/v1/camel_case/{state}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Camel_CaseService_GetStatus_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_Camel_CaseService_GetStatus_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_Camel_CaseService_Post_Book_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) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.Camel_CaseService/Post_Book", runtime.WithHTTPPathPattern("/v1/camel_case/books")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Camel_CaseService_Post_Book_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_Camel_CaseService_Post_Book_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + + return nil +} + +// RegisterCamel_CaseServiceHandlerFromEndpoint is same as RegisterCamel_CaseServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterCamel_CaseServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + return RegisterCamel_CaseServiceHandler(ctx, mux, conn) +} + +// RegisterCamel_CaseServiceHandler registers the http handlers for service Camel_CaseService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterCamel_CaseServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterCamel_CaseServiceHandlerClient(ctx, mux, NewCamel_CaseServiceClient(conn)) +} + +// RegisterCamel_CaseServiceHandlerClient registers the http handlers for service Camel_CaseService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "Camel_CaseServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "Camel_CaseServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "Camel_CaseServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterCamel_CaseServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client Camel_CaseServiceClient) error { + mux.Handle(http.MethodGet, pattern_Camel_CaseService_GetStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.Camel_CaseService/GetStatus", runtime.WithHTTPPathPattern("/v1/camel_case/{state}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Camel_CaseService_GetStatus_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_Camel_CaseService_GetStatus_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_Camel_CaseService_Post_Book_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.Camel_CaseService/Post_Book", runtime.WithHTTPPathPattern("/v1/camel_case/books")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Camel_CaseService_Post_Book_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_Camel_CaseService_Post_Book_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + return nil +} + +var ( + pattern_Camel_CaseService_GetStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "camel_case", "state"}, "")) + pattern_Camel_CaseService_Post_Book_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "camel_case", "books"}, "")) +) + +var ( + forward_Camel_CaseService_GetStatus_0 = runtime.ForwardResponseMessage + forward_Camel_CaseService_Post_Book_0 = runtime.ForwardResponseMessage +) diff --git a/examples/internal/proto/examplepb/camel_case_service.proto b/examples/internal/proto/examplepb/camel_case_service.proto new file mode 100644 index 00000000000..c8a14a9c0c2 --- /dev/null +++ b/examples/internal/proto/examplepb/camel_case_service.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; + +package grpc.gateway.examples.internal.proto.examplepb; + +import "google/api/annotations.proto"; +import "examples/internal/proto/sub/camel_case_message.proto"; + +option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; + +// Camel_Case_service consumes snake_case identifiers declared in the sub +// package to ensure generated code camel-cases enum/message references, even +// when service and RPC names are snake_case. +service Camel_Case_service { + rpc Get_status(GetStatusRequest) returns (GetStatusResponse) { + option (google.api.http) = { + get: "/v1/camel_case/{state}" + }; + } + + rpc Post_Book(PostBookRequest) returns (PostBookResponse) { + option (google.api.http) = { + post: "/v1/camel_case/books" + body: "book" + }; + } +} + +message GetStatusRequest { + grpc.gateway.examples.internal.proto.sub.Status_enum state = 1; +} + +message GetStatusResponse { + grpc.gateway.examples.internal.proto.sub.Status_enum state = 1; +} + +message PostBookRequest { + grpc.gateway.examples.internal.proto.sub.Create_book book = 1; +} + +message PostBookResponse { + grpc.gateway.examples.internal.proto.sub.Create_book book = 1; +} diff --git a/examples/internal/proto/examplepb/camel_case_service.swagger.json b/examples/internal/proto/examplepb/camel_case_service.swagger.json new file mode 100644 index 00000000000..28ff90786a7 --- /dev/null +++ b/examples/internal/proto/examplepb/camel_case_service.swagger.json @@ -0,0 +1,158 @@ +{ + "swagger": "2.0", + "info": { + "title": "examples/internal/proto/examplepb/camel_case_service.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "Camel_Case_service" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/camel_case/books": { + "post": { + "operationId": "Camel_Case_service_Post_Book", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbPostBookResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googleRpcStatus" + } + } + }, + "parameters": [ + { + "name": "book", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/subCreate_book" + } + } + ], + "tags": [ + "Camel_Case_service" + ] + } + }, + "/v1/camel_case/{state}": { + "get": { + "operationId": "Camel_Case_service_Get_status", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbGetStatusResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googleRpcStatus" + } + } + }, + "parameters": [ + { + "name": "state", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "STATUS_ENUM_UNSPECIFIED", + "STATUS_ENUM_AVAILABLE" + ] + } + ], + "tags": [ + "Camel_Case_service" + ] + } + } + }, + "definitions": { + "examplepbGetStatusResponse": { + "type": "object", + "properties": { + "state": { + "$ref": "#/definitions/subStatus_enum" + } + } + }, + "examplepbPostBookResponse": { + "type": "object", + "properties": { + "book": { + "$ref": "#/definitions/subCreate_book" + } + } + }, + "googleRpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + }, + "message": { + "type": "string", + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + }, + "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." + } + }, + "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string", + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + } + }, + "additionalProperties": {}, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "subCreate_book": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "author": { + "type": "string" + } + }, + "description": "Create_book and Status_enum demonstrate snake_case identifiers that need to\nbe resolved to Go camel case when referenced by other packages." + }, + "subStatus_enum": { + "type": "string", + "enum": [ + "STATUS_ENUM_UNSPECIFIED", + "STATUS_ENUM_AVAILABLE" + ], + "default": "STATUS_ENUM_UNSPECIFIED" + } + } +} diff --git a/examples/internal/proto/examplepb/camel_case_service_grpc.pb.go b/examples/internal/proto/examplepb/camel_case_service_grpc.pb.go new file mode 100644 index 00000000000..d46277f249b --- /dev/null +++ b/examples/internal/proto/examplepb/camel_case_service_grpc.pb.go @@ -0,0 +1,165 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: examples/internal/proto/examplepb/camel_case_service.proto + +package examplepb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// 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.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + Camel_CaseService_GetStatus_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service/Get_status" + Camel_CaseService_Post_Book_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service/Post_Book" +) + +// Camel_CaseServiceClient is the client API for Camel_CaseService 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. +// +// Camel_Case_service consumes snake_case identifiers declared in the sub +// package to ensure generated code camel-cases enum/message references, even +// when service and RPC names are snake_case. +type Camel_CaseServiceClient interface { + GetStatus(ctx context.Context, in *GetStatusRequest, opts ...grpc.CallOption) (*GetStatusResponse, error) + Post_Book(ctx context.Context, in *PostBookRequest, opts ...grpc.CallOption) (*PostBookResponse, error) +} + +type camel_CaseServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCamel_CaseServiceClient(cc grpc.ClientConnInterface) Camel_CaseServiceClient { + return &camel_CaseServiceClient{cc} +} + +func (c *camel_CaseServiceClient) GetStatus(ctx context.Context, in *GetStatusRequest, opts ...grpc.CallOption) (*GetStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetStatusResponse) + err := c.cc.Invoke(ctx, Camel_CaseService_GetStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *camel_CaseServiceClient) Post_Book(ctx context.Context, in *PostBookRequest, opts ...grpc.CallOption) (*PostBookResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PostBookResponse) + err := c.cc.Invoke(ctx, Camel_CaseService_Post_Book_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Camel_CaseServiceServer is the server API for Camel_CaseService service. +// All implementations should embed UnimplementedCamel_CaseServiceServer +// for forward compatibility. +// +// Camel_Case_service consumes snake_case identifiers declared in the sub +// package to ensure generated code camel-cases enum/message references, even +// when service and RPC names are snake_case. +type Camel_CaseServiceServer interface { + GetStatus(context.Context, *GetStatusRequest) (*GetStatusResponse, error) + Post_Book(context.Context, *PostBookRequest) (*PostBookResponse, error) +} + +// UnimplementedCamel_CaseServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedCamel_CaseServiceServer struct{} + +func (UnimplementedCamel_CaseServiceServer) GetStatus(context.Context, *GetStatusRequest) (*GetStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStatus not implemented") +} +func (UnimplementedCamel_CaseServiceServer) Post_Book(context.Context, *PostBookRequest) (*PostBookResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Post_Book not implemented") +} +func (UnimplementedCamel_CaseServiceServer) testEmbeddedByValue() {} + +// UnsafeCamel_CaseServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to Camel_CaseServiceServer will +// result in compilation errors. +type UnsafeCamel_CaseServiceServer interface { + mustEmbedUnimplementedCamel_CaseServiceServer() +} + +func RegisterCamel_CaseServiceServer(s grpc.ServiceRegistrar, srv Camel_CaseServiceServer) { + // If the following call pancis, it indicates UnimplementedCamel_CaseServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&Camel_CaseService_ServiceDesc, srv) +} + +func _Camel_CaseService_GetStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(Camel_CaseServiceServer).GetStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Camel_CaseService_GetStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(Camel_CaseServiceServer).GetStatus(ctx, req.(*GetStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Camel_CaseService_Post_Book_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PostBookRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(Camel_CaseServiceServer).Post_Book(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Camel_CaseService_Post_Book_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(Camel_CaseServiceServer).Post_Book(ctx, req.(*PostBookRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Camel_CaseService_ServiceDesc is the grpc.ServiceDesc for Camel_CaseService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Camel_CaseService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service", + HandlerType: (*Camel_CaseServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Get_status", + Handler: _Camel_CaseService_GetStatus_Handler, + }, + { + MethodName: "Post_Book", + Handler: _Camel_CaseService_Post_Book_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/internal/proto/examplepb/camel_case_service.proto", +} diff --git a/examples/internal/proto/examplepb/opaque_body_import.buf.gen.yaml b/examples/internal/proto/examplepb/opaque_body_import.buf.gen.yaml new file mode 100644 index 00000000000..bc4d4ec35a7 --- /dev/null +++ b/examples/internal/proto/examplepb/opaque_body_import.buf.gen.yaml @@ -0,0 +1,17 @@ +version: v2 +plugins: + - remote: buf.build/protocolbuffers/go:v1.36.6 + out: . + opt: + - paths=source_relative + - default_api_level=API_OPAQUE + - remote: buf.build/grpc/go:v1.5.1 + out: . + opt: + - paths=source_relative + - require_unimplemented_servers=false + - local: protoc-gen-grpc-gateway + out: . + opt: + - paths=source_relative + - use_opaque_api=true diff --git a/examples/internal/proto/examplepb/opaque_body_import.pb.go b/examples/internal/proto/examplepb/opaque_body_import.pb.go new file mode 100644 index 00000000000..99672514df1 --- /dev/null +++ b/examples/internal/proto/examplepb/opaque_body_import.pb.go @@ -0,0 +1,213 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc (unknown) +// source: examples/internal/proto/examplepb/opaque_body_import.proto + +package examplepb + +import ( + sub "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + unsafe "unsafe" +) + +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 OpaqueCreateBookRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Book *sub.CreateBook `protobuf:"bytes,1,opt,name=book"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpaqueCreateBookRequest) Reset() { + *x = OpaqueCreateBookRequest{} + mi := &file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpaqueCreateBookRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpaqueCreateBookRequest) ProtoMessage() {} + +func (x *OpaqueCreateBookRequest) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *OpaqueCreateBookRequest) GetBook() *sub.CreateBook { + if x != nil { + return x.xxx_hidden_Book + } + return nil +} + +func (x *OpaqueCreateBookRequest) SetBook(v *sub.CreateBook) { + x.xxx_hidden_Book = v +} + +func (x *OpaqueCreateBookRequest) HasBook() bool { + if x == nil { + return false + } + return x.xxx_hidden_Book != nil +} + +func (x *OpaqueCreateBookRequest) ClearBook() { + x.xxx_hidden_Book = nil +} + +type OpaqueCreateBookRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Book *sub.CreateBook +} + +func (b0 OpaqueCreateBookRequest_builder) Build() *OpaqueCreateBookRequest { + m0 := &OpaqueCreateBookRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Book = b.Book + return m0 +} + +type OpaqueCreateBookResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Book *sub.CreateBook `protobuf:"bytes,1,opt,name=book"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpaqueCreateBookResponse) Reset() { + *x = OpaqueCreateBookResponse{} + mi := &file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpaqueCreateBookResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpaqueCreateBookResponse) ProtoMessage() {} + +func (x *OpaqueCreateBookResponse) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *OpaqueCreateBookResponse) GetBook() *sub.CreateBook { + if x != nil { + return x.xxx_hidden_Book + } + return nil +} + +func (x *OpaqueCreateBookResponse) SetBook(v *sub.CreateBook) { + x.xxx_hidden_Book = v +} + +func (x *OpaqueCreateBookResponse) HasBook() bool { + if x == nil { + return false + } + return x.xxx_hidden_Book != nil +} + +func (x *OpaqueCreateBookResponse) ClearBook() { + x.xxx_hidden_Book = nil +} + +type OpaqueCreateBookResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Book *sub.CreateBook +} + +func (b0 OpaqueCreateBookResponse_builder) Build() *OpaqueCreateBookResponse { + m0 := &OpaqueCreateBookResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Book = b.Book + return m0 +} + +var File_examples_internal_proto_examplepb_opaque_body_import_proto protoreflect.FileDescriptor + +const file_examples_internal_proto_examplepb_opaque_body_import_proto_rawDesc = "" + + "\n" + + ":examples/internal/proto/examplepb/opaque_body_import.proto\x12.grpc.gateway.examples.internal.proto.examplepb\x1a\x1cgoogle/api/annotations.proto\x1a4examples/internal/proto/sub/camel_case_message.proto\"d\n" + + "\x17OpaqueCreateBookRequest\x12I\n" + + "\x04book\x18\x01 \x01(\v25.grpc.gateway.examples.internal.proto.sub.Create_bookR\x04book\"e\n" + + "\x18OpaqueCreateBookResponse\x12I\n" + + "\x04book\x18\x01 \x01(\v25.grpc.gateway.examples.internal.proto.sub.Create_bookR\x04book2\xd4\x01\n" + + "\x11OpaqueBookService\x12\xbe\x01\n" + + "\x10OpaqueCreateBook\x12G.grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookRequest\x1aH.grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookResponse\"\x17\x82\xd3\xe4\x93\x02\x11:\x04book\"\t/v1/booksBMZKgithub.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepbb\beditionsp\xe8\a" + +var file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_examples_internal_proto_examplepb_opaque_body_import_proto_goTypes = []any{ + (*OpaqueCreateBookRequest)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookRequest + (*OpaqueCreateBookResponse)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookResponse + (*sub.CreateBook)(nil), // 2: grpc.gateway.examples.internal.proto.sub.Create_book +} +var file_examples_internal_proto_examplepb_opaque_body_import_proto_depIdxs = []int32{ + 2, // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookRequest.book:type_name -> grpc.gateway.examples.internal.proto.sub.Create_book + 2, // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookResponse.book:type_name -> grpc.gateway.examples.internal.proto.sub.Create_book + 0, // 2: grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService.OpaqueCreateBook:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookRequest + 1, // 3: grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService.OpaqueCreateBook:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookResponse + 3, // [3:4] is the sub-list for method output_type + 2, // [2:3] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_examples_internal_proto_examplepb_opaque_body_import_proto_init() } +func file_examples_internal_proto_examplepb_opaque_body_import_proto_init() { + if File_examples_internal_proto_examplepb_opaque_body_import_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_examples_internal_proto_examplepb_opaque_body_import_proto_rawDesc), len(file_examples_internal_proto_examplepb_opaque_body_import_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_examples_internal_proto_examplepb_opaque_body_import_proto_goTypes, + DependencyIndexes: file_examples_internal_proto_examplepb_opaque_body_import_proto_depIdxs, + MessageInfos: file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes, + }.Build() + File_examples_internal_proto_examplepb_opaque_body_import_proto = out.File + file_examples_internal_proto_examplepb_opaque_body_import_proto_goTypes = nil + file_examples_internal_proto_examplepb_opaque_body_import_proto_depIdxs = nil +} diff --git a/examples/internal/proto/examplepb/opaque_body_import.pb.gw.go b/examples/internal/proto/examplepb/opaque_body_import.pb.gw.go new file mode 100644 index 00000000000..78dfc6bdb89 --- /dev/null +++ b/examples/internal/proto/examplepb/opaque_body_import.pb.gw.go @@ -0,0 +1,162 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: examples/internal/proto/examplepb/opaque_body_import.proto + +/* +Package examplepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package examplepb + +import ( + "context" + "errors" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" + "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" +) + +// Suppress "imported and not used" errors +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = errors.New + _ = runtime.String + _ = utilities.NewDoubleArray + _ = metadata.Join +) + +func request_OpaqueBookService_OpaqueCreateBook_0(ctx context.Context, marshaler runtime.Marshaler, client OpaqueBookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq OpaqueCreateBookRequest + metadata runtime.ServerMetadata + ) + bodyData := &sub.CreateBook{} + if err := marshaler.NewDecoder(req.Body).Decode(bodyData); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + protoReq.SetBook(bodyData) + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.OpaqueCreateBook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_OpaqueBookService_OpaqueCreateBook_0(ctx context.Context, marshaler runtime.Marshaler, server OpaqueBookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq OpaqueCreateBookRequest + metadata runtime.ServerMetadata + ) + bodyData := &sub.CreateBook{} + if err := marshaler.NewDecoder(req.Body).Decode(bodyData); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + protoReq.SetBook(bodyData) + msg, err := server.OpaqueCreateBook(ctx, &protoReq) + return msg, metadata, err +} + +// RegisterOpaqueBookServiceHandlerServer registers the http handlers for service OpaqueBookService to "mux". +// UnaryRPC :call OpaqueBookServiceServer 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 RegisterOpaqueBookServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterOpaqueBookServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OpaqueBookServiceServer) error { + mux.Handle(http.MethodPost, pattern_OpaqueBookService_OpaqueCreateBook_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) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService/OpaqueCreateBook", runtime.WithHTTPPathPattern("/v1/books")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_OpaqueBookService_OpaqueCreateBook_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_OpaqueBookService_OpaqueCreateBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + + return nil +} + +// RegisterOpaqueBookServiceHandlerFromEndpoint is same as RegisterOpaqueBookServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterOpaqueBookServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + return RegisterOpaqueBookServiceHandler(ctx, mux, conn) +} + +// RegisterOpaqueBookServiceHandler registers the http handlers for service OpaqueBookService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterOpaqueBookServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterOpaqueBookServiceHandlerClient(ctx, mux, NewOpaqueBookServiceClient(conn)) +} + +// RegisterOpaqueBookServiceHandlerClient registers the http handlers for service OpaqueBookService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "OpaqueBookServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "OpaqueBookServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "OpaqueBookServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterOpaqueBookServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OpaqueBookServiceClient) error { + mux.Handle(http.MethodPost, pattern_OpaqueBookService_OpaqueCreateBook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService/OpaqueCreateBook", runtime.WithHTTPPathPattern("/v1/books")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_OpaqueBookService_OpaqueCreateBook_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_OpaqueBookService_OpaqueCreateBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + return nil +} + +var ( + pattern_OpaqueBookService_OpaqueCreateBook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "books"}, "")) +) + +var ( + forward_OpaqueBookService_OpaqueCreateBook_0 = runtime.ForwardResponseMessage +) diff --git a/examples/internal/proto/examplepb/opaque_body_import.proto b/examples/internal/proto/examplepb/opaque_body_import.proto new file mode 100644 index 00000000000..551054b553d --- /dev/null +++ b/examples/internal/proto/examplepb/opaque_body_import.proto @@ -0,0 +1,28 @@ +edition = "2023"; + +package grpc.gateway.examples.internal.proto.examplepb; + +import "google/api/annotations.proto"; +import "examples/internal/proto/sub/camel_case_message.proto"; + +option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; + +// OpaqueService demonstrates an HTTP binding whose body references a +// message defined in another package (sub.Create_book). This mirrors the +// missing-import scenario that previously broke opaque API builds. +service OpaqueBookService { + rpc OpaqueCreateBook(OpaqueCreateBookRequest) returns (OpaqueCreateBookResponse) { + option (google.api.http) = { + post: "/v1/books" + body: "book" + }; + } +} + +message OpaqueCreateBookRequest { + grpc.gateway.examples.internal.proto.sub.Create_book book = 1; +} + +message OpaqueCreateBookResponse { + grpc.gateway.examples.internal.proto.sub.Create_book book = 1; +} diff --git a/examples/internal/proto/examplepb/opaque_body_import.swagger.json b/examples/internal/proto/examplepb/opaque_body_import.swagger.json new file mode 100644 index 00000000000..de423e499dc --- /dev/null +++ b/examples/internal/proto/examplepb/opaque_body_import.swagger.json @@ -0,0 +1,108 @@ +{ + "swagger": "2.0", + "info": { + "title": "examples/internal/proto/examplepb/opaque_body_import.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "OpaqueBookService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/books": { + "post": { + "operationId": "OpaqueBookService_OpaqueCreateBook", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbOpaqueCreateBookResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googleRpcStatus" + } + } + }, + "parameters": [ + { + "name": "book", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/subCreate_book" + } + } + ], + "tags": [ + "OpaqueBookService" + ] + } + } + }, + "definitions": { + "examplepbOpaqueCreateBookResponse": { + "type": "object", + "properties": { + "book": { + "$ref": "#/definitions/subCreate_book" + } + } + }, + "googleRpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + }, + "message": { + "type": "string", + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + }, + "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." + } + }, + "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string", + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + } + }, + "additionalProperties": {}, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "subCreate_book": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "author": { + "type": "string" + } + }, + "description": "Create_book and Status_enum demonstrate snake_case identifiers that need to\nbe resolved to Go camel case when referenced by other packages." + } + } +} diff --git a/examples/internal/proto/examplepb/opaque_body_import_grpc.pb.go b/examples/internal/proto/examplepb/opaque_body_import_grpc.pb.go new file mode 100644 index 00000000000..a5bc53af833 --- /dev/null +++ b/examples/internal/proto/examplepb/opaque_body_import_grpc.pb.go @@ -0,0 +1,127 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: examples/internal/proto/examplepb/opaque_body_import.proto + +package examplepb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// 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.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + OpaqueBookService_OpaqueCreateBook_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService/OpaqueCreateBook" +) + +// OpaqueBookServiceClient is the client API for OpaqueBookService 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. +// +// OpaqueService demonstrates an HTTP binding whose body references a +// message defined in another package (sub.Create_book). This mirrors the +// missing-import scenario that previously broke opaque API builds. +type OpaqueBookServiceClient interface { + OpaqueCreateBook(ctx context.Context, in *OpaqueCreateBookRequest, opts ...grpc.CallOption) (*OpaqueCreateBookResponse, error) +} + +type opaqueBookServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewOpaqueBookServiceClient(cc grpc.ClientConnInterface) OpaqueBookServiceClient { + return &opaqueBookServiceClient{cc} +} + +func (c *opaqueBookServiceClient) OpaqueCreateBook(ctx context.Context, in *OpaqueCreateBookRequest, opts ...grpc.CallOption) (*OpaqueCreateBookResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(OpaqueCreateBookResponse) + err := c.cc.Invoke(ctx, OpaqueBookService_OpaqueCreateBook_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// OpaqueBookServiceServer is the server API for OpaqueBookService service. +// All implementations should embed UnimplementedOpaqueBookServiceServer +// for forward compatibility. +// +// OpaqueService demonstrates an HTTP binding whose body references a +// message defined in another package (sub.Create_book). This mirrors the +// missing-import scenario that previously broke opaque API builds. +type OpaqueBookServiceServer interface { + OpaqueCreateBook(context.Context, *OpaqueCreateBookRequest) (*OpaqueCreateBookResponse, error) +} + +// UnimplementedOpaqueBookServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedOpaqueBookServiceServer struct{} + +func (UnimplementedOpaqueBookServiceServer) OpaqueCreateBook(context.Context, *OpaqueCreateBookRequest) (*OpaqueCreateBookResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpaqueCreateBook not implemented") +} +func (UnimplementedOpaqueBookServiceServer) testEmbeddedByValue() {} + +// UnsafeOpaqueBookServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to OpaqueBookServiceServer will +// result in compilation errors. +type UnsafeOpaqueBookServiceServer interface { + mustEmbedUnimplementedOpaqueBookServiceServer() +} + +func RegisterOpaqueBookServiceServer(s grpc.ServiceRegistrar, srv OpaqueBookServiceServer) { + // If the following call pancis, it indicates UnimplementedOpaqueBookServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&OpaqueBookService_ServiceDesc, srv) +} + +func _OpaqueBookService_OpaqueCreateBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpaqueCreateBookRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OpaqueBookServiceServer).OpaqueCreateBook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OpaqueBookService_OpaqueCreateBook_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OpaqueBookServiceServer).OpaqueCreateBook(ctx, req.(*OpaqueCreateBookRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// OpaqueBookService_ServiceDesc is the grpc.ServiceDesc for OpaqueBookService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var OpaqueBookService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService", + HandlerType: (*OpaqueBookServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "OpaqueCreateBook", + Handler: _OpaqueBookService_OpaqueCreateBook_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/internal/proto/examplepb/opaque_body_import.proto", +} diff --git a/examples/internal/proto/sub/BUILD.bazel b/examples/internal/proto/sub/BUILD.bazel index 81babfdbac5..e8ad84cad5a 100644 --- a/examples/internal/proto/sub/BUILD.bazel +++ b/examples/internal/proto/sub/BUILD.bazel @@ -6,7 +6,10 @@ package(default_visibility = ["//visibility:public"]) proto_library( name = "sub_proto", - srcs = ["message.proto"], + srcs = [ + "camel_case_message.proto", + "message.proto", + ], ) go_proto_library( diff --git a/examples/internal/proto/sub/camel_case_message.pb.go b/examples/internal/proto/sub/camel_case_message.pb.go new file mode 100644 index 00000000000..c4e57413fe3 --- /dev/null +++ b/examples/internal/proto/sub/camel_case_message.pb.go @@ -0,0 +1,199 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.1 +// protoc (unknown) +// source: examples/internal/proto/sub/camel_case_message.proto + +package sub + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 StatusEnum int32 + +const ( + StatusEnum_STATUS_ENUM_UNSPECIFIED StatusEnum = 0 + StatusEnum_STATUS_ENUM_AVAILABLE StatusEnum = 1 +) + +// Enum value maps for StatusEnum. +var ( + StatusEnum_name = map[int32]string{ + 0: "STATUS_ENUM_UNSPECIFIED", + 1: "STATUS_ENUM_AVAILABLE", + } + StatusEnum_value = map[string]int32{ + "STATUS_ENUM_UNSPECIFIED": 0, + "STATUS_ENUM_AVAILABLE": 1, + } +) + +func (x StatusEnum) Enum() *StatusEnum { + p := new(StatusEnum) + *p = x + return p +} + +func (x StatusEnum) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StatusEnum) Descriptor() protoreflect.EnumDescriptor { + return file_examples_internal_proto_sub_camel_case_message_proto_enumTypes[0].Descriptor() +} + +func (StatusEnum) Type() protoreflect.EnumType { + return &file_examples_internal_proto_sub_camel_case_message_proto_enumTypes[0] +} + +func (x StatusEnum) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StatusEnum.Descriptor instead. +func (StatusEnum) EnumDescriptor() ([]byte, []int) { + return file_examples_internal_proto_sub_camel_case_message_proto_rawDescGZIP(), []int{0} +} + +// Create_book and Status_enum demonstrate snake_case identifiers that need to +// be resolved to Go camel case when referenced by other packages. +type CreateBook struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Author string `protobuf:"bytes,2,opt,name=author,proto3" json:"author,omitempty"` +} + +func (x *CreateBook) Reset() { + *x = CreateBook{} + mi := &file_examples_internal_proto_sub_camel_case_message_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateBook) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateBook) ProtoMessage() {} + +func (x *CreateBook) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_sub_camel_case_message_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateBook.ProtoReflect.Descriptor instead. +func (*CreateBook) Descriptor() ([]byte, []int) { + return file_examples_internal_proto_sub_camel_case_message_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateBook) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *CreateBook) GetAuthor() string { + if x != nil { + return x.Author + } + return "" +} + +var File_examples_internal_proto_sub_camel_case_message_proto protoreflect.FileDescriptor + +var file_examples_internal_proto_sub_camel_case_message_proto_rawDesc = []byte{ + 0x0a, 0x34, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x63, 0x61, + 0x6d, 0x65, 0x6c, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x28, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, + 0x22, 0x3b, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x6b, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x2a, 0x45, 0x0a, + 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1b, 0x0a, 0x17, + 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x54, 0x41, + 0x54, 0x55, 0x53, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, 0x42, + 0x4c, 0x45, 0x10, 0x01, 0x42, 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, + 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_examples_internal_proto_sub_camel_case_message_proto_rawDescOnce sync.Once + file_examples_internal_proto_sub_camel_case_message_proto_rawDescData = file_examples_internal_proto_sub_camel_case_message_proto_rawDesc +) + +func file_examples_internal_proto_sub_camel_case_message_proto_rawDescGZIP() []byte { + file_examples_internal_proto_sub_camel_case_message_proto_rawDescOnce.Do(func() { + file_examples_internal_proto_sub_camel_case_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_sub_camel_case_message_proto_rawDescData) + }) + return file_examples_internal_proto_sub_camel_case_message_proto_rawDescData +} + +var file_examples_internal_proto_sub_camel_case_message_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_examples_internal_proto_sub_camel_case_message_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_examples_internal_proto_sub_camel_case_message_proto_goTypes = []any{ + (StatusEnum)(0), // 0: grpc.gateway.examples.internal.proto.sub.Status_enum + (*CreateBook)(nil), // 1: grpc.gateway.examples.internal.proto.sub.Create_book +} +var file_examples_internal_proto_sub_camel_case_message_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_examples_internal_proto_sub_camel_case_message_proto_init() } +func file_examples_internal_proto_sub_camel_case_message_proto_init() { + if File_examples_internal_proto_sub_camel_case_message_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_examples_internal_proto_sub_camel_case_message_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_examples_internal_proto_sub_camel_case_message_proto_goTypes, + DependencyIndexes: file_examples_internal_proto_sub_camel_case_message_proto_depIdxs, + EnumInfos: file_examples_internal_proto_sub_camel_case_message_proto_enumTypes, + MessageInfos: file_examples_internal_proto_sub_camel_case_message_proto_msgTypes, + }.Build() + File_examples_internal_proto_sub_camel_case_message_proto = out.File + file_examples_internal_proto_sub_camel_case_message_proto_rawDesc = nil + file_examples_internal_proto_sub_camel_case_message_proto_goTypes = nil + file_examples_internal_proto_sub_camel_case_message_proto_depIdxs = nil +} diff --git a/examples/internal/proto/sub/camel_case_message.proto b/examples/internal/proto/sub/camel_case_message.proto new file mode 100644 index 00000000000..90a62da0fb4 --- /dev/null +++ b/examples/internal/proto/sub/camel_case_message.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package grpc.gateway.examples.internal.proto.sub; + +option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub"; + +// Create_book and Status_enum demonstrate snake_case identifiers that need to +// be resolved to Go camel case when referenced by other packages. +message Create_book { + string title = 1; + string author = 2; +} + +enum Status_enum { + STATUS_ENUM_UNSPECIFIED = 0; + STATUS_ENUM_AVAILABLE = 1; +} diff --git a/examples/internal/proto/sub/camel_case_message.swagger.json b/examples/internal/proto/sub/camel_case_message.swagger.json new file mode 100644 index 00000000000..c639302e950 --- /dev/null +++ b/examples/internal/proto/sub/camel_case_message.swagger.json @@ -0,0 +1,44 @@ +{ + "swagger": "2.0", + "info": { + "title": "examples/internal/proto/sub/camel_case_message.proto", + "version": "version not set" + }, + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": {}, + "definitions": { + "googleRpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + } + } +} diff --git a/internal/descriptor/types.go b/internal/descriptor/types.go index 43eb776ea72..46a4a173cbc 100644 --- a/internal/descriptor/types.go +++ b/internal/descriptor/types.go @@ -109,11 +109,7 @@ func (m *Message) FQMN() string { // It prefixes the type name with the package alias if // its belonging package is not "currentPackage". func (m *Message) GoType(currentPackage string) string { - var components []string - components = append(components, m.Outers...) - components = append(components, m.GetName()) - - name := strings.Join(components, "_") + name := goTypeName(m.Outers, m.GetName()) if !m.ForcePrefixedName && m.File.GoPkg.Path == currentPackage { return name } @@ -148,17 +144,23 @@ func (e *Enum) FQEN() string { // It prefixes the type name with the package alias if // its belonging package is not "currentPackage". func (e *Enum) GoType(currentPackage string) string { - var components []string - components = append(components, e.Outers...) - components = append(components, e.GetName()) - - name := strings.Join(components, "_") + name := goTypeName(e.Outers, e.GetName()) if !e.ForcePrefixedName && e.File.GoPkg.Path == currentPackage { return name } return fmt.Sprintf("%s.%s", e.File.Pkg(), name) } +func goTypeName(outers []string, name string) string { + components := make([]string, 0, len(outers)+1) + for _, outer := range outers { + components = append(components, casing.Camel(outer)) + } + + components = append(components, casing.Camel(name)) + return strings.Join(components, "_") +} + // Service wraps descriptorpb.ServiceDescriptorProto for richer features. type Service struct { *descriptorpb.ServiceDescriptorProto diff --git a/internal/descriptor/types_test.go b/internal/descriptor/types_test.go index 53e07ec5a93..be8f2d8b801 100644 --- a/internal/descriptor/types_test.go +++ b/internal/descriptor/types_test.go @@ -4,6 +4,7 @@ import ( "testing" "google.golang.org/protobuf/encoding/prototext" + "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" ) @@ -263,11 +264,25 @@ func TestGoType(t *testing.T) { enum := &Enum{ EnumDescriptorProto: fd.EnumType[0], } + underscoreMsgDesc := &descriptorpb.DescriptorProto{ + Name: proto.String("create_book"), + } + fd.MessageType = append(fd.MessageType, underscoreMsgDesc) + underscoreEnumDesc := &descriptorpb.EnumDescriptorProto{ + Name: proto.String("status_enum"), + } + fd.EnumType = append(fd.EnumType, underscoreEnumDesc) + underscoreMsg := &Message{ + DescriptorProto: underscoreMsgDesc, + } + underscoreEnum := &Enum{ + EnumDescriptorProto: underscoreEnumDesc, + } file := &File{ FileDescriptorProto: &fd, GoPkg: GoPackage{Path: "example", Name: "example"}, - Messages: []*Message{msg}, - Enums: []*Enum{enum}, + Messages: []*Message{msg, underscoreMsg}, + Enums: []*Enum{enum, underscoreEnum}, } crossLinkFixture(file) @@ -293,4 +308,16 @@ func TestGoType(t *testing.T) { t.Errorf("enum.GoType() = %q; want %q", got, want) } + if got, want := underscoreMsg.GoType("example"), "CreateBook"; got != want { + t.Errorf("underscoreMsg.GoType() = %q; want %q", got, want) + } + if got, want := underscoreMsg.GoType("extPackage"), "example.CreateBook"; got != want { + t.Errorf("underscoreMsg.GoType() with ext package = %q; want %q", got, want) + } + if got, want := underscoreEnum.GoType("example"), "StatusEnum"; got != want { + t.Errorf("underscoreEnum.GoType() = %q; want %q", got, want) + } + if got, want := underscoreEnum.GoType("extPackage"), "example.StatusEnum"; got != want { + t.Errorf("underscoreEnum.GoType() with ext package = %q; want %q", got, want) + } } diff --git a/protoc-gen-grpc-gateway/internal/gengateway/generator.go b/protoc-gen-grpc-gateway/internal/gengateway/generator.go index 5a58625c237..c9f291024e8 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/generator.go @@ -119,6 +119,7 @@ func (g *generator) generate(file *descriptor.File) (string, error) { for _, svc := range file.Services { for _, m := range svc.Methods { imports = append(imports, g.addEnumPathParamImports(file, m, pkgSeen)...) + imports = append(imports, g.addBodyFieldImports(file, m, pkgSeen)...) pkg := m.RequestType.File.GoPkg if len(m.Bindings) == 0 || pkg == file.GoPkg || pkgSeen[pkg.Path] { @@ -161,3 +162,41 @@ func (g *generator) addEnumPathParamImports(file *descriptor.File, m *descriptor } return imports } + +// addBodyFieldImports ensures nested body message types pull in their Go packages. +func (g *generator) addBodyFieldImports( + file *descriptor.File, + m *descriptor.Method, + pkgSeen map[string]bool, +) []descriptor.GoPackage { + if g.reg == nil { + return nil + } + + imports := make([]descriptor.GoPackage, 0, len(m.Bindings)) + for _, b := range m.Bindings { + if b.Body == nil || len(b.Body.FieldPath) == 0 { + continue + } + + target := b.Body.FieldPath[len(b.Body.FieldPath)-1].Target + if target == nil || target.GetTypeName() == "" || target.Message == nil { + continue + } + + msg, err := g.reg.LookupMsg(target.Message.FQMN(), target.GetTypeName()) + if err != nil { + continue + } + + pkg := msg.File.GoPkg + if pkg == file.GoPkg || pkgSeen[pkg.Path] { + continue + } + + pkgSeen[pkg.Path] = true + imports = append(imports, pkg) + } + + return imports +} From 9500065404d780a7c746efad4c70478d8cf41afe Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Mon, 26 Jan 2026 14:33:53 -0500 Subject: [PATCH 11/18] cleanup(proto): remove unused proto, fix import order, and update dependencies --- examples/internal/proto/examplepb/BUILD.bazel | 4 +++- examples/internal/proto/examplepb/camel_case_service.proto | 6 ++---- examples/internal/proto/examplepb/opaque_body_import.proto | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/internal/proto/examplepb/BUILD.bazel b/examples/internal/proto/examplepb/BUILD.bazel index 0d1107386da..ede36cf0f68 100644 --- a/examples/internal/proto/examplepb/BUILD.bazel +++ b/examples/internal/proto/examplepb/BUILD.bazel @@ -56,7 +56,6 @@ proto_library( name = "examplepb_proto", srcs = [ "a_bit_of_everything.proto", - "camel_case_message.proto", "camel_case_service.proto", "echo_service.proto", "enum_with_single_value.proto", @@ -169,6 +168,8 @@ go_proto_library( go_library( name = "examplepb", srcs = [ + "camel_case_service.pb.gw.go", + "opaque_body_import.pb.gw.go", "openapi_merge_a.pb.go", "openapi_merge_a.pb.gw.go", "openapi_merge_a_grpc.pb.go", @@ -182,6 +183,7 @@ go_library( ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb", deps = [ + "//examples/internal/proto/sub", "//runtime", "//utilities", "@org_golang_google_genproto_googleapis_api//annotations", diff --git a/examples/internal/proto/examplepb/camel_case_service.proto b/examples/internal/proto/examplepb/camel_case_service.proto index c8a14a9c0c2..bfd7e53d9b6 100644 --- a/examples/internal/proto/examplepb/camel_case_service.proto +++ b/examples/internal/proto/examplepb/camel_case_service.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; -import "google/api/annotations.proto"; import "examples/internal/proto/sub/camel_case_message.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; @@ -12,9 +12,7 @@ option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal // when service and RPC names are snake_case. service Camel_Case_service { rpc Get_status(GetStatusRequest) returns (GetStatusResponse) { - option (google.api.http) = { - get: "/v1/camel_case/{state}" - }; + option (google.api.http) = {get: "/v1/camel_case/{state}"}; } rpc Post_Book(PostBookRequest) returns (PostBookResponse) { diff --git a/examples/internal/proto/examplepb/opaque_body_import.proto b/examples/internal/proto/examplepb/opaque_body_import.proto index 551054b553d..3b894fe0e9f 100644 --- a/examples/internal/proto/examplepb/opaque_body_import.proto +++ b/examples/internal/proto/examplepb/opaque_body_import.proto @@ -2,8 +2,8 @@ edition = "2023"; package grpc.gateway.examples.internal.proto.examplepb; -import "google/api/annotations.proto"; import "examples/internal/proto/sub/camel_case_message.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; From 1781f949263078d84b6c45781b75790d82f73ea6 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Mon, 26 Jan 2026 14:43:25 -0500 Subject: [PATCH 12/18] fix(proto): reorder imports in example protos to match Go conventions --- .../proto/examplepb/camel_case_service.pb.go | 12 ++++++------ .../proto/examplepb/opaque_body_import.pb.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/internal/proto/examplepb/camel_case_service.pb.go b/examples/internal/proto/examplepb/camel_case_service.pb.go index b14f3d06c5c..285ea6bcc20 100644 --- a/examples/internal/proto/examplepb/camel_case_service.pb.go +++ b/examples/internal/proto/examplepb/camel_case_service.pb.go @@ -211,12 +211,12 @@ var file_examples_internal_proto_examplepb_camel_case_service_proto_rawDesc = [] 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 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, 0x34, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x63, 0x61, - 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x34, 0x65, 0x78, + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x5f, + 0x63, 0x61, 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 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, 0x22, 0x5f, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, diff --git a/examples/internal/proto/examplepb/opaque_body_import.pb.go b/examples/internal/proto/examplepb/opaque_body_import.pb.go index 99672514df1..23fb5b1b278 100644 --- a/examples/internal/proto/examplepb/opaque_body_import.pb.go +++ b/examples/internal/proto/examplepb/opaque_body_import.pb.go @@ -162,7 +162,7 @@ var File_examples_internal_proto_examplepb_opaque_body_import_proto protoreflect const file_examples_internal_proto_examplepb_opaque_body_import_proto_rawDesc = "" + "\n" + - ":examples/internal/proto/examplepb/opaque_body_import.proto\x12.grpc.gateway.examples.internal.proto.examplepb\x1a\x1cgoogle/api/annotations.proto\x1a4examples/internal/proto/sub/camel_case_message.proto\"d\n" + + ":examples/internal/proto/examplepb/opaque_body_import.proto\x12.grpc.gateway.examples.internal.proto.examplepb\x1a4examples/internal/proto/sub/camel_case_message.proto\x1a\x1cgoogle/api/annotations.proto\"d\n" + "\x17OpaqueCreateBookRequest\x12I\n" + "\x04book\x18\x01 \x01(\v25.grpc.gateway.examples.internal.proto.sub.Create_bookR\x04book\"e\n" + "\x18OpaqueCreateBookResponse\x12I\n" + From 80aca5b449c7da2120c4b899b4edb3c7b0943c80 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Mon, 26 Jan 2026 15:04:18 -0500 Subject: [PATCH 13/18] cleanup(proto): remove unused generated files from example protos --- examples/internal/proto/examplepb/BUILD.bazel | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/internal/proto/examplepb/BUILD.bazel b/examples/internal/proto/examplepb/BUILD.bazel index ede36cf0f68..8cc2401a3df 100644 --- a/examples/internal/proto/examplepb/BUILD.bazel +++ b/examples/internal/proto/examplepb/BUILD.bazel @@ -168,8 +168,6 @@ go_proto_library( go_library( name = "examplepb", srcs = [ - "camel_case_service.pb.gw.go", - "opaque_body_import.pb.gw.go", "openapi_merge_a.pb.go", "openapi_merge_a.pb.gw.go", "openapi_merge_a_grpc.pb.go", From 21c18f22d1a7ca559c445a7af63304bcd8b60b84 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Mon, 26 Jan 2026 15:40:50 -0500 Subject: [PATCH 14/18] cleanup(proto): remove unused opaque_body_import proto files and references --- Makefile | 3 - examples/internal/proto/examplepb/BUILD.bazel | 4 +- .../examplepb/opaque_body_import.buf.gen.yaml | 17 -- .../proto/examplepb/opaque_body_import.pb.go | 213 ------------------ .../examplepb/opaque_body_import.pb.gw.go | 162 ------------- .../proto/examplepb/opaque_body_import.proto | 28 --- .../examplepb/opaque_body_import.swagger.json | 108 --------- .../examplepb/opaque_body_import_grpc.pb.go | 127 ----------- 8 files changed, 2 insertions(+), 660 deletions(-) delete mode 100644 examples/internal/proto/examplepb/opaque_body_import.buf.gen.yaml delete mode 100644 examples/internal/proto/examplepb/opaque_body_import.pb.go delete mode 100644 examples/internal/proto/examplepb/opaque_body_import.pb.gw.go delete mode 100644 examples/internal/proto/examplepb/opaque_body_import.proto delete mode 100644 examples/internal/proto/examplepb/opaque_body_import.swagger.json delete mode 100644 examples/internal/proto/examplepb/opaque_body_import_grpc.pb.go diff --git a/Makefile b/Makefile index 5cbc03385dc..2caf27e1765 100644 --- a/Makefile +++ b/Makefile @@ -154,9 +154,6 @@ proto: buf generate \ --template ./examples/internal/proto/examplepb/opaque.buf.gen.yaml \ --path examples/internal/proto/examplepb/opaque.proto - buf generate \ - --template ./examples/internal/proto/examplepb/opaque_body_import.buf.gen.yaml \ - --path examples/internal/proto/examplepb/opaque_body_import.proto generate: proto $(ECHO_EXAMPLE_SRCS) $(ABE_EXAMPLE_SRCS) $(UNANNOTATED_ECHO_EXAMPLE_SRCS) $(RESPONSE_BODY_EXAMPLE_SRCS) $(GENERATE_UNBOUND_METHODS_EXAMPLE_SRCS) diff --git a/examples/internal/proto/examplepb/BUILD.bazel b/examples/internal/proto/examplepb/BUILD.bazel index 8cc2401a3df..0435b8dd011 100644 --- a/examples/internal/proto/examplepb/BUILD.bazel +++ b/examples/internal/proto/examplepb/BUILD.bazel @@ -9,6 +9,8 @@ package(default_visibility = ["//visibility:public"]) # gazelle:exclude a_bit_of_everything.pb.gw.go # gazelle:exclude a_bit_of_everything_grpc.pb.go +# gazelle:exclude camel_case_service.pb.gw.go +# gazelle:exclude camel_case_service_grpc.pb.go # gazelle:exclude echo_service.pb.gw.go # gazelle:exclude echo_service_grpc.pb.go # gazelle:exclude enum_with_single_value.pb.gw.go @@ -65,7 +67,6 @@ proto_library( "generated_output.proto", "ignore_comment.proto", "non_standard_names.proto", - "opaque_body_import.proto", "remove_internal_comment.proto", "response_body_service.proto", "stream.proto", @@ -181,7 +182,6 @@ go_library( ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb", deps = [ - "//examples/internal/proto/sub", "//runtime", "//utilities", "@org_golang_google_genproto_googleapis_api//annotations", diff --git a/examples/internal/proto/examplepb/opaque_body_import.buf.gen.yaml b/examples/internal/proto/examplepb/opaque_body_import.buf.gen.yaml deleted file mode 100644 index bc4d4ec35a7..00000000000 --- a/examples/internal/proto/examplepb/opaque_body_import.buf.gen.yaml +++ /dev/null @@ -1,17 +0,0 @@ -version: v2 -plugins: - - remote: buf.build/protocolbuffers/go:v1.36.6 - out: . - opt: - - paths=source_relative - - default_api_level=API_OPAQUE - - remote: buf.build/grpc/go:v1.5.1 - out: . - opt: - - paths=source_relative - - require_unimplemented_servers=false - - local: protoc-gen-grpc-gateway - out: . - opt: - - paths=source_relative - - use_opaque_api=true diff --git a/examples/internal/proto/examplepb/opaque_body_import.pb.go b/examples/internal/proto/examplepb/opaque_body_import.pb.go deleted file mode 100644 index 23fb5b1b278..00000000000 --- a/examples/internal/proto/examplepb/opaque_body_import.pb.go +++ /dev/null @@ -1,213 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.6 -// protoc (unknown) -// source: examples/internal/proto/examplepb/opaque_body_import.proto - -package examplepb - -import ( - sub "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - unsafe "unsafe" -) - -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 OpaqueCreateBookRequest struct { - state protoimpl.MessageState `protogen:"opaque.v1"` - xxx_hidden_Book *sub.CreateBook `protobuf:"bytes,1,opt,name=book"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *OpaqueCreateBookRequest) Reset() { - *x = OpaqueCreateBookRequest{} - mi := &file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *OpaqueCreateBookRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OpaqueCreateBookRequest) ProtoMessage() {} - -func (x *OpaqueCreateBookRequest) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -func (x *OpaqueCreateBookRequest) GetBook() *sub.CreateBook { - if x != nil { - return x.xxx_hidden_Book - } - return nil -} - -func (x *OpaqueCreateBookRequest) SetBook(v *sub.CreateBook) { - x.xxx_hidden_Book = v -} - -func (x *OpaqueCreateBookRequest) HasBook() bool { - if x == nil { - return false - } - return x.xxx_hidden_Book != nil -} - -func (x *OpaqueCreateBookRequest) ClearBook() { - x.xxx_hidden_Book = nil -} - -type OpaqueCreateBookRequest_builder struct { - _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. - - Book *sub.CreateBook -} - -func (b0 OpaqueCreateBookRequest_builder) Build() *OpaqueCreateBookRequest { - m0 := &OpaqueCreateBookRequest{} - b, x := &b0, m0 - _, _ = b, x - x.xxx_hidden_Book = b.Book - return m0 -} - -type OpaqueCreateBookResponse struct { - state protoimpl.MessageState `protogen:"opaque.v1"` - xxx_hidden_Book *sub.CreateBook `protobuf:"bytes,1,opt,name=book"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *OpaqueCreateBookResponse) Reset() { - *x = OpaqueCreateBookResponse{} - mi := &file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *OpaqueCreateBookResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OpaqueCreateBookResponse) ProtoMessage() {} - -func (x *OpaqueCreateBookResponse) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -func (x *OpaqueCreateBookResponse) GetBook() *sub.CreateBook { - if x != nil { - return x.xxx_hidden_Book - } - return nil -} - -func (x *OpaqueCreateBookResponse) SetBook(v *sub.CreateBook) { - x.xxx_hidden_Book = v -} - -func (x *OpaqueCreateBookResponse) HasBook() bool { - if x == nil { - return false - } - return x.xxx_hidden_Book != nil -} - -func (x *OpaqueCreateBookResponse) ClearBook() { - x.xxx_hidden_Book = nil -} - -type OpaqueCreateBookResponse_builder struct { - _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. - - Book *sub.CreateBook -} - -func (b0 OpaqueCreateBookResponse_builder) Build() *OpaqueCreateBookResponse { - m0 := &OpaqueCreateBookResponse{} - b, x := &b0, m0 - _, _ = b, x - x.xxx_hidden_Book = b.Book - return m0 -} - -var File_examples_internal_proto_examplepb_opaque_body_import_proto protoreflect.FileDescriptor - -const file_examples_internal_proto_examplepb_opaque_body_import_proto_rawDesc = "" + - "\n" + - ":examples/internal/proto/examplepb/opaque_body_import.proto\x12.grpc.gateway.examples.internal.proto.examplepb\x1a4examples/internal/proto/sub/camel_case_message.proto\x1a\x1cgoogle/api/annotations.proto\"d\n" + - "\x17OpaqueCreateBookRequest\x12I\n" + - "\x04book\x18\x01 \x01(\v25.grpc.gateway.examples.internal.proto.sub.Create_bookR\x04book\"e\n" + - "\x18OpaqueCreateBookResponse\x12I\n" + - "\x04book\x18\x01 \x01(\v25.grpc.gateway.examples.internal.proto.sub.Create_bookR\x04book2\xd4\x01\n" + - "\x11OpaqueBookService\x12\xbe\x01\n" + - "\x10OpaqueCreateBook\x12G.grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookRequest\x1aH.grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookResponse\"\x17\x82\xd3\xe4\x93\x02\x11:\x04book\"\t/v1/booksBMZKgithub.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepbb\beditionsp\xe8\a" - -var file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_examples_internal_proto_examplepb_opaque_body_import_proto_goTypes = []any{ - (*OpaqueCreateBookRequest)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookRequest - (*OpaqueCreateBookResponse)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookResponse - (*sub.CreateBook)(nil), // 2: grpc.gateway.examples.internal.proto.sub.Create_book -} -var file_examples_internal_proto_examplepb_opaque_body_import_proto_depIdxs = []int32{ - 2, // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookRequest.book:type_name -> grpc.gateway.examples.internal.proto.sub.Create_book - 2, // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookResponse.book:type_name -> grpc.gateway.examples.internal.proto.sub.Create_book - 0, // 2: grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService.OpaqueCreateBook:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookRequest - 1, // 3: grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService.OpaqueCreateBook:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateBookResponse - 3, // [3:4] is the sub-list for method output_type - 2, // [2:3] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_examples_internal_proto_examplepb_opaque_body_import_proto_init() } -func file_examples_internal_proto_examplepb_opaque_body_import_proto_init() { - if File_examples_internal_proto_examplepb_opaque_body_import_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_examples_internal_proto_examplepb_opaque_body_import_proto_rawDesc), len(file_examples_internal_proto_examplepb_opaque_body_import_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_examples_internal_proto_examplepb_opaque_body_import_proto_goTypes, - DependencyIndexes: file_examples_internal_proto_examplepb_opaque_body_import_proto_depIdxs, - MessageInfos: file_examples_internal_proto_examplepb_opaque_body_import_proto_msgTypes, - }.Build() - File_examples_internal_proto_examplepb_opaque_body_import_proto = out.File - file_examples_internal_proto_examplepb_opaque_body_import_proto_goTypes = nil - file_examples_internal_proto_examplepb_opaque_body_import_proto_depIdxs = nil -} diff --git a/examples/internal/proto/examplepb/opaque_body_import.pb.gw.go b/examples/internal/proto/examplepb/opaque_body_import.pb.gw.go deleted file mode 100644 index 78dfc6bdb89..00000000000 --- a/examples/internal/proto/examplepb/opaque_body_import.pb.gw.go +++ /dev/null @@ -1,162 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: examples/internal/proto/examplepb/opaque_body_import.proto - -/* -Package examplepb is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package examplepb - -import ( - "context" - "errors" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" - "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" -) - -// Suppress "imported and not used" errors -var ( - _ codes.Code - _ io.Reader - _ status.Status - _ = errors.New - _ = runtime.String - _ = utilities.NewDoubleArray - _ = metadata.Join -) - -func request_OpaqueBookService_OpaqueCreateBook_0(ctx context.Context, marshaler runtime.Marshaler, client OpaqueBookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq OpaqueCreateBookRequest - metadata runtime.ServerMetadata - ) - bodyData := &sub.CreateBook{} - if err := marshaler.NewDecoder(req.Body).Decode(bodyData); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - protoReq.SetBook(bodyData) - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.OpaqueCreateBook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_OpaqueBookService_OpaqueCreateBook_0(ctx context.Context, marshaler runtime.Marshaler, server OpaqueBookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq OpaqueCreateBookRequest - metadata runtime.ServerMetadata - ) - bodyData := &sub.CreateBook{} - if err := marshaler.NewDecoder(req.Body).Decode(bodyData); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - protoReq.SetBook(bodyData) - msg, err := server.OpaqueCreateBook(ctx, &protoReq) - return msg, metadata, err -} - -// RegisterOpaqueBookServiceHandlerServer registers the http handlers for service OpaqueBookService to "mux". -// UnaryRPC :call OpaqueBookServiceServer 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 RegisterOpaqueBookServiceHandlerFromEndpoint instead. -// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. -func RegisterOpaqueBookServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OpaqueBookServiceServer) error { - mux.Handle(http.MethodPost, pattern_OpaqueBookService_OpaqueCreateBook_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) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService/OpaqueCreateBook", runtime.WithHTTPPathPattern("/v1/books")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_OpaqueBookService_OpaqueCreateBook_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_OpaqueBookService_OpaqueCreateBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - return nil -} - -// RegisterOpaqueBookServiceHandlerFromEndpoint is same as RegisterOpaqueBookServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterOpaqueBookServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.NewClient(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - return RegisterOpaqueBookServiceHandler(ctx, mux, conn) -} - -// RegisterOpaqueBookServiceHandler registers the http handlers for service OpaqueBookService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterOpaqueBookServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterOpaqueBookServiceHandlerClient(ctx, mux, NewOpaqueBookServiceClient(conn)) -} - -// RegisterOpaqueBookServiceHandlerClient registers the http handlers for service OpaqueBookService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "OpaqueBookServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "OpaqueBookServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "OpaqueBookServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. -func RegisterOpaqueBookServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OpaqueBookServiceClient) error { - mux.Handle(http.MethodPost, pattern_OpaqueBookService_OpaqueCreateBook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService/OpaqueCreateBook", runtime.WithHTTPPathPattern("/v1/books")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_OpaqueBookService_OpaqueCreateBook_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_OpaqueBookService_OpaqueCreateBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - return nil -} - -var ( - pattern_OpaqueBookService_OpaqueCreateBook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "books"}, "")) -) - -var ( - forward_OpaqueBookService_OpaqueCreateBook_0 = runtime.ForwardResponseMessage -) diff --git a/examples/internal/proto/examplepb/opaque_body_import.proto b/examples/internal/proto/examplepb/opaque_body_import.proto deleted file mode 100644 index 3b894fe0e9f..00000000000 --- a/examples/internal/proto/examplepb/opaque_body_import.proto +++ /dev/null @@ -1,28 +0,0 @@ -edition = "2023"; - -package grpc.gateway.examples.internal.proto.examplepb; - -import "examples/internal/proto/sub/camel_case_message.proto"; -import "google/api/annotations.proto"; - -option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; - -// OpaqueService demonstrates an HTTP binding whose body references a -// message defined in another package (sub.Create_book). This mirrors the -// missing-import scenario that previously broke opaque API builds. -service OpaqueBookService { - rpc OpaqueCreateBook(OpaqueCreateBookRequest) returns (OpaqueCreateBookResponse) { - option (google.api.http) = { - post: "/v1/books" - body: "book" - }; - } -} - -message OpaqueCreateBookRequest { - grpc.gateway.examples.internal.proto.sub.Create_book book = 1; -} - -message OpaqueCreateBookResponse { - grpc.gateway.examples.internal.proto.sub.Create_book book = 1; -} diff --git a/examples/internal/proto/examplepb/opaque_body_import.swagger.json b/examples/internal/proto/examplepb/opaque_body_import.swagger.json deleted file mode 100644 index de423e499dc..00000000000 --- a/examples/internal/proto/examplepb/opaque_body_import.swagger.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "examples/internal/proto/examplepb/opaque_body_import.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "OpaqueBookService" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/v1/books": { - "post": { - "operationId": "OpaqueBookService_OpaqueCreateBook", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/examplepbOpaqueCreateBookResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/googleRpcStatus" - } - } - }, - "parameters": [ - { - "name": "book", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/subCreate_book" - } - } - ], - "tags": [ - "OpaqueBookService" - ] - } - } - }, - "definitions": { - "examplepbOpaqueCreateBookResponse": { - "type": "object", - "properties": { - "book": { - "$ref": "#/definitions/subCreate_book" - } - } - }, - "googleRpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." - }, - "message": { - "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - }, - "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." - } - }, - "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." - } - }, - "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" - }, - "subCreate_book": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "author": { - "type": "string" - } - }, - "description": "Create_book and Status_enum demonstrate snake_case identifiers that need to\nbe resolved to Go camel case when referenced by other packages." - } - } -} diff --git a/examples/internal/proto/examplepb/opaque_body_import_grpc.pb.go b/examples/internal/proto/examplepb/opaque_body_import_grpc.pb.go deleted file mode 100644 index a5bc53af833..00000000000 --- a/examples/internal/proto/examplepb/opaque_body_import_grpc.pb.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc (unknown) -// source: examples/internal/proto/examplepb/opaque_body_import.proto - -package examplepb - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// 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.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - OpaqueBookService_OpaqueCreateBook_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService/OpaqueCreateBook" -) - -// OpaqueBookServiceClient is the client API for OpaqueBookService 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. -// -// OpaqueService demonstrates an HTTP binding whose body references a -// message defined in another package (sub.Create_book). This mirrors the -// missing-import scenario that previously broke opaque API builds. -type OpaqueBookServiceClient interface { - OpaqueCreateBook(ctx context.Context, in *OpaqueCreateBookRequest, opts ...grpc.CallOption) (*OpaqueCreateBookResponse, error) -} - -type opaqueBookServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewOpaqueBookServiceClient(cc grpc.ClientConnInterface) OpaqueBookServiceClient { - return &opaqueBookServiceClient{cc} -} - -func (c *opaqueBookServiceClient) OpaqueCreateBook(ctx context.Context, in *OpaqueCreateBookRequest, opts ...grpc.CallOption) (*OpaqueCreateBookResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(OpaqueCreateBookResponse) - err := c.cc.Invoke(ctx, OpaqueBookService_OpaqueCreateBook_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// OpaqueBookServiceServer is the server API for OpaqueBookService service. -// All implementations should embed UnimplementedOpaqueBookServiceServer -// for forward compatibility. -// -// OpaqueService demonstrates an HTTP binding whose body references a -// message defined in another package (sub.Create_book). This mirrors the -// missing-import scenario that previously broke opaque API builds. -type OpaqueBookServiceServer interface { - OpaqueCreateBook(context.Context, *OpaqueCreateBookRequest) (*OpaqueCreateBookResponse, error) -} - -// UnimplementedOpaqueBookServiceServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedOpaqueBookServiceServer struct{} - -func (UnimplementedOpaqueBookServiceServer) OpaqueCreateBook(context.Context, *OpaqueCreateBookRequest) (*OpaqueCreateBookResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpaqueCreateBook not implemented") -} -func (UnimplementedOpaqueBookServiceServer) testEmbeddedByValue() {} - -// UnsafeOpaqueBookServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to OpaqueBookServiceServer will -// result in compilation errors. -type UnsafeOpaqueBookServiceServer interface { - mustEmbedUnimplementedOpaqueBookServiceServer() -} - -func RegisterOpaqueBookServiceServer(s grpc.ServiceRegistrar, srv OpaqueBookServiceServer) { - // If the following call pancis, it indicates UnimplementedOpaqueBookServiceServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&OpaqueBookService_ServiceDesc, srv) -} - -func _OpaqueBookService_OpaqueCreateBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpaqueCreateBookRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OpaqueBookServiceServer).OpaqueCreateBook(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: OpaqueBookService_OpaqueCreateBook_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OpaqueBookServiceServer).OpaqueCreateBook(ctx, req.(*OpaqueCreateBookRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// OpaqueBookService_ServiceDesc is the grpc.ServiceDesc for OpaqueBookService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var OpaqueBookService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.internal.proto.examplepb.OpaqueBookService", - HandlerType: (*OpaqueBookServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "OpaqueCreateBook", - Handler: _OpaqueBookService_OpaqueCreateBook_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "examples/internal/proto/examplepb/opaque_body_import.proto", -} From b9cfd9ee50887683b6b7a24a9c02540808744b39 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Mon, 26 Jan 2026 15:42:30 -0500 Subject: [PATCH 15/18] feat(proto): add `OpaquePatchProductName` request/response types and update message references - Introduced `OpaquePatchProductNameRequest` and `OpaquePatchProductNameResponse` types to the example proto. - Registered new request/response types in the services and updated references to message indices accordingly. --- .../internal/proto/examplepb/opaque.pb.go | 486 +++++++++++------- .../internal/proto/examplepb/opaque.pb.gw.go | 71 +++ .../internal/proto/examplepb/opaque.proto | 14 + .../proto/examplepb/opaque.swagger.json | 43 ++ .../proto/examplepb/opaque_grpc.pb.go | 38 ++ 5 files changed, 470 insertions(+), 182 deletions(-) diff --git a/examples/internal/proto/examplepb/opaque.pb.go b/examples/internal/proto/examplepb/opaque.pb.go index dae9a3c54ae..e9b24ec6cc1 100644 --- a/examples/internal/proto/examplepb/opaque.pb.go +++ b/examples/internal/proto/examplepb/opaque.pb.go @@ -7,6 +7,7 @@ package examplepb import ( + sub "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -2074,6 +2075,117 @@ func (b0 OpaqueSearchOrdersResponse_builder) Build() *OpaqueSearchOrdersResponse return m0 } +type OpaquePatchProductNameRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_NewName *sub.StringMessage `protobuf:"bytes,1,opt,name=new_name,json=newName"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpaquePatchProductNameRequest) Reset() { + *x = OpaquePatchProductNameRequest{} + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpaquePatchProductNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpaquePatchProductNameRequest) ProtoMessage() {} + +func (x *OpaquePatchProductNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *OpaquePatchProductNameRequest) GetNewName() *sub.StringMessage { + if x != nil { + return x.xxx_hidden_NewName + } + return nil +} + +func (x *OpaquePatchProductNameRequest) SetNewName(v *sub.StringMessage) { + x.xxx_hidden_NewName = v +} + +func (x *OpaquePatchProductNameRequest) HasNewName() bool { + if x == nil { + return false + } + return x.xxx_hidden_NewName != nil +} + +func (x *OpaquePatchProductNameRequest) ClearNewName() { + x.xxx_hidden_NewName = nil +} + +type OpaquePatchProductNameRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + NewName *sub.StringMessage +} + +func (b0 OpaquePatchProductNameRequest_builder) Build() *OpaquePatchProductNameRequest { + m0 := &OpaquePatchProductNameRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_NewName = b.NewName + return m0 +} + +type OpaquePatchProductNameResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpaquePatchProductNameResponse) Reset() { + *x = OpaquePatchProductNameResponse{} + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpaquePatchProductNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpaquePatchProductNameResponse) ProtoMessage() {} + +func (x *OpaquePatchProductNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type OpaquePatchProductNameResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 OpaquePatchProductNameResponse_builder) Build() *OpaquePatchProductNameResponse { + m0 := &OpaquePatchProductNameResponse{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + // OpaqueAddress represents a physical address type OpaqueAddress struct { state protoimpl.MessageState `protogen:"opaque.v1"` @@ -2094,7 +2206,7 @@ type OpaqueAddress struct { func (x *OpaqueAddress) Reset() { *x = OpaqueAddress{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2106,7 +2218,7 @@ func (x *OpaqueAddress) String() string { func (*OpaqueAddress) ProtoMessage() {} func (x *OpaqueAddress) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2405,7 +2517,7 @@ type OpaquePrice struct { func (x *OpaquePrice) Reset() { *x = OpaquePrice{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2417,7 +2529,7 @@ func (x *OpaquePrice) String() string { func (*OpaquePrice) ProtoMessage() {} func (x *OpaquePrice) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2596,7 +2708,7 @@ type OpaqueProductCategory struct { func (x *OpaqueProductCategory) Reset() { *x = OpaqueProductCategory{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2608,7 +2720,7 @@ func (x *OpaqueProductCategory) String() string { func (*OpaqueProductCategory) ProtoMessage() {} func (x *OpaqueProductCategory) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2833,7 +2945,7 @@ type OpaqueProductVariant struct { func (x *OpaqueProductVariant) Reset() { *x = OpaqueProductVariant{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2845,7 +2957,7 @@ func (x *OpaqueProductVariant) String() string { func (*OpaqueProductVariant) ProtoMessage() {} func (x *OpaqueProductVariant) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3195,7 +3307,7 @@ func (b0 OpaqueProductVariant_builder) Build() *OpaqueProductVariant { type case_OpaqueProductVariant_DiscountInfo protoreflect.FieldNumber func (x case_OpaqueProductVariant_DiscountInfo) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21].Descriptor() if x == 0 { return "not set" } @@ -3248,7 +3360,7 @@ type OpaqueProduct struct { func (x *OpaqueProduct) Reset() { *x = OpaqueProduct{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3260,7 +3372,7 @@ func (x *OpaqueProduct) String() string { func (*OpaqueProduct) ProtoMessage() {} func (x *OpaqueProduct) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3818,7 +3930,7 @@ func (b0 OpaqueProduct_builder) Build() *OpaqueProduct { type case_OpaqueProduct_TaxInfo protoreflect.FieldNumber func (x case_OpaqueProduct_TaxInfo) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22].Descriptor() if x == 0 { return "not set" } @@ -3864,7 +3976,7 @@ type OpaqueCustomer struct { func (x *OpaqueCustomer) Reset() { *x = OpaqueCustomer{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3876,7 +3988,7 @@ func (x *OpaqueCustomer) String() string { func (*OpaqueCustomer) ProtoMessage() {} func (x *OpaqueCustomer) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4225,7 +4337,7 @@ type OpaqueOrderItem struct { func (x *OpaqueOrderItem) Reset() { *x = OpaqueOrderItem{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4237,7 +4349,7 @@ func (x *OpaqueOrderItem) String() string { func (*OpaqueOrderItem) ProtoMessage() {} func (x *OpaqueOrderItem) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4532,7 +4644,7 @@ type OpaqueOrder struct { func (x *OpaqueOrder) Reset() { *x = OpaqueOrder{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4544,7 +4656,7 @@ func (x *OpaqueOrder) String() string { func (*OpaqueOrder) ProtoMessage() {} func (x *OpaqueOrder) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5114,7 +5226,7 @@ func (b0 OpaqueOrder_builder) Build() *OpaqueOrder { type case_OpaqueOrder_DiscountApplied protoreflect.FieldNumber func (x case_OpaqueOrder_DiscountApplied) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25].Descriptor() if x == 0 { return "not set" } @@ -5156,7 +5268,7 @@ type OpaqueOrderSummary struct { func (x *OpaqueOrderSummary) Reset() { *x = OpaqueOrderSummary{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5168,7 +5280,7 @@ func (x *OpaqueOrderSummary) String() string { func (*OpaqueOrderSummary) ProtoMessage() {} func (x *OpaqueOrderSummary) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5391,7 +5503,7 @@ type OpaqueCustomerEvent struct { func (x *OpaqueCustomerEvent) Reset() { *x = OpaqueCustomerEvent{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5403,7 +5515,7 @@ func (x *OpaqueCustomerEvent) String() string { func (*OpaqueCustomerEvent) ProtoMessage() {} func (x *OpaqueCustomerEvent) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5836,7 +5948,7 @@ type OpaqueActivityUpdate struct { func (x *OpaqueActivityUpdate) Reset() { *x = OpaqueActivityUpdate{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5848,7 +5960,7 @@ func (x *OpaqueActivityUpdate) String() string { func (*OpaqueActivityUpdate) ProtoMessage() {} func (x *OpaqueActivityUpdate) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6311,7 +6423,7 @@ func (b0 OpaqueActivityUpdate_builder) Build() *OpaqueActivityUpdate { type case_OpaqueActivityUpdate_ActionData protoreflect.FieldNumber func (x case_OpaqueActivityUpdate_ActionData) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[28].Descriptor() if x == 0 { return "not set" } @@ -6349,7 +6461,7 @@ type OpaqueProduct_OpaqueProductDimensions struct { func (x *OpaqueProduct_OpaqueProductDimensions) Reset() { *x = OpaqueProduct_OpaqueProductDimensions{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[32] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6361,7 +6473,7 @@ func (x *OpaqueProduct_OpaqueProductDimensions) String() string { func (*OpaqueProduct_OpaqueProductDimensions) ProtoMessage() {} func (x *OpaqueProduct_OpaqueProductDimensions) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[32] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6545,7 +6657,7 @@ type OpaqueCustomer_OpaqueLoyaltyInfo struct { func (x *OpaqueCustomer_OpaqueLoyaltyInfo) Reset() { *x = OpaqueCustomer_OpaqueLoyaltyInfo{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[33] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6557,7 +6669,7 @@ func (x *OpaqueCustomer_OpaqueLoyaltyInfo) String() string { func (*OpaqueCustomer_OpaqueLoyaltyInfo) ProtoMessage() {} func (x *OpaqueCustomer_OpaqueLoyaltyInfo) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[33] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6694,7 +6806,7 @@ type OpaqueCustomer_OpaquePaymentMethod struct { func (x *OpaqueCustomer_OpaquePaymentMethod) Reset() { *x = OpaqueCustomer_OpaquePaymentMethod{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6706,7 +6818,7 @@ func (x *OpaqueCustomer_OpaquePaymentMethod) String() string { func (*OpaqueCustomer_OpaquePaymentMethod) ProtoMessage() {} func (x *OpaqueCustomer_OpaquePaymentMethod) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[37] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6924,7 +7036,7 @@ type OpaqueOrder_OpaqueShippingInfo struct { func (x *OpaqueOrder_OpaqueShippingInfo) Reset() { *x = OpaqueOrder_OpaqueShippingInfo{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[37] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6936,7 +7048,7 @@ func (x *OpaqueOrder_OpaqueShippingInfo) String() string { func (*OpaqueOrder_OpaqueShippingInfo) ProtoMessage() {} func (x *OpaqueOrder_OpaqueShippingInfo) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[37] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[39] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7073,7 +7185,7 @@ type OpaqueOrderSummary_OpaqueOrderError struct { func (x *OpaqueOrderSummary_OpaqueOrderError) Reset() { *x = OpaqueOrderSummary_OpaqueOrderError{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[40] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7085,7 +7197,7 @@ func (x *OpaqueOrderSummary_OpaqueOrderError) String() string { func (*OpaqueOrderSummary_OpaqueOrderError) ProtoMessage() {} func (x *OpaqueOrderSummary_OpaqueOrderError) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[40] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[42] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7208,7 +7320,7 @@ var File_examples_internal_proto_examplepb_opaque_proto protoreflect.FileDescrip const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "\n" + - ".examples/internal/proto/examplepb/opaque.proto\x12.grpc.gateway.examples.internal.proto.examplepb\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xb2\x01\n" + + ".examples/internal/proto/examplepb/opaque.proto\x12.grpc.gateway.examples.internal.proto.examplepb\x1a)examples/internal/proto/sub/message.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xb2\x01\n" + "\x1aOpaqueUpdateProductRequest\x12W\n" + "\aproduct\x18\x01 \x01(\v2=.grpc.gateway.examples.internal.proto.examplepb.OpaqueProductR\aproduct\x12;\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" + @@ -7276,7 +7388,10 @@ const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "\x19OpaqueSearchOrdersRequest\x12Q\n" + "\x05order\x18\x01 \x01(\v2;.grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderR\x05order\"q\n" + "\x1aOpaqueSearchOrdersResponse\x12S\n" + - "\x06orders\x18\x01 \x03(\v2;.grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderR\x06orders\"\xd4\x05\n" + + "\x06orders\x18\x01 \x03(\v2;.grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderR\x06orders\"s\n" + + "\x1dOpaquePatchProductNameRequest\x12R\n" + + "\bnew_name\x18\x01 \x01(\v27.grpc.gateway.examples.internal.proto.sub.StringMessageR\anewName\" \n" + + "\x1eOpaquePatchProductNameResponse\"\xd4\x05\n" + "\rOpaqueAddress\x12!\n" + "\fstreet_line1\x18\x01 \x01(\tR\vstreetLine1\x12!\n" + "\fstreet_line2\x18\x02 \x01(\tR\vstreetLine2\x12\x12\n" + @@ -7585,7 +7700,7 @@ const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "#OPAQUE_UPDATE_TYPE_INVENTORY_UPDATE\x10\x04\x12#\n" + "\x1fOPAQUE_UPDATE_TYPE_PRICE_CHANGE\x10\x05\x12$\n" + " OPAQUE_UPDATE_TYPE_CART_REMINDER\x10\x06B\r\n" + - "\vaction_data2\xb1\x0e\n" + + "\vaction_data2\x8f\x10\n" + "\x16OpaqueEcommerceService\x12\xc8\x01\n" + "\x10OpaqueGetProduct\x12G.grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductRequest\x1aH.grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse\"!\x82\xd3\xe4\x93\x02\x1b\x12\x19/v1/products/{product_id}\x12\xd0\x01\n" + "\x14OpaqueSearchProducts\x12K.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest\x1aL.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/v1/products/search0\x01\x12\xc7\x01\n" + @@ -7594,10 +7709,11 @@ const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "\x13OpaqueProcessOrders\x12J.grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest\x1aK.grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/v1/orders/process(\x01\x12\xef\x01\n" + "\x1cOpaqueStreamCustomerActivity\x12S.grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest\x1aT.grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/v1/customer/activity(\x010\x01\x12\xf8\x01\n" + "\x13OpaqueUpdateProduct\x12J.grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest\x1aK.grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse\"H\xdaA\x13product,update_mask\x82\xd3\xe4\x93\x02,:\aproduct2!/v1/products/{product.product_id}\x12\x8b\x02\n" + - "\x12OpaqueSearchOrders\x12I.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest\x1aJ.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse\"^\x82\xd3\xe4\x93\x02X\x12V/v1/orders/search/{order.status}/shipAddressType/{order.shipping_address.address_type}BMZKgithub.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepbb\beditionsp\xe8\a" + "\x12OpaqueSearchOrders\x12I.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest\x1aJ.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse\"^\x82\xd3\xe4\x93\x02X\x12V/v1/orders/search/{order.status}/shipAddressType/{order.shipping_address.address_type}\x12\xdb\x01\n" + + "\x16OpaquePatchProductName\x12M.grpc.gateway.examples.internal.proto.examplepb.OpaquePatchProductNameRequest\x1aN.grpc.gateway.examples.internal.proto.examplepb.OpaquePatchProductNameResponse\"\"\x82\xd3\xe4\x93\x02\x1c:\bnew_name2\x10/v1/product_nameBMZKgithub.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepbb\beditionsp\xe8\a" var file_examples_internal_proto_examplepb_opaque_proto_enumTypes = make([]protoimpl.EnumInfo, 8) -var file_examples_internal_proto_examplepb_opaque_proto_msgTypes = make([]protoimpl.MessageInfo, 43) +var file_examples_internal_proto_examplepb_opaque_proto_msgTypes = make([]protoimpl.MessageInfo, 45) var file_examples_internal_proto_examplepb_opaque_proto_goTypes = []any{ (OpaqueSearchProductsRequest_OpaqueSortOrder)(0), // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.OpaqueSortOrder (OpaqueAddress_OpaqueAddressType)(0), // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.OpaqueAddressType @@ -7623,145 +7739,151 @@ var file_examples_internal_proto_examplepb_opaque_proto_goTypes = []any{ (*OpaqueStreamCustomerActivityResponse)(nil), // 21: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse (*OpaqueSearchOrdersRequest)(nil), // 22: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest (*OpaqueSearchOrdersResponse)(nil), // 23: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse - (*OpaqueAddress)(nil), // 24: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - (*OpaquePrice)(nil), // 25: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - (*OpaqueProductCategory)(nil), // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory - (*OpaqueProductVariant)(nil), // 27: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant - (*OpaqueProduct)(nil), // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - (*OpaqueCustomer)(nil), // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer - (*OpaqueOrderItem)(nil), // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem - (*OpaqueOrder)(nil), // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder - (*OpaqueOrderSummary)(nil), // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary - (*OpaqueCustomerEvent)(nil), // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent - (*OpaqueActivityUpdate)(nil), // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate - nil, // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry - nil, // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry - nil, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry - nil, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry - nil, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry - (*OpaqueProduct_OpaqueProductDimensions)(nil), // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions - (*OpaqueCustomer_OpaqueLoyaltyInfo)(nil), // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo - nil, // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry - (*OpaqueCustomer_OpaquePaymentMethod)(nil), // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod - nil, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry - (*OpaqueOrder_OpaqueShippingInfo)(nil), // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo - nil, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry - nil, // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry - (*OpaqueOrderSummary_OpaqueOrderError)(nil), // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError - nil, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry - nil, // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry - (*fieldmaskpb.FieldMask)(nil), // 51: google.protobuf.FieldMask - (*wrapperspb.BoolValue)(nil), // 52: google.protobuf.BoolValue - (*wrapperspb.DoubleValue)(nil), // 53: google.protobuf.DoubleValue - (*timestamppb.Timestamp)(nil), // 54: google.protobuf.Timestamp - (*durationpb.Duration)(nil), // 55: google.protobuf.Duration + (*OpaquePatchProductNameRequest)(nil), // 24: grpc.gateway.examples.internal.proto.examplepb.OpaquePatchProductNameRequest + (*OpaquePatchProductNameResponse)(nil), // 25: grpc.gateway.examples.internal.proto.examplepb.OpaquePatchProductNameResponse + (*OpaqueAddress)(nil), // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + (*OpaquePrice)(nil), // 27: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + (*OpaqueProductCategory)(nil), // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory + (*OpaqueProductVariant)(nil), // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant + (*OpaqueProduct)(nil), // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + (*OpaqueCustomer)(nil), // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer + (*OpaqueOrderItem)(nil), // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem + (*OpaqueOrder)(nil), // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + (*OpaqueOrderSummary)(nil), // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary + (*OpaqueCustomerEvent)(nil), // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent + (*OpaqueActivityUpdate)(nil), // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate + nil, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry + nil, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry + nil, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry + nil, // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry + nil, // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry + (*OpaqueProduct_OpaqueProductDimensions)(nil), // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions + (*OpaqueCustomer_OpaqueLoyaltyInfo)(nil), // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo + nil, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry + (*OpaqueCustomer_OpaquePaymentMethod)(nil), // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod + nil, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry + (*OpaqueOrder_OpaqueShippingInfo)(nil), // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo + nil, // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry + nil, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry + (*OpaqueOrderSummary_OpaqueOrderError)(nil), // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError + nil, // 51: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry + nil, // 52: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry + (*fieldmaskpb.FieldMask)(nil), // 53: google.protobuf.FieldMask + (*sub.StringMessage)(nil), // 54: grpc.gateway.examples.internal.proto.sub.StringMessage + (*wrapperspb.BoolValue)(nil), // 55: google.protobuf.BoolValue + (*wrapperspb.DoubleValue)(nil), // 56: google.protobuf.DoubleValue + (*timestamppb.Timestamp)(nil), // 57: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 58: google.protobuf.Duration } var file_examples_internal_proto_examplepb_opaque_proto_depIdxs = []int32{ - 28, // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 51, // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.update_mask:type_name -> google.protobuf.FieldMask - 28, // 2: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 28, // 3: grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 25, // 4: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.min_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 25, // 5: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.max_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 30, // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 53, // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.update_mask:type_name -> google.protobuf.FieldMask + 30, // 2: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 30, // 3: grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 27, // 4: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.min_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 27, // 5: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.max_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice 0, // 6: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.sort_by:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.OpaqueSortOrder - 51, // 7: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.field_mask:type_name -> google.protobuf.FieldMask - 35, // 8: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.filters:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry - 28, // 9: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 28, // 10: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 28, // 11: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 28, // 12: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 28, // 13: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 31, // 14: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder - 32, // 15: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse.summary:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary - 33, // 16: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent - 34, // 17: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate - 31, // 18: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder - 31, // 19: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse.orders:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder - 1, // 20: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.address_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.OpaqueAddressType - 52, // 21: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.is_default:type_name -> google.protobuf.BoolValue - 36, // 22: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry - 53, // 23: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.original_amount:type_name -> google.protobuf.DoubleValue - 54, // 24: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.price_valid_until:type_name -> google.protobuf.Timestamp - 26, // 25: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.parent_category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory - 54, // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.created_at:type_name -> google.protobuf.Timestamp - 54, // 27: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.updated_at:type_name -> google.protobuf.Timestamp - 25, // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 37, // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry - 52, // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.is_available:type_name -> google.protobuf.BoolValue - 25, // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.base_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 26, // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory - 27, // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.variants:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant - 52, // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.is_featured:type_name -> google.protobuf.BoolValue - 54, // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.created_at:type_name -> google.protobuf.Timestamp - 54, // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.updated_at:type_name -> google.protobuf.Timestamp - 55, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.average_shipping_time:type_name -> google.protobuf.Duration - 2, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductStatus - 38, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry - 39, // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.regional_prices:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry - 40, // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.dimensions:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions - 24, // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.addresses:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - 54, // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.created_at:type_name -> google.protobuf.Timestamp - 54, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.last_login:type_name -> google.protobuf.Timestamp - 4, // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueCustomerStatus - 41, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.loyalty_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo - 42, // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.preferences:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry - 43, // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.payment_methods:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod - 25, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.unit_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 25, // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.total_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 44, // 51: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.selected_attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry - 52, // 52: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.gift_wrapped:type_name -> google.protobuf.BoolValue - 30, // 53: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.items:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem - 25, // 54: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.subtotal:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 25, // 55: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.tax:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 25, // 56: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 25, // 57: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.total:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 24, // 58: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - 24, // 59: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.billing_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - 5, // 60: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueOrderStatus - 54, // 61: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.created_at:type_name -> google.protobuf.Timestamp - 54, // 62: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.updated_at:type_name -> google.protobuf.Timestamp - 54, // 63: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipped_at:type_name -> google.protobuf.Timestamp - 54, // 64: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.delivered_at:type_name -> google.protobuf.Timestamp - 45, // 65: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo - 46, // 66: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry - 25, // 67: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.total_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 47, // 68: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.error_details:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry - 54, // 69: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.processing_time:type_name -> google.protobuf.Timestamp - 48, // 70: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.errors:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError - 6, // 71: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.OpaqueEventType - 54, // 72: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.timestamp:type_name -> google.protobuf.Timestamp - 49, // 73: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry - 7, // 74: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.OpaqueUpdateType - 54, // 75: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.timestamp:type_name -> google.protobuf.Timestamp - 25, // 76: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.price_update:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 55, // 77: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.offer_expiry:type_name -> google.protobuf.Duration - 50, // 78: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry - 25, // 79: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry.value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 3, // 80: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.unit:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.OpaqueUnit - 54, // 81: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo.tier_expiry:type_name -> google.protobuf.Timestamp - 54, // 82: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod.expires_at:type_name -> google.protobuf.Timestamp - 55, // 83: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo.estimated_delivery_time:type_name -> google.protobuf.Duration - 10, // 84: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductRequest - 12, // 85: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest - 14, // 86: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest - 16, // 87: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest - 18, // 88: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest - 20, // 89: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest - 8, // 90: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest - 22, // 91: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest - 11, // 92: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse - 13, // 93: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse - 15, // 94: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse - 17, // 95: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse - 19, // 96: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse - 21, // 97: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse - 9, // 98: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse - 23, // 99: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse - 92, // [92:100] is the sub-list for method output_type - 84, // [84:92] is the sub-list for method input_type - 84, // [84:84] is the sub-list for extension type_name - 84, // [84:84] is the sub-list for extension extendee - 0, // [0:84] is the sub-list for field type_name + 53, // 7: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.field_mask:type_name -> google.protobuf.FieldMask + 37, // 8: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.filters:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry + 30, // 9: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 30, // 10: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 30, // 11: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 30, // 12: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 30, // 13: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 33, // 14: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + 34, // 15: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse.summary:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary + 35, // 16: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent + 36, // 17: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate + 33, // 18: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + 33, // 19: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse.orders:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + 54, // 20: grpc.gateway.examples.internal.proto.examplepb.OpaquePatchProductNameRequest.new_name:type_name -> grpc.gateway.examples.internal.proto.sub.StringMessage + 1, // 21: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.address_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.OpaqueAddressType + 55, // 22: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.is_default:type_name -> google.protobuf.BoolValue + 38, // 23: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry + 56, // 24: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.original_amount:type_name -> google.protobuf.DoubleValue + 57, // 25: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.price_valid_until:type_name -> google.protobuf.Timestamp + 28, // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.parent_category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory + 57, // 27: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.created_at:type_name -> google.protobuf.Timestamp + 57, // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.updated_at:type_name -> google.protobuf.Timestamp + 27, // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 39, // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry + 55, // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.is_available:type_name -> google.protobuf.BoolValue + 27, // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.base_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 28, // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory + 29, // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.variants:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant + 55, // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.is_featured:type_name -> google.protobuf.BoolValue + 57, // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.created_at:type_name -> google.protobuf.Timestamp + 57, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.updated_at:type_name -> google.protobuf.Timestamp + 58, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.average_shipping_time:type_name -> google.protobuf.Duration + 2, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductStatus + 40, // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry + 41, // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.regional_prices:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry + 42, // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.dimensions:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions + 26, // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.addresses:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + 57, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.created_at:type_name -> google.protobuf.Timestamp + 57, // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.last_login:type_name -> google.protobuf.Timestamp + 4, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueCustomerStatus + 43, // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.loyalty_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo + 44, // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.preferences:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry + 45, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.payment_methods:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod + 27, // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.unit_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 27, // 51: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.total_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 46, // 52: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.selected_attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry + 55, // 53: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.gift_wrapped:type_name -> google.protobuf.BoolValue + 32, // 54: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.items:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem + 27, // 55: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.subtotal:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 27, // 56: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.tax:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 27, // 57: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 27, // 58: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.total:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 26, // 59: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + 26, // 60: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.billing_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + 5, // 61: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueOrderStatus + 57, // 62: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.created_at:type_name -> google.protobuf.Timestamp + 57, // 63: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.updated_at:type_name -> google.protobuf.Timestamp + 57, // 64: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipped_at:type_name -> google.protobuf.Timestamp + 57, // 65: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.delivered_at:type_name -> google.protobuf.Timestamp + 47, // 66: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo + 48, // 67: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry + 27, // 68: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.total_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 49, // 69: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.error_details:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry + 57, // 70: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.processing_time:type_name -> google.protobuf.Timestamp + 50, // 71: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.errors:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError + 6, // 72: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.OpaqueEventType + 57, // 73: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.timestamp:type_name -> google.protobuf.Timestamp + 51, // 74: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry + 7, // 75: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.OpaqueUpdateType + 57, // 76: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.timestamp:type_name -> google.protobuf.Timestamp + 27, // 77: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.price_update:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 58, // 78: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.offer_expiry:type_name -> google.protobuf.Duration + 52, // 79: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry + 27, // 80: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry.value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 3, // 81: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.unit:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.OpaqueUnit + 57, // 82: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo.tier_expiry:type_name -> google.protobuf.Timestamp + 57, // 83: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod.expires_at:type_name -> google.protobuf.Timestamp + 58, // 84: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo.estimated_delivery_time:type_name -> google.protobuf.Duration + 10, // 85: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductRequest + 12, // 86: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest + 14, // 87: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest + 16, // 88: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest + 18, // 89: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest + 20, // 90: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest + 8, // 91: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest + 22, // 92: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest + 24, // 93: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaquePatchProductName:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaquePatchProductNameRequest + 11, // 94: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse + 13, // 95: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse + 15, // 96: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse + 17, // 97: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse + 19, // 98: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse + 21, // 99: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse + 9, // 100: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse + 23, // 101: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse + 25, // 102: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaquePatchProductName:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaquePatchProductNameResponse + 94, // [94:103] is the sub-list for method output_type + 85, // [85:94] is the sub-list for method input_type + 85, // [85:85] is the sub-list for extension type_name + 85, // [85:85] is the sub-list for extension extendee + 0, // [0:85] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_opaque_proto_init() } @@ -7769,19 +7891,19 @@ func file_examples_internal_proto_examplepb_opaque_proto_init() { if File_examples_internal_proto_examplepb_opaque_proto != nil { return } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21].OneofWrappers = []any{ (*opaqueProductVariant_PercentageOff)(nil), (*opaqueProductVariant_FixedAmountOff)(nil), } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22].OneofWrappers = []any{ (*opaqueProduct_TaxPercentage)(nil), (*opaqueProduct_TaxExempt)(nil), } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25].OneofWrappers = []any{ (*opaqueOrder_CouponCode)(nil), (*opaqueOrder_PromotionId)(nil), } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[28].OneofWrappers = []any{ (*opaqueActivityUpdate_RedirectUrl)(nil), (*opaqueActivityUpdate_NotificationId)(nil), } @@ -7791,7 +7913,7 @@ func file_examples_internal_proto_examplepb_opaque_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_examples_internal_proto_examplepb_opaque_proto_rawDesc), len(file_examples_internal_proto_examplepb_opaque_proto_rawDesc)), NumEnums: 8, - NumMessages: 43, + NumMessages: 45, NumExtensions: 0, NumServices: 1, }, diff --git a/examples/internal/proto/examplepb/opaque.pb.gw.go b/examples/internal/proto/examplepb/opaque.pb.gw.go index 046989e905c..85587d37c90 100644 --- a/examples/internal/proto/examplepb/opaque.pb.gw.go +++ b/examples/internal/proto/examplepb/opaque.pb.gw.go @@ -14,6 +14,7 @@ import ( "io" "net/http" + "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" @@ -454,6 +455,37 @@ func local_request_OpaqueEcommerceService_OpaqueSearchOrders_0(ctx context.Conte return msg, metadata, err } +func request_OpaqueEcommerceService_OpaquePatchProductName_0(ctx context.Context, marshaler runtime.Marshaler, client OpaqueEcommerceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq OpaquePatchProductNameRequest + metadata runtime.ServerMetadata + ) + bodyData := &sub.StringMessage{} + if err := marshaler.NewDecoder(req.Body).Decode(bodyData); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + protoReq.SetNewName(bodyData) + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.OpaquePatchProductName(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_OpaqueEcommerceService_OpaquePatchProductName_0(ctx context.Context, marshaler runtime.Marshaler, server OpaqueEcommerceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq OpaquePatchProductNameRequest + metadata runtime.ServerMetadata + ) + bodyData := &sub.StringMessage{} + if err := marshaler.NewDecoder(req.Body).Decode(bodyData); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + protoReq.SetNewName(bodyData) + msg, err := server.OpaquePatchProductName(ctx, &protoReq) + return msg, metadata, err +} + // RegisterOpaqueEcommerceServiceHandlerServer registers the http handlers for service OpaqueEcommerceService to "mux". // UnaryRPC :call OpaqueEcommerceServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -581,6 +613,26 @@ func RegisterOpaqueEcommerceServiceHandlerServer(ctx context.Context, mux *runti } forward_OpaqueEcommerceService_OpaqueSearchOrders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPatch, pattern_OpaqueEcommerceService_OpaquePatchProductName_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) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaquePatchProductName", runtime.WithHTTPPathPattern("/v1/product_name")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_OpaqueEcommerceService_OpaquePatchProductName_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_OpaqueEcommerceService_OpaquePatchProductName_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -757,6 +809,23 @@ func RegisterOpaqueEcommerceServiceHandlerClient(ctx context.Context, mux *runti } forward_OpaqueEcommerceService_OpaqueSearchOrders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPatch, pattern_OpaqueEcommerceService_OpaquePatchProductName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaquePatchProductName", runtime.WithHTTPPathPattern("/v1/product_name")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_OpaqueEcommerceService_OpaquePatchProductName_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_OpaqueEcommerceService_OpaquePatchProductName_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -769,6 +838,7 @@ var ( pattern_OpaqueEcommerceService_OpaqueStreamCustomerActivity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "customer", "activity"}, "")) pattern_OpaqueEcommerceService_OpaqueUpdateProduct_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "products", "product.product_id"}, "")) pattern_OpaqueEcommerceService_OpaqueSearchOrders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "orders", "search", "order.status", "shipAddressType", "order.shipping_address.address_type"}, "")) + pattern_OpaqueEcommerceService_OpaquePatchProductName_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "product_name"}, "")) ) var ( @@ -780,4 +850,5 @@ var ( forward_OpaqueEcommerceService_OpaqueStreamCustomerActivity_0 = runtime.ForwardResponseStream forward_OpaqueEcommerceService_OpaqueUpdateProduct_0 = runtime.ForwardResponseMessage forward_OpaqueEcommerceService_OpaqueSearchOrders_0 = runtime.ForwardResponseMessage + forward_OpaqueEcommerceService_OpaquePatchProductName_0 = runtime.ForwardResponseMessage ) diff --git a/examples/internal/proto/examplepb/opaque.proto b/examples/internal/proto/examplepb/opaque.proto index 535ef956323..f4427a6de78 100644 --- a/examples/internal/proto/examplepb/opaque.proto +++ b/examples/internal/proto/examplepb/opaque.proto @@ -2,6 +2,7 @@ edition = "2023"; package grpc.gateway.examples.internal.proto.examplepb; +import "examples/internal/proto/sub/message.proto"; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/protobuf/duration.proto"; @@ -75,6 +76,13 @@ service OpaqueEcommerceService { rpc OpaqueSearchOrders(OpaqueSearchOrdersRequest) returns (OpaqueSearchOrdersResponse) { option (google.api.http) = {get: "/v1/orders/search/{order.status}/shipAddressType/{order.shipping_address.address_type}"}; } + + rpc OpaquePatchProductName(OpaquePatchProductNameRequest) returns (OpaquePatchProductNameResponse) { + option (google.api.http) = { + patch: "/v1/product_name" + body: "new_name" + }; + } } // OpaqueUpdateProductRequest represents a request to update a product @@ -187,6 +195,12 @@ message OpaqueSearchOrdersResponse { repeated OpaqueOrder orders = 1; } +message OpaquePatchProductNameRequest { + grpc.gateway.examples.internal.proto.sub.StringMessage new_name = 1; +} + +message OpaquePatchProductNameResponse {} + // OpaqueAddress represents a physical address message OpaqueAddress { string street_line1 = 1; diff --git a/examples/internal/proto/examplepb/opaque.swagger.json b/examples/internal/proto/examplepb/opaque.swagger.json index dfacb9cfe88..02fc8afd42b 100644 --- a/examples/internal/proto/examplepb/opaque.swagger.json +++ b/examples/internal/proto/examplepb/opaque.swagger.json @@ -472,6 +472,38 @@ ] } }, + "/v1/product_name": { + "patch": { + "operationId": "OpaqueEcommerceService_OpaquePatchProductName", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbOpaquePatchProductNameResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googleRpcStatus" + } + } + }, + "parameters": [ + { + "name": "newName", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/subStringMessage" + } + } + ], + "tags": [ + "OpaqueEcommerceService" + ] + } + }, "/v1/products": { "post": { "summary": "OpaqueCreateProduct - Unary request with body field, unary response\nCreates a new product with the product details in the body", @@ -1396,6 +1428,9 @@ }, "title": "OpaqueOrderSummary represents a summary of processed orders" }, + "examplepbOpaquePatchProductNameResponse": { + "type": "object" + }, "examplepbOpaquePrice": { "type": "object", "properties": { @@ -1685,6 +1720,14 @@ }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "subStringMessage": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + } } } } diff --git a/examples/internal/proto/examplepb/opaque_grpc.pb.go b/examples/internal/proto/examplepb/opaque_grpc.pb.go index 397d83e1cbc..52a3b21a95f 100644 --- a/examples/internal/proto/examplepb/opaque_grpc.pb.go +++ b/examples/internal/proto/examplepb/opaque_grpc.pb.go @@ -27,6 +27,7 @@ const ( OpaqueEcommerceService_OpaqueStreamCustomerActivity_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueStreamCustomerActivity" OpaqueEcommerceService_OpaqueUpdateProduct_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueUpdateProduct" OpaqueEcommerceService_OpaqueSearchOrders_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueSearchOrders" + OpaqueEcommerceService_OpaquePatchProductName_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaquePatchProductName" ) // OpaqueEcommerceServiceClient is the client API for OpaqueEcommerceService service. @@ -58,6 +59,7 @@ type OpaqueEcommerceServiceClient interface { // OpaqueSearchOrders - Unary request, unary response // Uses enum params (both top level and nested) to populate fields to test opaque get chain OpaqueSearchOrders(ctx context.Context, in *OpaqueSearchOrdersRequest, opts ...grpc.CallOption) (*OpaqueSearchOrdersResponse, error) + OpaquePatchProductName(ctx context.Context, in *OpaquePatchProductNameRequest, opts ...grpc.CallOption) (*OpaquePatchProductNameResponse, error) } type opaqueEcommerceServiceClient struct { @@ -163,6 +165,16 @@ func (c *opaqueEcommerceServiceClient) OpaqueSearchOrders(ctx context.Context, i return out, nil } +func (c *opaqueEcommerceServiceClient) OpaquePatchProductName(ctx context.Context, in *OpaquePatchProductNameRequest, opts ...grpc.CallOption) (*OpaquePatchProductNameResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(OpaquePatchProductNameResponse) + err := c.cc.Invoke(ctx, OpaqueEcommerceService_OpaquePatchProductName_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // OpaqueEcommerceServiceServer is the server API for OpaqueEcommerceService service. // All implementations should embed UnimplementedOpaqueEcommerceServiceServer // for forward compatibility. @@ -192,6 +204,7 @@ type OpaqueEcommerceServiceServer interface { // OpaqueSearchOrders - Unary request, unary response // Uses enum params (both top level and nested) to populate fields to test opaque get chain OpaqueSearchOrders(context.Context, *OpaqueSearchOrdersRequest) (*OpaqueSearchOrdersResponse, error) + OpaquePatchProductName(context.Context, *OpaquePatchProductNameRequest) (*OpaquePatchProductNameResponse, error) } // UnimplementedOpaqueEcommerceServiceServer should be embedded to have @@ -225,6 +238,9 @@ func (UnimplementedOpaqueEcommerceServiceServer) OpaqueUpdateProduct(context.Con func (UnimplementedOpaqueEcommerceServiceServer) OpaqueSearchOrders(context.Context, *OpaqueSearchOrdersRequest) (*OpaqueSearchOrdersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OpaqueSearchOrders not implemented") } +func (UnimplementedOpaqueEcommerceServiceServer) OpaquePatchProductName(context.Context, *OpaquePatchProductNameRequest) (*OpaquePatchProductNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpaquePatchProductName not implemented") +} func (UnimplementedOpaqueEcommerceServiceServer) testEmbeddedByValue() {} // UnsafeOpaqueEcommerceServiceServer may be embedded to opt out of forward compatibility for this service. @@ -360,6 +376,24 @@ func _OpaqueEcommerceService_OpaqueSearchOrders_Handler(srv interface{}, ctx con return interceptor(ctx, in, info, handler) } +func _OpaqueEcommerceService_OpaquePatchProductName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpaquePatchProductNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OpaqueEcommerceServiceServer).OpaquePatchProductName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OpaqueEcommerceService_OpaquePatchProductName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OpaqueEcommerceServiceServer).OpaquePatchProductName(ctx, req.(*OpaquePatchProductNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + // OpaqueEcommerceService_ServiceDesc is the grpc.ServiceDesc for OpaqueEcommerceService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -387,6 +421,10 @@ var OpaqueEcommerceService_ServiceDesc = grpc.ServiceDesc{ MethodName: "OpaqueSearchOrders", Handler: _OpaqueEcommerceService_OpaqueSearchOrders_Handler, }, + { + MethodName: "OpaquePatchProductName", + Handler: _OpaqueEcommerceService_OpaquePatchProductName_Handler, + }, }, Streams: []grpc.StreamDesc{ { From 307b564586a15eb4b8bfb47d16518a79627a11ea Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Mon, 26 Jan 2026 15:45:45 -0500 Subject: [PATCH 16/18] Remove unused proto definitions and streamline dependencies This commit deletes the outdated `examplepb/BUILD.bazel` file and eliminates unused proto and Bazel rule definitions. It also updates dependencies in `examplepb_opaque_proto` and `examplepb_opaque_go_proto` to include a missing reference to `sub_proto`, improving build correctness and simplifying the overall setup. --- examples/internal/proto/examplepb/BUILD.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/internal/proto/examplepb/BUILD.bazel b/examples/internal/proto/examplepb/BUILD.bazel index 0435b8dd011..c45a0a07494 100644 --- a/examples/internal/proto/examplepb/BUILD.bazel +++ b/examples/internal/proto/examplepb/BUILD.bazel @@ -102,6 +102,7 @@ proto_library( "opaque.proto", ], deps = [ + "//examples/internal/proto/sub:sub_proto", "@com_google_protobuf//:duration_proto", "@com_google_protobuf//:field_mask_proto", "@com_google_protobuf//:timestamp_proto", @@ -161,6 +162,7 @@ go_proto_library( importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb", proto = ":examplepb_opaque_proto", deps = [ + "//examples/internal/proto/sub", "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@org_golang_google_genproto_googleapis_api//annotations", ], From aac521490fc1dbfcf9b8a7adcb54551fa818d4c9 Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Mon, 26 Jan 2026 16:01:09 -0500 Subject: [PATCH 17/18] cleanup(proto): remove unused `opaque_body_import` references from `buf.yaml` --- buf.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/buf.yaml b/buf.yaml index 3344c9938fa..8d3aa00dfed 100644 --- a/buf.yaml +++ b/buf.yaml @@ -20,7 +20,6 @@ lint: - examples/internal/proto/examplepb/excess_body.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/opaque.proto - - examples/internal/proto/examplepb/opaque_body_import.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto @@ -67,7 +66,6 @@ lint: - examples/internal/proto/examplepb/excess_body.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/opaque.proto - - examples/internal/proto/examplepb/opaque_body_import.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto @@ -102,7 +100,6 @@ lint: - examples/internal/proto/examplepb/excess_body.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/opaque.proto - - examples/internal/proto/examplepb/opaque_body_import.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/examplepb/stream.proto - examples/internal/proto/examplepb/unannotated_echo_service.proto @@ -127,7 +124,6 @@ lint: - examples/internal/proto/examplepb/excess_body.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/opaque.proto - - examples/internal/proto/examplepb/opaque_body_import.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto From 2de59b6e1f547d2f547cab3bf15ca82f3099a26f Mon Sep 17 00:00:00 2001 From: Kellen Miller Date: Fri, 30 Jan 2026 09:44:37 -0500 Subject: [PATCH 18/18] fix(generator): gate opaque body imports [WHY] Non-opaque builds started failing with unused imports after the opaque body fix because we always pulled nested body packages, even when the generated code never referenced them. [WHAT] Only add body-field imports when --use_opaque_api is enabled, add an OpaqueEchoNote example under examplepb/opaque.proto that exercises cross-package opaque bodies, and regenerate the example artifacts. [HOW] Gated addBodyFieldImports, created a registry-backed unit test to cover both modes, and regenerated the opaque example outputs with the latest plugin. [TEST] go test ./... [RISK] Low; generator change scoped to opaque mode plus example updates. --- .../proto/examplepb/camel_case_service.pb.go | 188 ++++--- .../examplepb/camel_case_service.pb.gw.go | 9 +- .../proto/examplepb/camel_case_service.proto | 10 +- .../examplepb/camel_case_service.swagger.json | 24 +- .../internal/proto/examplepb/opaque.pb.go | 515 +++++++++++------- .../internal/proto/examplepb/opaque.pb.gw.go | 71 +++ .../internal/proto/examplepb/opaque.proto | 20 + .../proto/examplepb/opaque.swagger.json | 50 ++ .../proto/examplepb/opaque_grpc.pb.go | 42 ++ .../internal/gengateway/generator.go | 2 +- .../internal/gengateway/generator_test.go | 124 +++++ 11 files changed, 789 insertions(+), 266 deletions(-) diff --git a/examples/internal/proto/examplepb/camel_case_service.pb.go b/examples/internal/proto/examplepb/camel_case_service.pb.go index 285ea6bcc20..94aae2edb7d 100644 --- a/examples/internal/proto/examplepb/camel_case_service.pb.go +++ b/examples/internal/proto/examplepb/camel_case_service.pb.go @@ -22,12 +22,61 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type CamelStatus int32 + +const ( + CamelStatus_CAMEL_STATUS_UNSPECIFIED CamelStatus = 0 + CamelStatus_CAMEL_STATUS_AVAILABLE CamelStatus = 1 + CamelStatus_CAMEL_STATUS_PENDING CamelStatus = 2 +) + +// Enum value maps for CamelStatus. +var ( + CamelStatus_name = map[int32]string{ + 0: "CAMEL_STATUS_UNSPECIFIED", + 1: "CAMEL_STATUS_AVAILABLE", + 2: "CAMEL_STATUS_PENDING", + } + CamelStatus_value = map[string]int32{ + "CAMEL_STATUS_UNSPECIFIED": 0, + "CAMEL_STATUS_AVAILABLE": 1, + "CAMEL_STATUS_PENDING": 2, + } +) + +func (x CamelStatus) Enum() *CamelStatus { + p := new(CamelStatus) + *p = x + return p +} + +func (x CamelStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CamelStatus) Descriptor() protoreflect.EnumDescriptor { + return file_examples_internal_proto_examplepb_camel_case_service_proto_enumTypes[0].Descriptor() +} + +func (CamelStatus) Type() protoreflect.EnumType { + return &file_examples_internal_proto_examplepb_camel_case_service_proto_enumTypes[0] +} + +func (x CamelStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CamelStatus.Descriptor instead. +func (CamelStatus) EnumDescriptor() ([]byte, []int) { + return file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescGZIP(), []int{0} +} + type GetStatusRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - State sub.StatusEnum `protobuf:"varint,1,opt,name=state,proto3,enum=grpc.gateway.examples.internal.proto.sub.StatusEnum" json:"state,omitempty"` + State CamelStatus `protobuf:"varint,1,opt,name=state,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.CamelStatus" json:"state,omitempty"` } func (x *GetStatusRequest) Reset() { @@ -60,11 +109,11 @@ func (*GetStatusRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescGZIP(), []int{0} } -func (x *GetStatusRequest) GetState() sub.StatusEnum { +func (x *GetStatusRequest) GetState() CamelStatus { if x != nil { return x.State } - return sub.StatusEnum(0) + return CamelStatus_CAMEL_STATUS_UNSPECIFIED } type GetStatusResponse struct { @@ -72,7 +121,7 @@ type GetStatusResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - State sub.StatusEnum `protobuf:"varint,1,opt,name=state,proto3,enum=grpc.gateway.examples.internal.proto.sub.StatusEnum" json:"state,omitempty"` + State CamelStatus `protobuf:"varint,1,opt,name=state,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.CamelStatus" json:"state,omitempty"` } func (x *GetStatusResponse) Reset() { @@ -105,11 +154,11 @@ func (*GetStatusResponse) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescGZIP(), []int{1} } -func (x *GetStatusResponse) GetState() sub.StatusEnum { +func (x *GetStatusResponse) GetState() CamelStatus { if x != nil { return x.State } - return sub.StatusEnum(0) + return CamelStatus_CAMEL_STATUS_UNSPECIFIED } type PostBookRequest struct { @@ -217,60 +266,67 @@ var file_examples_internal_proto_examplepb_camel_case_service_proto_rawDesc = [] 0x63, 0x61, 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, - 0x22, 0x5f, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x4b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x22, 0x65, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x51, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x22, 0x60, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, + 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x43, 0x61, 0x6d, 0x65, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x66, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x43, 0x61, 0x6d, + 0x65, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, + 0x5c, 0x0a, 0x0f, 0x50, 0x6f, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x49, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, + 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x5d, 0x0a, + 0x10, 0x50, 0x6f, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x49, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, + 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x2a, 0x61, 0x0a, 0x0b, + 0x43, 0x61, 0x6d, 0x65, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x18, 0x43, + 0x41, 0x4d, 0x45, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x41, 0x4d, + 0x45, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, + 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x41, 0x4d, 0x45, 0x4c, 0x5f, 0x53, + 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x32, + 0xfd, 0x02, 0x0a, 0x12, 0x43, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x43, 0x61, 0x73, 0x65, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb1, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x22, 0x5c, 0x0a, 0x0f, 0x50, 0x6f, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x49, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, - 0x6b, 0x22, 0x5d, 0x0a, 0x10, 0x50, 0x6f, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, - 0x32, 0xfd, 0x02, 0x0a, 0x12, 0x43, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x43, 0x61, 0x73, 0x65, 0x5f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb1, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x5f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, + 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, + 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x18, 0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x63, 0x61, + 0x73, 0x65, 0x2f, 0x7b, 0x73, 0x74, 0x61, 0x74, 0x65, 0x7d, 0x12, 0xb2, 0x01, 0x0a, 0x09, 0x50, + 0x6f, 0x73, 0x74, 0x5f, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x3f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x63, - 0x61, 0x73, 0x65, 0x2f, 0x7b, 0x73, 0x74, 0x61, 0x74, 0x65, 0x7d, 0x12, 0xb2, 0x01, 0x0a, 0x09, - 0x50, 0x6f, 0x73, 0x74, 0x5f, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x3f, 0x2e, 0x67, 0x72, 0x70, 0x63, + 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x42, 0x6f, + 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x42, - 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, - 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, - 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x73, 0x74, - 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x1c, 0x3a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, - 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, - 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x1c, 0x3a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x63, + 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x42, + 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, + 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -285,24 +341,25 @@ func file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescGZIP return file_examples_internal_proto_examplepb_camel_case_service_proto_rawDescData } +var file_examples_internal_proto_examplepb_camel_case_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_examples_internal_proto_examplepb_camel_case_service_proto_goTypes = []any{ - (*GetStatusRequest)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.GetStatusRequest - (*GetStatusResponse)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.GetStatusResponse - (*PostBookRequest)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.PostBookRequest - (*PostBookResponse)(nil), // 3: grpc.gateway.examples.internal.proto.examplepb.PostBookResponse - (sub.StatusEnum)(0), // 4: grpc.gateway.examples.internal.proto.sub.Status_enum + (CamelStatus)(0), // 0: grpc.gateway.examples.internal.proto.examplepb.CamelStatus + (*GetStatusRequest)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.GetStatusRequest + (*GetStatusResponse)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.GetStatusResponse + (*PostBookRequest)(nil), // 3: grpc.gateway.examples.internal.proto.examplepb.PostBookRequest + (*PostBookResponse)(nil), // 4: grpc.gateway.examples.internal.proto.examplepb.PostBookResponse (*sub.CreateBook)(nil), // 5: grpc.gateway.examples.internal.proto.sub.Create_book } var file_examples_internal_proto_examplepb_camel_case_service_proto_depIdxs = []int32{ - 4, // 0: grpc.gateway.examples.internal.proto.examplepb.GetStatusRequest.state:type_name -> grpc.gateway.examples.internal.proto.sub.Status_enum - 4, // 1: grpc.gateway.examples.internal.proto.examplepb.GetStatusResponse.state:type_name -> grpc.gateway.examples.internal.proto.sub.Status_enum + 0, // 0: grpc.gateway.examples.internal.proto.examplepb.GetStatusRequest.state:type_name -> grpc.gateway.examples.internal.proto.examplepb.CamelStatus + 0, // 1: grpc.gateway.examples.internal.proto.examplepb.GetStatusResponse.state:type_name -> grpc.gateway.examples.internal.proto.examplepb.CamelStatus 5, // 2: grpc.gateway.examples.internal.proto.examplepb.PostBookRequest.book:type_name -> grpc.gateway.examples.internal.proto.sub.Create_book 5, // 3: grpc.gateway.examples.internal.proto.examplepb.PostBookResponse.book:type_name -> grpc.gateway.examples.internal.proto.sub.Create_book - 0, // 4: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Get_status:input_type -> grpc.gateway.examples.internal.proto.examplepb.GetStatusRequest - 2, // 5: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Post_Book:input_type -> grpc.gateway.examples.internal.proto.examplepb.PostBookRequest - 1, // 6: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Get_status:output_type -> grpc.gateway.examples.internal.proto.examplepb.GetStatusResponse - 3, // 7: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Post_Book:output_type -> grpc.gateway.examples.internal.proto.examplepb.PostBookResponse + 1, // 4: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Get_status:input_type -> grpc.gateway.examples.internal.proto.examplepb.GetStatusRequest + 3, // 5: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Post_Book:input_type -> grpc.gateway.examples.internal.proto.examplepb.PostBookRequest + 2, // 6: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Get_status:output_type -> grpc.gateway.examples.internal.proto.examplepb.GetStatusResponse + 4, // 7: grpc.gateway.examples.internal.proto.examplepb.Camel_Case_service.Post_Book:output_type -> grpc.gateway.examples.internal.proto.examplepb.PostBookResponse 6, // [6:8] is the sub-list for method output_type 4, // [4:6] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name @@ -320,13 +377,14 @@ func file_examples_internal_proto_examplepb_camel_case_service_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_camel_case_service_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 4, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_camel_case_service_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_camel_case_service_proto_depIdxs, + EnumInfos: file_examples_internal_proto_examplepb_camel_case_service_proto_enumTypes, MessageInfos: file_examples_internal_proto_examplepb_camel_case_service_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_camel_case_service_proto = out.File diff --git a/examples/internal/proto/examplepb/camel_case_service.pb.gw.go b/examples/internal/proto/examplepb/camel_case_service.pb.gw.go index b204a27e9b8..d3a74e97cc1 100644 --- a/examples/internal/proto/examplepb/camel_case_service.pb.gw.go +++ b/examples/internal/proto/examplepb/camel_case_service.pb.gw.go @@ -14,7 +14,6 @@ import ( "io" "net/http" - "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" @@ -50,11 +49,11 @@ func request_Camel_CaseService_GetStatus_0(ctx context.Context, marshaler runtim if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "state") } - e, err = runtime.Enum(val, sub.StatusEnum_value) + e, err = runtime.Enum(val, CamelStatus_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "state", err) } - protoReq.State = sub.StatusEnum(e) + protoReq.State = CamelStatus(e) msg, err := client.GetStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -70,11 +69,11 @@ func local_request_Camel_CaseService_GetStatus_0(ctx context.Context, marshaler if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "state") } - e, err = runtime.Enum(val, sub.StatusEnum_value) + e, err = runtime.Enum(val, CamelStatus_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "state", err) } - protoReq.State = sub.StatusEnum(e) + protoReq.State = CamelStatus(e) msg, err := server.GetStatus(ctx, &protoReq) return msg, metadata, err } diff --git a/examples/internal/proto/examplepb/camel_case_service.proto b/examples/internal/proto/examplepb/camel_case_service.proto index bfd7e53d9b6..f6fa4850278 100644 --- a/examples/internal/proto/examplepb/camel_case_service.proto +++ b/examples/internal/proto/examplepb/camel_case_service.proto @@ -24,11 +24,11 @@ service Camel_Case_service { } message GetStatusRequest { - grpc.gateway.examples.internal.proto.sub.Status_enum state = 1; + CamelStatus state = 1; } message GetStatusResponse { - grpc.gateway.examples.internal.proto.sub.Status_enum state = 1; + CamelStatus state = 1; } message PostBookRequest { @@ -38,3 +38,9 @@ message PostBookRequest { message PostBookResponse { grpc.gateway.examples.internal.proto.sub.Create_book book = 1; } + +enum CamelStatus { + CAMEL_STATUS_UNSPECIFIED = 0; + CAMEL_STATUS_AVAILABLE = 1; + CAMEL_STATUS_PENDING = 2; +} diff --git a/examples/internal/proto/examplepb/camel_case_service.swagger.json b/examples/internal/proto/examplepb/camel_case_service.swagger.json index 28ff90786a7..b2fd5d5ee71 100644 --- a/examples/internal/proto/examplepb/camel_case_service.swagger.json +++ b/examples/internal/proto/examplepb/camel_case_service.swagger.json @@ -72,8 +72,9 @@ "required": true, "type": "string", "enum": [ - "STATUS_ENUM_UNSPECIFIED", - "STATUS_ENUM_AVAILABLE" + "CAMEL_STATUS_UNSPECIFIED", + "CAMEL_STATUS_AVAILABLE", + "CAMEL_STATUS_PENDING" ] } ], @@ -84,11 +85,20 @@ } }, "definitions": { + "examplepbCamelStatus": { + "type": "string", + "enum": [ + "CAMEL_STATUS_UNSPECIFIED", + "CAMEL_STATUS_AVAILABLE", + "CAMEL_STATUS_PENDING" + ], + "default": "CAMEL_STATUS_UNSPECIFIED" + }, "examplepbGetStatusResponse": { "type": "object", "properties": { "state": { - "$ref": "#/definitions/subStatus_enum" + "$ref": "#/definitions/examplepbCamelStatus" } } }, @@ -145,14 +155,6 @@ } }, "description": "Create_book and Status_enum demonstrate snake_case identifiers that need to\nbe resolved to Go camel case when referenced by other packages." - }, - "subStatus_enum": { - "type": "string", - "enum": [ - "STATUS_ENUM_UNSPECIFIED", - "STATUS_ENUM_AVAILABLE" - ], - "default": "STATUS_ENUM_UNSPECIFIED" } } } diff --git a/examples/internal/proto/examplepb/opaque.pb.go b/examples/internal/proto/examplepb/opaque.pb.go index dae9a3c54ae..66fd76be164 100644 --- a/examples/internal/proto/examplepb/opaque.pb.go +++ b/examples/internal/proto/examplepb/opaque.pb.go @@ -7,6 +7,7 @@ package examplepb import ( + sub "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -2074,6 +2075,144 @@ func (b0 OpaqueSearchOrdersResponse_builder) Build() *OpaqueSearchOrdersResponse return m0 } +// OpaqueEchoNoteRequest demonstrates an opaque body that maps to a foreign message. +type OpaqueEchoNoteRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Note *sub.StringMessage `protobuf:"bytes,1,opt,name=note"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpaqueEchoNoteRequest) Reset() { + *x = OpaqueEchoNoteRequest{} + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpaqueEchoNoteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpaqueEchoNoteRequest) ProtoMessage() {} + +func (x *OpaqueEchoNoteRequest) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *OpaqueEchoNoteRequest) GetNote() *sub.StringMessage { + if x != nil { + return x.xxx_hidden_Note + } + return nil +} + +func (x *OpaqueEchoNoteRequest) SetNote(v *sub.StringMessage) { + x.xxx_hidden_Note = v +} + +func (x *OpaqueEchoNoteRequest) HasNote() bool { + if x == nil { + return false + } + return x.xxx_hidden_Note != nil +} + +func (x *OpaqueEchoNoteRequest) ClearNote() { + x.xxx_hidden_Note = nil +} + +type OpaqueEchoNoteRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Note *sub.StringMessage +} + +func (b0 OpaqueEchoNoteRequest_builder) Build() *OpaqueEchoNoteRequest { + m0 := &OpaqueEchoNoteRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Note = b.Note + return m0 +} + +// OpaqueEchoNoteResponse mirrors the request payload for simplicity. +type OpaqueEchoNoteResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Note *sub.StringMessage `protobuf:"bytes,1,opt,name=note"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpaqueEchoNoteResponse) Reset() { + *x = OpaqueEchoNoteResponse{} + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpaqueEchoNoteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpaqueEchoNoteResponse) ProtoMessage() {} + +func (x *OpaqueEchoNoteResponse) ProtoReflect() protoreflect.Message { + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *OpaqueEchoNoteResponse) GetNote() *sub.StringMessage { + if x != nil { + return x.xxx_hidden_Note + } + return nil +} + +func (x *OpaqueEchoNoteResponse) SetNote(v *sub.StringMessage) { + x.xxx_hidden_Note = v +} + +func (x *OpaqueEchoNoteResponse) HasNote() bool { + if x == nil { + return false + } + return x.xxx_hidden_Note != nil +} + +func (x *OpaqueEchoNoteResponse) ClearNote() { + x.xxx_hidden_Note = nil +} + +type OpaqueEchoNoteResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Note *sub.StringMessage +} + +func (b0 OpaqueEchoNoteResponse_builder) Build() *OpaqueEchoNoteResponse { + m0 := &OpaqueEchoNoteResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Note = b.Note + return m0 +} + // OpaqueAddress represents a physical address type OpaqueAddress struct { state protoimpl.MessageState `protogen:"opaque.v1"` @@ -2094,7 +2233,7 @@ type OpaqueAddress struct { func (x *OpaqueAddress) Reset() { *x = OpaqueAddress{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2106,7 +2245,7 @@ func (x *OpaqueAddress) String() string { func (*OpaqueAddress) ProtoMessage() {} func (x *OpaqueAddress) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[16] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2405,7 +2544,7 @@ type OpaquePrice struct { func (x *OpaquePrice) Reset() { *x = OpaquePrice{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2417,7 +2556,7 @@ func (x *OpaquePrice) String() string { func (*OpaquePrice) ProtoMessage() {} func (x *OpaquePrice) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[17] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2596,7 +2735,7 @@ type OpaqueProductCategory struct { func (x *OpaqueProductCategory) Reset() { *x = OpaqueProductCategory{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2608,7 +2747,7 @@ func (x *OpaqueProductCategory) String() string { func (*OpaqueProductCategory) ProtoMessage() {} func (x *OpaqueProductCategory) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[18] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2833,7 +2972,7 @@ type OpaqueProductVariant struct { func (x *OpaqueProductVariant) Reset() { *x = OpaqueProductVariant{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2845,7 +2984,7 @@ func (x *OpaqueProductVariant) String() string { func (*OpaqueProductVariant) ProtoMessage() {} func (x *OpaqueProductVariant) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3195,7 +3334,7 @@ func (b0 OpaqueProductVariant_builder) Build() *OpaqueProductVariant { type case_OpaqueProductVariant_DiscountInfo protoreflect.FieldNumber func (x case_OpaqueProductVariant_DiscountInfo) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21].Descriptor() if x == 0 { return "not set" } @@ -3248,7 +3387,7 @@ type OpaqueProduct struct { func (x *OpaqueProduct) Reset() { *x = OpaqueProduct{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3260,7 +3399,7 @@ func (x *OpaqueProduct) String() string { func (*OpaqueProduct) ProtoMessage() {} func (x *OpaqueProduct) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3818,7 +3957,7 @@ func (b0 OpaqueProduct_builder) Build() *OpaqueProduct { type case_OpaqueProduct_TaxInfo protoreflect.FieldNumber func (x case_OpaqueProduct_TaxInfo) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22].Descriptor() if x == 0 { return "not set" } @@ -3864,7 +4003,7 @@ type OpaqueCustomer struct { func (x *OpaqueCustomer) Reset() { *x = OpaqueCustomer{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3876,7 +4015,7 @@ func (x *OpaqueCustomer) String() string { func (*OpaqueCustomer) ProtoMessage() {} func (x *OpaqueCustomer) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4225,7 +4364,7 @@ type OpaqueOrderItem struct { func (x *OpaqueOrderItem) Reset() { *x = OpaqueOrderItem{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4237,7 +4376,7 @@ func (x *OpaqueOrderItem) String() string { func (*OpaqueOrderItem) ProtoMessage() {} func (x *OpaqueOrderItem) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4532,7 +4671,7 @@ type OpaqueOrder struct { func (x *OpaqueOrder) Reset() { *x = OpaqueOrder{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4544,7 +4683,7 @@ func (x *OpaqueOrder) String() string { func (*OpaqueOrder) ProtoMessage() {} func (x *OpaqueOrder) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5114,7 +5253,7 @@ func (b0 OpaqueOrder_builder) Build() *OpaqueOrder { type case_OpaqueOrder_DiscountApplied protoreflect.FieldNumber func (x case_OpaqueOrder_DiscountApplied) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25].Descriptor() if x == 0 { return "not set" } @@ -5156,7 +5295,7 @@ type OpaqueOrderSummary struct { func (x *OpaqueOrderSummary) Reset() { *x = OpaqueOrderSummary{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5168,7 +5307,7 @@ func (x *OpaqueOrderSummary) String() string { func (*OpaqueOrderSummary) ProtoMessage() {} func (x *OpaqueOrderSummary) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[24] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5391,7 +5530,7 @@ type OpaqueCustomerEvent struct { func (x *OpaqueCustomerEvent) Reset() { *x = OpaqueCustomerEvent{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5403,7 +5542,7 @@ func (x *OpaqueCustomerEvent) String() string { func (*OpaqueCustomerEvent) ProtoMessage() {} func (x *OpaqueCustomerEvent) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5836,7 +5975,7 @@ type OpaqueActivityUpdate struct { func (x *OpaqueActivityUpdate) Reset() { *x = OpaqueActivityUpdate{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5848,7 +5987,7 @@ func (x *OpaqueActivityUpdate) String() string { func (*OpaqueActivityUpdate) ProtoMessage() {} func (x *OpaqueActivityUpdate) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6311,7 +6450,7 @@ func (b0 OpaqueActivityUpdate_builder) Build() *OpaqueActivityUpdate { type case_OpaqueActivityUpdate_ActionData protoreflect.FieldNumber func (x case_OpaqueActivityUpdate_ActionData) String() string { - md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26].Descriptor() + md := file_examples_internal_proto_examplepb_opaque_proto_msgTypes[28].Descriptor() if x == 0 { return "not set" } @@ -6349,7 +6488,7 @@ type OpaqueProduct_OpaqueProductDimensions struct { func (x *OpaqueProduct_OpaqueProductDimensions) Reset() { *x = OpaqueProduct_OpaqueProductDimensions{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[32] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6361,7 +6500,7 @@ func (x *OpaqueProduct_OpaqueProductDimensions) String() string { func (*OpaqueProduct_OpaqueProductDimensions) ProtoMessage() {} func (x *OpaqueProduct_OpaqueProductDimensions) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[32] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6545,7 +6684,7 @@ type OpaqueCustomer_OpaqueLoyaltyInfo struct { func (x *OpaqueCustomer_OpaqueLoyaltyInfo) Reset() { *x = OpaqueCustomer_OpaqueLoyaltyInfo{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[33] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6557,7 +6696,7 @@ func (x *OpaqueCustomer_OpaqueLoyaltyInfo) String() string { func (*OpaqueCustomer_OpaqueLoyaltyInfo) ProtoMessage() {} func (x *OpaqueCustomer_OpaqueLoyaltyInfo) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[33] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6694,7 +6833,7 @@ type OpaqueCustomer_OpaquePaymentMethod struct { func (x *OpaqueCustomer_OpaquePaymentMethod) Reset() { *x = OpaqueCustomer_OpaquePaymentMethod{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6706,7 +6845,7 @@ func (x *OpaqueCustomer_OpaquePaymentMethod) String() string { func (*OpaqueCustomer_OpaquePaymentMethod) ProtoMessage() {} func (x *OpaqueCustomer_OpaquePaymentMethod) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[35] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[37] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6924,7 +7063,7 @@ type OpaqueOrder_OpaqueShippingInfo struct { func (x *OpaqueOrder_OpaqueShippingInfo) Reset() { *x = OpaqueOrder_OpaqueShippingInfo{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[37] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6936,7 +7075,7 @@ func (x *OpaqueOrder_OpaqueShippingInfo) String() string { func (*OpaqueOrder_OpaqueShippingInfo) ProtoMessage() {} func (x *OpaqueOrder_OpaqueShippingInfo) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[37] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[39] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7073,7 +7212,7 @@ type OpaqueOrderSummary_OpaqueOrderError struct { func (x *OpaqueOrderSummary_OpaqueOrderError) Reset() { *x = OpaqueOrderSummary_OpaqueOrderError{} - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[40] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7085,7 +7224,7 @@ func (x *OpaqueOrderSummary_OpaqueOrderError) String() string { func (*OpaqueOrderSummary_OpaqueOrderError) ProtoMessage() {} func (x *OpaqueOrderSummary_OpaqueOrderError) ProtoReflect() protoreflect.Message { - mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[40] + mi := &file_examples_internal_proto_examplepb_opaque_proto_msgTypes[42] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7208,7 +7347,7 @@ var File_examples_internal_proto_examplepb_opaque_proto protoreflect.FileDescrip const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "\n" + - ".examples/internal/proto/examplepb/opaque.proto\x12.grpc.gateway.examples.internal.proto.examplepb\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xb2\x01\n" + + ".examples/internal/proto/examplepb/opaque.proto\x12.grpc.gateway.examples.internal.proto.examplepb\x1a)examples/internal/proto/sub/message.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xb2\x01\n" + "\x1aOpaqueUpdateProductRequest\x12W\n" + "\aproduct\x18\x01 \x01(\v2=.grpc.gateway.examples.internal.proto.examplepb.OpaqueProductR\aproduct\x12;\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" + @@ -7276,7 +7415,11 @@ const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "\x19OpaqueSearchOrdersRequest\x12Q\n" + "\x05order\x18\x01 \x01(\v2;.grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderR\x05order\"q\n" + "\x1aOpaqueSearchOrdersResponse\x12S\n" + - "\x06orders\x18\x01 \x03(\v2;.grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderR\x06orders\"\xd4\x05\n" + + "\x06orders\x18\x01 \x03(\v2;.grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderR\x06orders\"d\n" + + "\x15OpaqueEchoNoteRequest\x12K\n" + + "\x04note\x18\x01 \x01(\v27.grpc.gateway.examples.internal.proto.sub.StringMessageR\x04note\"e\n" + + "\x16OpaqueEchoNoteResponse\x12K\n" + + "\x04note\x18\x01 \x01(\v27.grpc.gateway.examples.internal.proto.sub.StringMessageR\x04note\"\xd4\x05\n" + "\rOpaqueAddress\x12!\n" + "\fstreet_line1\x18\x01 \x01(\tR\vstreetLine1\x12!\n" + "\fstreet_line2\x18\x02 \x01(\tR\vstreetLine2\x12\x12\n" + @@ -7585,7 +7728,7 @@ const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "#OPAQUE_UPDATE_TYPE_INVENTORY_UPDATE\x10\x04\x12#\n" + "\x1fOPAQUE_UPDATE_TYPE_PRICE_CHANGE\x10\x05\x12$\n" + " OPAQUE_UPDATE_TYPE_CART_REMINDER\x10\x06B\r\n" + - "\vaction_data2\xb1\x0e\n" + + "\vaction_data2\xf1\x0f\n" + "\x16OpaqueEcommerceService\x12\xc8\x01\n" + "\x10OpaqueGetProduct\x12G.grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductRequest\x1aH.grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse\"!\x82\xd3\xe4\x93\x02\x1b\x12\x19/v1/products/{product_id}\x12\xd0\x01\n" + "\x14OpaqueSearchProducts\x12K.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest\x1aL.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/v1/products/search0\x01\x12\xc7\x01\n" + @@ -7594,10 +7737,11 @@ const file_examples_internal_proto_examplepb_opaque_proto_rawDesc = "" + "\x13OpaqueProcessOrders\x12J.grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest\x1aK.grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/v1/orders/process(\x01\x12\xef\x01\n" + "\x1cOpaqueStreamCustomerActivity\x12S.grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest\x1aT.grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/v1/customer/activity(\x010\x01\x12\xf8\x01\n" + "\x13OpaqueUpdateProduct\x12J.grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest\x1aK.grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse\"H\xdaA\x13product,update_mask\x82\xd3\xe4\x93\x02,:\aproduct2!/v1/products/{product.product_id}\x12\x8b\x02\n" + - "\x12OpaqueSearchOrders\x12I.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest\x1aJ.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse\"^\x82\xd3\xe4\x93\x02X\x12V/v1/orders/search/{order.status}/shipAddressType/{order.shipping_address.address_type}BMZKgithub.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepbb\beditionsp\xe8\a" + "\x12OpaqueSearchOrders\x12I.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest\x1aJ.grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse\"^\x82\xd3\xe4\x93\x02X\x12V/v1/orders/search/{order.status}/shipAddressType/{order.shipping_address.address_type}\x12\xbd\x01\n" + + "\x0eOpaqueEchoNote\x12E.grpc.gateway.examples.internal.proto.examplepb.OpaqueEchoNoteRequest\x1aF.grpc.gateway.examples.internal.proto.examplepb.OpaqueEchoNoteResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x04note\"\x0e/v1/notes:echoBMZKgithub.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepbb\beditionsp\xe8\a" var file_examples_internal_proto_examplepb_opaque_proto_enumTypes = make([]protoimpl.EnumInfo, 8) -var file_examples_internal_proto_examplepb_opaque_proto_msgTypes = make([]protoimpl.MessageInfo, 43) +var file_examples_internal_proto_examplepb_opaque_proto_msgTypes = make([]protoimpl.MessageInfo, 45) var file_examples_internal_proto_examplepb_opaque_proto_goTypes = []any{ (OpaqueSearchProductsRequest_OpaqueSortOrder)(0), // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.OpaqueSortOrder (OpaqueAddress_OpaqueAddressType)(0), // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.OpaqueAddressType @@ -7623,145 +7767,152 @@ var file_examples_internal_proto_examplepb_opaque_proto_goTypes = []any{ (*OpaqueStreamCustomerActivityResponse)(nil), // 21: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse (*OpaqueSearchOrdersRequest)(nil), // 22: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest (*OpaqueSearchOrdersResponse)(nil), // 23: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse - (*OpaqueAddress)(nil), // 24: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - (*OpaquePrice)(nil), // 25: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - (*OpaqueProductCategory)(nil), // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory - (*OpaqueProductVariant)(nil), // 27: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant - (*OpaqueProduct)(nil), // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - (*OpaqueCustomer)(nil), // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer - (*OpaqueOrderItem)(nil), // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem - (*OpaqueOrder)(nil), // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder - (*OpaqueOrderSummary)(nil), // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary - (*OpaqueCustomerEvent)(nil), // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent - (*OpaqueActivityUpdate)(nil), // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate - nil, // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry - nil, // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry - nil, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry - nil, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry - nil, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry - (*OpaqueProduct_OpaqueProductDimensions)(nil), // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions - (*OpaqueCustomer_OpaqueLoyaltyInfo)(nil), // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo - nil, // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry - (*OpaqueCustomer_OpaquePaymentMethod)(nil), // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod - nil, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry - (*OpaqueOrder_OpaqueShippingInfo)(nil), // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo - nil, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry - nil, // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry - (*OpaqueOrderSummary_OpaqueOrderError)(nil), // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError - nil, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry - nil, // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry - (*fieldmaskpb.FieldMask)(nil), // 51: google.protobuf.FieldMask - (*wrapperspb.BoolValue)(nil), // 52: google.protobuf.BoolValue - (*wrapperspb.DoubleValue)(nil), // 53: google.protobuf.DoubleValue - (*timestamppb.Timestamp)(nil), // 54: google.protobuf.Timestamp - (*durationpb.Duration)(nil), // 55: google.protobuf.Duration + (*OpaqueEchoNoteRequest)(nil), // 24: grpc.gateway.examples.internal.proto.examplepb.OpaqueEchoNoteRequest + (*OpaqueEchoNoteResponse)(nil), // 25: grpc.gateway.examples.internal.proto.examplepb.OpaqueEchoNoteResponse + (*OpaqueAddress)(nil), // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + (*OpaquePrice)(nil), // 27: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + (*OpaqueProductCategory)(nil), // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory + (*OpaqueProductVariant)(nil), // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant + (*OpaqueProduct)(nil), // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + (*OpaqueCustomer)(nil), // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer + (*OpaqueOrderItem)(nil), // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem + (*OpaqueOrder)(nil), // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + (*OpaqueOrderSummary)(nil), // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary + (*OpaqueCustomerEvent)(nil), // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent + (*OpaqueActivityUpdate)(nil), // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate + nil, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry + nil, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry + nil, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry + nil, // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry + nil, // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry + (*OpaqueProduct_OpaqueProductDimensions)(nil), // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions + (*OpaqueCustomer_OpaqueLoyaltyInfo)(nil), // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo + nil, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry + (*OpaqueCustomer_OpaquePaymentMethod)(nil), // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod + nil, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry + (*OpaqueOrder_OpaqueShippingInfo)(nil), // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo + nil, // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry + nil, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry + (*OpaqueOrderSummary_OpaqueOrderError)(nil), // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError + nil, // 51: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry + nil, // 52: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry + (*fieldmaskpb.FieldMask)(nil), // 53: google.protobuf.FieldMask + (*sub.StringMessage)(nil), // 54: grpc.gateway.examples.internal.proto.sub.StringMessage + (*wrapperspb.BoolValue)(nil), // 55: google.protobuf.BoolValue + (*wrapperspb.DoubleValue)(nil), // 56: google.protobuf.DoubleValue + (*timestamppb.Timestamp)(nil), // 57: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 58: google.protobuf.Duration } var file_examples_internal_proto_examplepb_opaque_proto_depIdxs = []int32{ - 28, // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 51, // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.update_mask:type_name -> google.protobuf.FieldMask - 28, // 2: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 28, // 3: grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 25, // 4: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.min_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 25, // 5: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.max_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 30, // 0: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 53, // 1: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest.update_mask:type_name -> google.protobuf.FieldMask + 30, // 2: grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 30, // 3: grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 27, // 4: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.min_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 27, // 5: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.max_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice 0, // 6: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.sort_by:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.OpaqueSortOrder - 51, // 7: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.field_mask:type_name -> google.protobuf.FieldMask - 35, // 8: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.filters:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry - 28, // 9: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 28, // 10: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 28, // 11: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 28, // 12: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 28, // 13: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct - 31, // 14: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder - 32, // 15: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse.summary:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary - 33, // 16: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent - 34, // 17: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate - 31, // 18: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder - 31, // 19: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse.orders:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder - 1, // 20: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.address_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.OpaqueAddressType - 52, // 21: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.is_default:type_name -> google.protobuf.BoolValue - 36, // 22: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry - 53, // 23: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.original_amount:type_name -> google.protobuf.DoubleValue - 54, // 24: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.price_valid_until:type_name -> google.protobuf.Timestamp - 26, // 25: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.parent_category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory - 54, // 26: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.created_at:type_name -> google.protobuf.Timestamp - 54, // 27: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.updated_at:type_name -> google.protobuf.Timestamp - 25, // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 37, // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry - 52, // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.is_available:type_name -> google.protobuf.BoolValue - 25, // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.base_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 26, // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory - 27, // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.variants:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant - 52, // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.is_featured:type_name -> google.protobuf.BoolValue - 54, // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.created_at:type_name -> google.protobuf.Timestamp - 54, // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.updated_at:type_name -> google.protobuf.Timestamp - 55, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.average_shipping_time:type_name -> google.protobuf.Duration - 2, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductStatus - 38, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry - 39, // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.regional_prices:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry - 40, // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.dimensions:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions - 24, // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.addresses:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - 54, // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.created_at:type_name -> google.protobuf.Timestamp - 54, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.last_login:type_name -> google.protobuf.Timestamp - 4, // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueCustomerStatus - 41, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.loyalty_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo - 42, // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.preferences:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry - 43, // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.payment_methods:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod - 25, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.unit_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 25, // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.total_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 44, // 51: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.selected_attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry - 52, // 52: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.gift_wrapped:type_name -> google.protobuf.BoolValue - 30, // 53: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.items:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem - 25, // 54: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.subtotal:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 25, // 55: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.tax:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 25, // 56: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 25, // 57: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.total:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 24, // 58: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - 24, // 59: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.billing_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress - 5, // 60: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueOrderStatus - 54, // 61: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.created_at:type_name -> google.protobuf.Timestamp - 54, // 62: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.updated_at:type_name -> google.protobuf.Timestamp - 54, // 63: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipped_at:type_name -> google.protobuf.Timestamp - 54, // 64: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.delivered_at:type_name -> google.protobuf.Timestamp - 45, // 65: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo - 46, // 66: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry - 25, // 67: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.total_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 47, // 68: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.error_details:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry - 54, // 69: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.processing_time:type_name -> google.protobuf.Timestamp - 48, // 70: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.errors:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError - 6, // 71: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.OpaqueEventType - 54, // 72: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.timestamp:type_name -> google.protobuf.Timestamp - 49, // 73: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry - 7, // 74: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.OpaqueUpdateType - 54, // 75: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.timestamp:type_name -> google.protobuf.Timestamp - 25, // 76: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.price_update:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 55, // 77: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.offer_expiry:type_name -> google.protobuf.Duration - 50, // 78: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry - 25, // 79: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry.value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice - 3, // 80: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.unit:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.OpaqueUnit - 54, // 81: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo.tier_expiry:type_name -> google.protobuf.Timestamp - 54, // 82: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod.expires_at:type_name -> google.protobuf.Timestamp - 55, // 83: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo.estimated_delivery_time:type_name -> google.protobuf.Duration - 10, // 84: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductRequest - 12, // 85: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest - 14, // 86: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest - 16, // 87: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest - 18, // 88: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest - 20, // 89: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest - 8, // 90: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest - 22, // 91: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest - 11, // 92: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse - 13, // 93: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse - 15, // 94: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse - 17, // 95: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse - 19, // 96: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse - 21, // 97: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse - 9, // 98: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse - 23, // 99: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse - 92, // [92:100] is the sub-list for method output_type - 84, // [84:92] is the sub-list for method input_type - 84, // [84:84] is the sub-list for extension type_name - 84, // [84:84] is the sub-list for extension extendee - 0, // [0:84] is the sub-list for field type_name + 53, // 7: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.field_mask:type_name -> google.protobuf.FieldMask + 37, // 8: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.filters:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest.FiltersEntry + 30, // 9: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 30, // 10: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 30, // 11: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 30, // 12: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 30, // 13: grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse.product:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct + 33, // 14: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + 34, // 15: grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse.summary:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary + 35, // 16: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent + 36, // 17: grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse.event:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate + 33, // 18: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest.order:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + 33, // 19: grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse.orders:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder + 54, // 20: grpc.gateway.examples.internal.proto.examplepb.OpaqueEchoNoteRequest.note:type_name -> grpc.gateway.examples.internal.proto.sub.StringMessage + 54, // 21: grpc.gateway.examples.internal.proto.examplepb.OpaqueEchoNoteResponse.note:type_name -> grpc.gateway.examples.internal.proto.sub.StringMessage + 1, // 22: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.address_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.OpaqueAddressType + 55, // 23: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.is_default:type_name -> google.protobuf.BoolValue + 38, // 24: grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress.MetadataEntry + 56, // 25: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.original_amount:type_name -> google.protobuf.DoubleValue + 57, // 26: grpc.gateway.examples.internal.proto.examplepb.OpaquePrice.price_valid_until:type_name -> google.protobuf.Timestamp + 28, // 27: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.parent_category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory + 57, // 28: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.created_at:type_name -> google.protobuf.Timestamp + 57, // 29: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory.updated_at:type_name -> google.protobuf.Timestamp + 27, // 30: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 39, // 31: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.AttributesEntry + 55, // 32: grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant.is_available:type_name -> google.protobuf.BoolValue + 27, // 33: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.base_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 28, // 34: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.category:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductCategory + 29, // 35: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.variants:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProductVariant + 55, // 36: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.is_featured:type_name -> google.protobuf.BoolValue + 57, // 37: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.created_at:type_name -> google.protobuf.Timestamp + 57, // 38: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.updated_at:type_name -> google.protobuf.Timestamp + 58, // 39: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.average_shipping_time:type_name -> google.protobuf.Duration + 2, // 40: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductStatus + 40, // 41: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.MetadataEntry + 41, // 42: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.regional_prices:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry + 42, // 43: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.dimensions:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions + 26, // 44: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.addresses:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + 57, // 45: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.created_at:type_name -> google.protobuf.Timestamp + 57, // 46: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.last_login:type_name -> google.protobuf.Timestamp + 4, // 47: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueCustomerStatus + 43, // 48: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.loyalty_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo + 44, // 49: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.preferences:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.PreferencesEntry + 45, // 50: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.payment_methods:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod + 27, // 51: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.unit_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 27, // 52: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.total_price:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 46, // 53: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.selected_attributes:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.SelectedAttributesEntry + 55, // 54: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem.gift_wrapped:type_name -> google.protobuf.BoolValue + 32, // 55: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.items:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderItem + 27, // 56: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.subtotal:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 27, // 57: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.tax:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 27, // 58: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 27, // 59: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.total:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 26, // 60: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + 26, // 61: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.billing_address:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueAddress + 5, // 62: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueOrderStatus + 57, // 63: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.created_at:type_name -> google.protobuf.Timestamp + 57, // 64: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.updated_at:type_name -> google.protobuf.Timestamp + 57, // 65: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipped_at:type_name -> google.protobuf.Timestamp + 57, // 66: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.delivered_at:type_name -> google.protobuf.Timestamp + 47, // 67: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.shipping_info:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo + 48, // 68: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.metadata:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.MetadataEntry + 27, // 69: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.total_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 49, // 70: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.error_details:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.ErrorDetailsEntry + 57, // 71: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.processing_time:type_name -> google.protobuf.Timestamp + 50, // 72: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.errors:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueOrderSummary.OpaqueOrderError + 6, // 73: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.OpaqueEventType + 57, // 74: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.timestamp:type_name -> google.protobuf.Timestamp + 51, // 75: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.event_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomerEvent.EventDataEntry + 7, // 76: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_type:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.OpaqueUpdateType + 57, // 77: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.timestamp:type_name -> google.protobuf.Timestamp + 27, // 78: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.price_update:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 58, // 79: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.offer_expiry:type_name -> google.protobuf.Duration + 52, // 80: grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.update_data:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueActivityUpdate.UpdateDataEntry + 27, // 81: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.RegionalPricesEntry.value:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaquePrice + 3, // 82: grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.unit:type_name -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProduct.OpaqueProductDimensions.OpaqueUnit + 57, // 83: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaqueLoyaltyInfo.tier_expiry:type_name -> google.protobuf.Timestamp + 57, // 84: grpc.gateway.examples.internal.proto.examplepb.OpaqueCustomer.OpaquePaymentMethod.expires_at:type_name -> google.protobuf.Timestamp + 58, // 85: grpc.gateway.examples.internal.proto.examplepb.OpaqueOrder.OpaqueShippingInfo.estimated_delivery_time:type_name -> google.protobuf.Duration + 10, // 86: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductRequest + 12, // 87: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsRequest + 14, // 88: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductRequest + 16, // 89: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldRequest + 18, // 90: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersRequest + 20, // 91: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityRequest + 8, // 92: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductRequest + 22, // 93: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchOrders:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersRequest + 24, // 94: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueEchoNote:input_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueEchoNoteRequest + 11, // 95: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueGetProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueGetProductResponse + 13, // 96: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchProducts:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchProductsResponse + 15, // 97: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductResponse + 17, // 98: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueCreateProductField:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueCreateProductFieldResponse + 19, // 99: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueProcessOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueProcessOrdersResponse + 21, // 100: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueStreamCustomerActivity:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueStreamCustomerActivityResponse + 9, // 101: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueUpdateProduct:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueUpdateProductResponse + 23, // 102: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueSearchOrders:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueSearchOrdersResponse + 25, // 103: grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService.OpaqueEchoNote:output_type -> grpc.gateway.examples.internal.proto.examplepb.OpaqueEchoNoteResponse + 95, // [95:104] is the sub-list for method output_type + 86, // [86:95] is the sub-list for method input_type + 86, // [86:86] is the sub-list for extension type_name + 86, // [86:86] is the sub-list for extension extendee + 0, // [0:86] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_opaque_proto_init() } @@ -7769,19 +7920,19 @@ func file_examples_internal_proto_examplepb_opaque_proto_init() { if File_examples_internal_proto_examplepb_opaque_proto != nil { return } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[19].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[21].OneofWrappers = []any{ (*opaqueProductVariant_PercentageOff)(nil), (*opaqueProductVariant_FixedAmountOff)(nil), } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[20].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[22].OneofWrappers = []any{ (*opaqueProduct_TaxPercentage)(nil), (*opaqueProduct_TaxExempt)(nil), } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[23].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[25].OneofWrappers = []any{ (*opaqueOrder_CouponCode)(nil), (*opaqueOrder_PromotionId)(nil), } - file_examples_internal_proto_examplepb_opaque_proto_msgTypes[26].OneofWrappers = []any{ + file_examples_internal_proto_examplepb_opaque_proto_msgTypes[28].OneofWrappers = []any{ (*opaqueActivityUpdate_RedirectUrl)(nil), (*opaqueActivityUpdate_NotificationId)(nil), } @@ -7791,7 +7942,7 @@ func file_examples_internal_proto_examplepb_opaque_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_examples_internal_proto_examplepb_opaque_proto_rawDesc), len(file_examples_internal_proto_examplepb_opaque_proto_rawDesc)), NumEnums: 8, - NumMessages: 43, + NumMessages: 45, NumExtensions: 0, NumServices: 1, }, diff --git a/examples/internal/proto/examplepb/opaque.pb.gw.go b/examples/internal/proto/examplepb/opaque.pb.gw.go index 046989e905c..d110fef02e5 100644 --- a/examples/internal/proto/examplepb/opaque.pb.gw.go +++ b/examples/internal/proto/examplepb/opaque.pb.gw.go @@ -14,6 +14,7 @@ import ( "io" "net/http" + "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" @@ -454,6 +455,37 @@ func local_request_OpaqueEcommerceService_OpaqueSearchOrders_0(ctx context.Conte return msg, metadata, err } +func request_OpaqueEcommerceService_OpaqueEchoNote_0(ctx context.Context, marshaler runtime.Marshaler, client OpaqueEcommerceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq OpaqueEchoNoteRequest + metadata runtime.ServerMetadata + ) + bodyData := &sub.StringMessage{} + if err := marshaler.NewDecoder(req.Body).Decode(bodyData); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + protoReq.SetNote(bodyData) + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.OpaqueEchoNote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_OpaqueEcommerceService_OpaqueEchoNote_0(ctx context.Context, marshaler runtime.Marshaler, server OpaqueEcommerceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq OpaqueEchoNoteRequest + metadata runtime.ServerMetadata + ) + bodyData := &sub.StringMessage{} + if err := marshaler.NewDecoder(req.Body).Decode(bodyData); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + protoReq.SetNote(bodyData) + msg, err := server.OpaqueEchoNote(ctx, &protoReq) + return msg, metadata, err +} + // RegisterOpaqueEcommerceServiceHandlerServer registers the http handlers for service OpaqueEcommerceService to "mux". // UnaryRPC :call OpaqueEcommerceServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -581,6 +613,26 @@ func RegisterOpaqueEcommerceServiceHandlerServer(ctx context.Context, mux *runti } forward_OpaqueEcommerceService_OpaqueSearchOrders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_OpaqueEcommerceService_OpaqueEchoNote_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) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueEchoNote", runtime.WithHTTPPathPattern("/v1/notes:echo")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_OpaqueEcommerceService_OpaqueEchoNote_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_OpaqueEcommerceService_OpaqueEchoNote_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -757,6 +809,23 @@ func RegisterOpaqueEcommerceServiceHandlerClient(ctx context.Context, mux *runti } forward_OpaqueEcommerceService_OpaqueSearchOrders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_OpaqueEcommerceService_OpaqueEchoNote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueEchoNote", runtime.WithHTTPPathPattern("/v1/notes:echo")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_OpaqueEcommerceService_OpaqueEchoNote_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_OpaqueEcommerceService_OpaqueEchoNote_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -769,6 +838,7 @@ var ( pattern_OpaqueEcommerceService_OpaqueStreamCustomerActivity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "customer", "activity"}, "")) pattern_OpaqueEcommerceService_OpaqueUpdateProduct_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "products", "product.product_id"}, "")) pattern_OpaqueEcommerceService_OpaqueSearchOrders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "orders", "search", "order.status", "shipAddressType", "order.shipping_address.address_type"}, "")) + pattern_OpaqueEcommerceService_OpaqueEchoNote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "notes"}, "echo")) ) var ( @@ -780,4 +850,5 @@ var ( forward_OpaqueEcommerceService_OpaqueStreamCustomerActivity_0 = runtime.ForwardResponseStream forward_OpaqueEcommerceService_OpaqueUpdateProduct_0 = runtime.ForwardResponseMessage forward_OpaqueEcommerceService_OpaqueSearchOrders_0 = runtime.ForwardResponseMessage + forward_OpaqueEcommerceService_OpaqueEchoNote_0 = runtime.ForwardResponseMessage ) diff --git a/examples/internal/proto/examplepb/opaque.proto b/examples/internal/proto/examplepb/opaque.proto index 535ef956323..edaa160269e 100644 --- a/examples/internal/proto/examplepb/opaque.proto +++ b/examples/internal/proto/examplepb/opaque.proto @@ -2,6 +2,7 @@ edition = "2023"; package grpc.gateway.examples.internal.proto.examplepb; +import "examples/internal/proto/sub/message.proto"; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/protobuf/duration.proto"; @@ -75,6 +76,15 @@ service OpaqueEcommerceService { rpc OpaqueSearchOrders(OpaqueSearchOrdersRequest) returns (OpaqueSearchOrdersResponse) { option (google.api.http) = {get: "/v1/orders/search/{order.status}/shipAddressType/{order.shipping_address.address_type}"}; } + + // OpaqueEchoNote - Unary request with nested body field from another package. + // Exercises the opaque body import path by referencing grpc.gateway.examples.internal.proto.sub.StringMessage. + rpc OpaqueEchoNote(OpaqueEchoNoteRequest) returns (OpaqueEchoNoteResponse) { + option (google.api.http) = { + post: "/v1/notes:echo" + body: "note" + }; + } } // OpaqueUpdateProductRequest represents a request to update a product @@ -187,6 +197,16 @@ message OpaqueSearchOrdersResponse { repeated OpaqueOrder orders = 1; } +// OpaqueEchoNoteRequest demonstrates an opaque body that maps to a foreign message. +message OpaqueEchoNoteRequest { + grpc.gateway.examples.internal.proto.sub.StringMessage note = 1; +} + +// OpaqueEchoNoteResponse mirrors the request payload for simplicity. +message OpaqueEchoNoteResponse { + grpc.gateway.examples.internal.proto.sub.StringMessage note = 1; +} + // OpaqueAddress represents a physical address message OpaqueAddress { string street_line1 = 1; diff --git a/examples/internal/proto/examplepb/opaque.swagger.json b/examples/internal/proto/examplepb/opaque.swagger.json index dfacb9cfe88..39e6bb5e523 100644 --- a/examples/internal/proto/examplepb/opaque.swagger.json +++ b/examples/internal/proto/examplepb/opaque.swagger.json @@ -59,6 +59,39 @@ ] } }, + "/v1/notes:echo": { + "post": { + "summary": "OpaqueEchoNote - Unary request with nested body field from another package.\nExercises the opaque body import path by referencing grpc.gateway.examples.internal.proto.sub.StringMessage.", + "operationId": "OpaqueEcommerceService_OpaqueEchoNote", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbOpaqueEchoNoteResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googleRpcStatus" + } + } + }, + "parameters": [ + { + "name": "note", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/subStringMessage" + } + } + ], + "tags": [ + "OpaqueEcommerceService" + ] + } + }, "/v1/orders/process": { "post": { "summary": "OpaqueProcessOrders - Stream request, unary response\nProcesses multiple orders in a batch and returns a summary", @@ -1229,6 +1262,15 @@ }, "title": "OpaqueCustomerEvent represents a customer activity event" }, + "examplepbOpaqueEchoNoteResponse": { + "type": "object", + "properties": { + "note": { + "$ref": "#/definitions/subStringMessage" + } + }, + "description": "OpaqueEchoNoteResponse mirrors the request payload for simplicity." + }, "examplepbOpaqueGetProductResponse": { "type": "object", "properties": { @@ -1685,6 +1727,14 @@ }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "subStringMessage": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + } } } } diff --git a/examples/internal/proto/examplepb/opaque_grpc.pb.go b/examples/internal/proto/examplepb/opaque_grpc.pb.go index 397d83e1cbc..df98d4f7170 100644 --- a/examples/internal/proto/examplepb/opaque_grpc.pb.go +++ b/examples/internal/proto/examplepb/opaque_grpc.pb.go @@ -27,6 +27,7 @@ const ( OpaqueEcommerceService_OpaqueStreamCustomerActivity_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueStreamCustomerActivity" OpaqueEcommerceService_OpaqueUpdateProduct_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueUpdateProduct" OpaqueEcommerceService_OpaqueSearchOrders_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueSearchOrders" + OpaqueEcommerceService_OpaqueEchoNote_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.OpaqueEcommerceService/OpaqueEchoNote" ) // OpaqueEcommerceServiceClient is the client API for OpaqueEcommerceService service. @@ -58,6 +59,9 @@ type OpaqueEcommerceServiceClient interface { // OpaqueSearchOrders - Unary request, unary response // Uses enum params (both top level and nested) to populate fields to test opaque get chain OpaqueSearchOrders(ctx context.Context, in *OpaqueSearchOrdersRequest, opts ...grpc.CallOption) (*OpaqueSearchOrdersResponse, error) + // OpaqueEchoNote - Unary request with nested body field from another package. + // Exercises the opaque body import path by referencing grpc.gateway.examples.internal.proto.sub.StringMessage. + OpaqueEchoNote(ctx context.Context, in *OpaqueEchoNoteRequest, opts ...grpc.CallOption) (*OpaqueEchoNoteResponse, error) } type opaqueEcommerceServiceClient struct { @@ -163,6 +167,16 @@ func (c *opaqueEcommerceServiceClient) OpaqueSearchOrders(ctx context.Context, i return out, nil } +func (c *opaqueEcommerceServiceClient) OpaqueEchoNote(ctx context.Context, in *OpaqueEchoNoteRequest, opts ...grpc.CallOption) (*OpaqueEchoNoteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(OpaqueEchoNoteResponse) + err := c.cc.Invoke(ctx, OpaqueEcommerceService_OpaqueEchoNote_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // OpaqueEcommerceServiceServer is the server API for OpaqueEcommerceService service. // All implementations should embed UnimplementedOpaqueEcommerceServiceServer // for forward compatibility. @@ -192,6 +206,9 @@ type OpaqueEcommerceServiceServer interface { // OpaqueSearchOrders - Unary request, unary response // Uses enum params (both top level and nested) to populate fields to test opaque get chain OpaqueSearchOrders(context.Context, *OpaqueSearchOrdersRequest) (*OpaqueSearchOrdersResponse, error) + // OpaqueEchoNote - Unary request with nested body field from another package. + // Exercises the opaque body import path by referencing grpc.gateway.examples.internal.proto.sub.StringMessage. + OpaqueEchoNote(context.Context, *OpaqueEchoNoteRequest) (*OpaqueEchoNoteResponse, error) } // UnimplementedOpaqueEcommerceServiceServer should be embedded to have @@ -225,6 +242,9 @@ func (UnimplementedOpaqueEcommerceServiceServer) OpaqueUpdateProduct(context.Con func (UnimplementedOpaqueEcommerceServiceServer) OpaqueSearchOrders(context.Context, *OpaqueSearchOrdersRequest) (*OpaqueSearchOrdersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OpaqueSearchOrders not implemented") } +func (UnimplementedOpaqueEcommerceServiceServer) OpaqueEchoNote(context.Context, *OpaqueEchoNoteRequest) (*OpaqueEchoNoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpaqueEchoNote not implemented") +} func (UnimplementedOpaqueEcommerceServiceServer) testEmbeddedByValue() {} // UnsafeOpaqueEcommerceServiceServer may be embedded to opt out of forward compatibility for this service. @@ -360,6 +380,24 @@ func _OpaqueEcommerceService_OpaqueSearchOrders_Handler(srv interface{}, ctx con return interceptor(ctx, in, info, handler) } +func _OpaqueEcommerceService_OpaqueEchoNote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpaqueEchoNoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OpaqueEcommerceServiceServer).OpaqueEchoNote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OpaqueEcommerceService_OpaqueEchoNote_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OpaqueEcommerceServiceServer).OpaqueEchoNote(ctx, req.(*OpaqueEchoNoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + // OpaqueEcommerceService_ServiceDesc is the grpc.ServiceDesc for OpaqueEcommerceService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -387,6 +425,10 @@ var OpaqueEcommerceService_ServiceDesc = grpc.ServiceDesc{ MethodName: "OpaqueSearchOrders", Handler: _OpaqueEcommerceService_OpaqueSearchOrders_Handler, }, + { + MethodName: "OpaqueEchoNote", + Handler: _OpaqueEcommerceService_OpaqueEchoNote_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/protoc-gen-grpc-gateway/internal/gengateway/generator.go b/protoc-gen-grpc-gateway/internal/gengateway/generator.go index c9f291024e8..d252936225b 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/generator.go @@ -169,7 +169,7 @@ func (g *generator) addBodyFieldImports( m *descriptor.Method, pkgSeen map[string]bool, ) []descriptor.GoPackage { - if g.reg == nil { + if g.reg == nil || !g.useOpaqueAPI { return nil } diff --git a/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go b/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go index 59f0fce1daf..0a1cd480377 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go @@ -6,6 +6,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" ) func newExampleFileDescriptorWithGoPkg(gp *descriptor.GoPackage, filenamePrefix string) *descriptor.File { @@ -110,3 +111,126 @@ func testGeneratorGenerate(t *testing.T, useOpaqueAPI bool) { t.Fatalf("invalid name %q, expected %q", gotName, expectedName) } } + +func TestAddBodyFieldImportsOpaqueOnly(t *testing.T) { + reg, file := buildBodyImportTestFile(t) + svc := file.Services[0] + m := svc.Methods[0] + + bookField := m.RequestType.Fields[0] + bookMessage, err := reg.LookupMsg("", ".example.sub.CreateBook") + if err != nil { + t.Fatalf("lookup book message: %v", err) + } + bookField.FieldMessage = bookMessage + + bodyPath := descriptor.FieldPath{ + { + Name: bookField.GetName(), + Target: bookField, + }, + } + m.Bindings = []*descriptor.Binding{ + { + HTTPMethod: "POST", + Body: &descriptor.Body{ + FieldPath: bodyPath, + }, + }, + } + + g := &generator{ + reg: reg, + useOpaqueAPI: false, + } + + if got := g.addBodyFieldImports(file, m, map[string]bool{}); len(got) != 0 { + t.Fatalf("expected no imports when opaque API disabled, got %v", got) + } + + g.useOpaqueAPI = true + imports := g.addBodyFieldImports(file, m, map[string]bool{}) + if len(imports) != 1 { + t.Fatalf("expected 1 import when opaque API enabled, got %d", len(imports)) + } + if imports[0].Path != bookMessage.File.GoPkg.Path { + t.Fatalf("import path mismatch: got %q want %q", imports[0].Path, bookMessage.File.GoPkg.Path) + } +} + +func buildBodyImportTestFile(t *testing.T) (*descriptor.Registry, *descriptor.File) { + t.Helper() + + subFile := &descriptorpb.FileDescriptorProto{ + Name: proto.String("sub.proto"), + Package: proto.String("example.sub"), + Syntax: proto.String("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: proto.String("example.com/sub;subpb"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: proto.String("CreateBook"), + }, + }, + } + + mainFile := &descriptorpb.FileDescriptorProto{ + Name: proto.String("svc.proto"), + Package: proto.String("example.svc"), + Syntax: proto.String("proto3"), + Dependency: []string{"sub.proto"}, + Options: &descriptorpb.FileOptions{ + GoPackage: proto.String("example.com/svc;svcpb"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: proto.String("CreateBookRequest"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: proto.String("book"), + Number: proto.Int32(1), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String(".example.sub.CreateBook"), + }, + }, + }, + { + Name: proto.String("CreateBookResponse"), + }, + }, + Service: []*descriptorpb.ServiceDescriptorProto{ + { + Name: proto.String("LibraryService"), + Method: []*descriptorpb.MethodDescriptorProto{ + { + Name: proto.String("CreateBook"), + InputType: proto.String(".example.svc.CreateBookRequest"), + OutputType: proto.String(".example.svc.CreateBookResponse"), + }, + }, + }, + }, + } + + req := &pluginpb.CodeGeneratorRequest{ + ProtoFile: []*descriptorpb.FileDescriptorProto{subFile, mainFile}, + FileToGenerate: []string{"svc.proto"}, + CompilerVersion: &pluginpb.Version{ + Major: proto.Int32(3), + Minor: proto.Int32(21), + }, + } + + reg := descriptor.NewRegistry() + if err := reg.Load(req); err != nil { + t.Fatalf("registry load failed: %v", err) + } + + file, err := reg.LookupFile("svc.proto") + if err != nil { + t.Fatalf("lookup svc file: %v", err) + } + return reg, crossLinkFixture(file) +}