diff --git a/buf.yaml b/buf.yaml index 80e405f6d80..8d3aa00dfed 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 @@ -29,6 +30,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 +52,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 @@ -72,6 +78,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 +91,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 @@ -107,6 +115,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 @@ -127,6 +136,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 +147,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 +202,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..c45a0a07494 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 @@ -56,6 +58,7 @@ proto_library( name = "examplepb_proto", srcs = [ "a_bit_of_everything.proto", + "camel_case_service.proto", "echo_service.proto", "enum_with_single_value.proto", "excess_body.proto", @@ -99,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", @@ -158,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", ], 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..94aae2edb7d --- /dev/null +++ b/examples/internal/proto/examplepb/camel_case_service.pb.go @@ -0,0 +1,394 @@ +// 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 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 CamelStatus `protobuf:"varint,1,opt,name=state,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.CamelStatus" 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() CamelStatus { + if x != nil { + return x.State + } + return CamelStatus_CAMEL_STATUS_UNSPECIFIED +} + +type GetStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State CamelStatus `protobuf:"varint,1,opt,name=state,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.CamelStatus" 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() CamelStatus { + if x != nil { + return x.State + } + return CamelStatus_CAMEL_STATUS_UNSPECIFIED +} + +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, 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, 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, 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, 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_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{ + (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{ + 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 + 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 + 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: 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 + 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..d3a74e97cc1 --- /dev/null +++ b/examples/internal/proto/examplepb/camel_case_service.pb.gw.go @@ -0,0 +1,239 @@ +// 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/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, CamelStatus_value) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "state", err) + } + protoReq.State = CamelStatus(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, CamelStatus_value) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "state", err) + } + protoReq.State = CamelStatus(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..f6fa4850278 --- /dev/null +++ b/examples/internal/proto/examplepb/camel_case_service.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +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"; + +// 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 { + CamelStatus state = 1; +} + +message GetStatusResponse { + CamelStatus 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; +} + +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 new file mode 100644 index 00000000000..b2fd5d5ee71 --- /dev/null +++ b/examples/internal/proto/examplepb/camel_case_service.swagger.json @@ -0,0 +1,160 @@ +{ + "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": [ + "CAMEL_STATUS_UNSPECIFIED", + "CAMEL_STATUS_AVAILABLE", + "CAMEL_STATUS_PENDING" + ] + } + ], + "tags": [ + "Camel_Case_service" + ] + } + } + }, + "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/examplepbCamelStatus" + } + } + }, + "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." + } + } +} 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.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/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..d252936225b 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 || !g.useOpaqueAPI { + 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 +} 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) +}