From 2c992f857210fd14a9e09dba99ae88a14c437cce Mon Sep 17 00:00:00 2001 From: Atreya <44151328+atreya2011@users.noreply.github.com> Date: Tue, 27 Apr 2021 17:34:11 +0900 Subject: [PATCH] add support for rendering url search params in path for GET requests --- README.md | 41 +- generator/template.go | 145 +++- integration_tests/README.md | 2 + integration_tests/integration_test.ts | 28 +- integration_tests/msg.pb.go | 109 ++- integration_tests/msg.proto | 4 + integration_tests/scripts/gen-server-proto.sh | 10 +- integration_tests/service.go | 26 + integration_tests/service.pb.go | 680 +++++++++++++++--- integration_tests/service.pb.gw.go | 202 ++++++ integration_tests/service.proto | 40 ++ 11 files changed, 1149 insertions(+), 138 deletions(-) diff --git a/README.md b/README.md index c9ade91..f5cb9b5 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,56 @@ # protoc-gen-grpc-gateway-ts -`protoc-gen-grpc-gateway-ts` is a Typescript client generator for the [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway/) project. It generates idiomatic Typescript clients that connect the web frontend and golang backend fronted by grpc-gateway. - +`protoc-gen-grpc-gateway-ts` is a TypeScript client generator for the [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway/) project. It generates idiomatic TypeScript clients that connect the web frontend and golang backend fronted by grpc-gateway. ## Features: -1. idiomatic Typescript clients and messages -2. Supports both One way and server side streaming gRPC calls -3. POJO request construction guarded by message type definitions, which is way easier compare to `grpc-web` +1. Idiomatic Typescript clients and messages. +2. Supports both one way and server side streaming gRPC calls. +3. POJO request construction guarded by message type definitions, which is way easier compare to `grpc-web`. 4. No need to use swagger/open api to generate client code for the web. -## Get Started +## Getting Started: ### Install `protoc-gen-grpc-gateway-ts` -You will need to install `protoc-gen-grpc-gateway-ts` before it could be picked up by the `protoc` command. Just run `cd protoc-gen-grpc-gateway-ts; go install .` +You will need to install `protoc-gen-grpc-gateway-ts` before it could be picked up by the `protoc` command. Just run `go install github.com/grpc-ecosystem/protoc-gen-grpc-gateway-ts` -### Sample Usage -`protoc-gen-grpc-gateway-ts` will be used along with the `protoc` command. A sample invocation looks like the following: +### Sample Usage: +`protoc-gen-grpc-gateway-ts` should be used along with the `protoc` command. A sample invocation looks like the following: `protoc --grpc-gateway-ts_out=ts_import_roots=$(pwd),ts_import_root_aliases=base:. input.proto` -As a result the generated file will be `input.pb.ts` in the same directory. +As a result the generated file will be `input.pb.ts` in the same directory. ## Parameters: ### `ts_import_roots` -Since a protoc plugin do not get the import path information as what's specified in `protoc -I`, this parameter gives the plugin the same information to figure out where a specific type is coming from so that it can generate `import` statement at the top of the generated typescript file. Defaults to `$(pwd)` +Since protoc plugins do not get the import path information as what's specified in `protoc -I`, this parameter gives the plugin the same information to figure out where a specific type is coming from so that it can generate `import` statement at the top of the generated typescript file. Defaults to `$(pwd)` ### `ts_import_root_aliases` -If a project has setup alias for their import. This parameter can be used to keep up with the project setup. It will print out alias instead of relative path in the import statement. Default is "". +If a project has setup an alias for their import. This parameter can be used to keep up with the project setup. It will print out alias instead of relative path in the import statement. Default to "". `ts_import_roots` & `ts_import_root_aliases` are useful when you have setup import alias in your project with the project asset bundler, e.g. Webpack. ### `fetch_module_directory` and `fetch_module_filename` -`protoc-gen-grpc-gateway-ts` will a shared typescript file with communication functions. These two parameters together will determine where the fetch module file is located. Default to `$(pwd)/fetch.pb.ts` +`protoc-gen-grpc-gateway-ts` generates a shared typescript file with communication functions. These two parameters together will determine where the fetch module file is located. Default to `$(pwd)/fetch.pb.ts` ### `use_proto_names` To keep the same convention with `grpc-gateway` v2 & `protojson`. The field name in message generated by this library is in lowerCamelCase by default. If you prefer to make it stick the same with what is defined in the proto file, this option needs to be set to true. ### `logtostderr` -Turn Ton logging to stderr. Default to false. +Turn on logging to stderr. Default to false. ### `loglevel` Defines the logging levels. Default to info. Valid values are: debug, info, warn, error +### Notes: +Zero-value fields are omitted from the URL query parameter list for GET requests. Therefore for a request payload such as `{ a: "A", b: "" c: 1, d: 0, e: false }` will become `/path/query?a=A&c=1`. A sample implementation is present within this [proto file](https://github.com/grpc-ecosystem/protoc-gen-grpc-gateway-ts/blob/master/integration_tests/service.proto) in the`integration_tests` folder. For further explanation please read the following: +- +- + ## Examples: -The following shows how to use the generated typescript code. +The following shows how to use the generated TypeScript code. Proto file: `counter.proto` + ```proto // file: counter.proto message Request { @@ -62,7 +67,7 @@ service CounterService { } ``` -Run the following command to generate the Typescript client: +Run the following command to generate the TypeScript client: `protoc --grpc-gateway-ts_out=. counter.proto` @@ -90,7 +95,8 @@ async function increaseRepeatedly(base: number): Promise { ``` -##License +## License + ```text Copyright 2020 Square, Inc. @@ -106,4 +112,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` - diff --git a/generator/template.go b/generator/template.go index 7cdcf8c..e26ccce 100644 --- a/generator/template.go +++ b/generator/template.go @@ -3,6 +3,7 @@ package generator import ( "bytes" "fmt" + "net/url" "regexp" "strings" "text/template" @@ -195,6 +196,123 @@ function getNotifyEntityArrivalSink(notifyCallback: NotifyStreamEntityArrival } }) } + +type Primitive = string | boolean | number; +type RequestPayload = Record; +type FlattenedRequestPayload = Record>; + +/** + * Checks if given value is a plain object + * Logic copied and adapted from below source: + * https://github.com/char0n/ramda-adjunct/blob/master/src/isPlainObj.js + * @param {unknown} value + * @return {boolean} + */ +function isPlainObject(value: unknown): boolean { + const isObject = + Object.prototype.toString.call(value).slice(8, -1) === "Object"; + const isObjLike = value !== null && isObject; + + if (!isObjLike || !isObject) { + return false; + } + + const proto = Object.getPrototypeOf(value); + + const hasObjectConstructor = + typeof proto === "object" && + proto.constructor === Object.prototype.constructor; + + return hasObjectConstructor; +} + +/** + * Checks if given value is of a primitive type + * @param {unknown} value + * @return {boolean} + */ +function isPrimitive(value: unknown): boolean { + return ["string", "number", "boolean"].some(t => typeof value === t); +} + +/** + * Checks if given primitive is zero-value + * @param {Primitive} value + * @return {boolean} + */ +function isZeroValuePrimitive(value: Primitive): boolean { + return value === false || value === 0 || value === ""; +} + +/** + * Flattens a deeply nested request payload and returns an object + * with only primitive values and non-empty array of primitive values + * as per https://github.com/googleapis/googleapis/blob/master/google/api/http.proto + * @param {RequestPayload} requestPayload + * @param {String} path + * @return {FlattenedRequestPayload>} + */ +function flattenRequestPayload( + requestPayload: T, + path: string = "" +): FlattenedRequestPayload { + return Object.keys(requestPayload).reduce( + (acc: T, key: string): T => { + const value = requestPayload[key]; + const newPath = path ? [path, key].join(".") : key; + + const isNonEmptyPrimitiveArray = + Array.isArray(value) && + value.every(v => isPrimitive(v)) && + value.length > 0; + + const isNonZeroValuePrimitive = + isPrimitive(value) && !isZeroValuePrimitive(value as Primitive); + + let objectToMerge = {}; + + if (isPlainObject(value)) { + objectToMerge = flattenRequestPayload(value as RequestPayload, newPath); + } else if (isNonZeroValuePrimitive || isNonEmptyPrimitiveArray) { + objectToMerge = { [newPath]: value }; + } + + return { ...acc, ...objectToMerge }; + }, + {} as T + ) as FlattenedRequestPayload; +} + +/** + * Renders a deeply nested request payload into a string of URL search + * parameters by first flattening the request payload and then removing keys + * which are already present in the URL path. + * @param {RequestPayload} requestPayload + * @param {string[]} urlPathParams + * @return {string} + */ +export function renderURLSearchParams( + requestPayload: T, + urlPathParams: string[] = [] +): string { + const flattenedRequestPayload = flattenRequestPayload(requestPayload); + + const urlSearchParams = Object.keys(flattenedRequestPayload).reduce( + (acc: string[][], key: string): string[][] => { + // key should not be present in the url path as a parameter + const value = flattenedRequestPayload[key]; + if (urlPathParams.find(f => f === key)) { + return acc; + } + return Array.isArray(value) + ? [...acc, ...value.map(m => [key, m.toString()])] + : (acc = [...acc, [key, value.toString()]]); + }, + [] as string[][] + ); + + return new URLSearchParams(urlSearchParams).toString(); +} ` // GetTemplate gets the templates to for the typescript file @@ -229,20 +347,39 @@ func fieldName(r *registry.Registry) func(name string) string { func renderURL(r *registry.Registry) func(method data.Method) string { fieldNameFn := fieldName(r) return func(method data.Method) string { - url := method.URL + methodURL := method.URL reg := regexp.MustCompile("{([^}]+)}") - matches := reg.FindAllStringSubmatch(url, -1) + matches := reg.FindAllStringSubmatch(methodURL, -1) + fieldsInPath := make([]string, 0, len(matches)) if len(matches) > 0 { log.Debugf("url matches %v", matches) for _, m := range matches { expToReplace := m[0] fieldName := fieldNameFn(m[1]) part := fmt.Sprintf(`${req["%s"]}`, fieldName) - url = strings.ReplaceAll(url, expToReplace, part) + methodURL = strings.ReplaceAll(methodURL, expToReplace, part) + fieldsInPath = append(fieldsInPath, fmt.Sprintf(`"%s"`, fieldName)) + } + } + urlPathParams := fmt.Sprintf("[%s]", strings.Join(fieldsInPath, ", ")) + + if !method.ClientStreaming && method.HTTPMethod == "GET" { + // parse the url to check for query string + parsedURL, err := url.Parse(methodURL) + if err != nil { + return methodURL + } + renderURLSearchParamsFn := fmt.Sprintf("${fm.renderURLSearchParams(req, %s)}", urlPathParams) + // prepend "&" if query string is present otherwise prepend "?" + // trim leading "&" if present before prepending it + if parsedURL.RawQuery != "" { + methodURL = strings.TrimRight(methodURL, "&") + "&" + renderURLSearchParamsFn + } else { + methodURL += "?" + renderURLSearchParamsFn } } - return url + return methodURL } } diff --git a/integration_tests/README.md b/integration_tests/README.md index f8cf34a..feb3ae6 100644 --- a/integration_tests/README.md +++ b/integration_tests/README.md @@ -1,7 +1,9 @@ # Integration test The integration test first runs `./scripts/gen-protos.sh` again to generate Typescript file for the proto `service.proto`. + Then it starts `main.go` server that loads up the protos and run tests via `Karma` to verify if the generated client works properly. + The JS integration test file is `integration_test.ts`. Changes on the server side needs to run `./scripts/gen-server-proto.sh` to update the protos and the implementation is in `service.go`. diff --git a/integration_tests/integration_test.ts b/integration_tests/integration_test.ts index a30ebc4..abf348c 100644 --- a/integration_tests/integration_test.ts +++ b/integration_tests/integration_test.ts @@ -14,47 +14,55 @@ function getField(obj: {[key: string]: any}, name: string) { describe("test grpc-gateway-ts communication", () => { it("unary request", async () => { - const result = await CounterService.Increment({counter: 199}, {pathPrefix: "http://localhost:8081"}) + const result = await CounterService.Increment({ counter: 199 }, { pathPrefix: "http://localhost:8081" }) expect(result.result).to.equal(200) }) it('streaming request', async () => { const response = [] as number[] - await CounterService.StreamingIncrements({counter: 1}, (resp) => response.push(resp.result), {pathPrefix: "http://localhost:8081"}) + await CounterService.StreamingIncrements({ counter: 1 }, (resp) => response.push(resp.result), { pathPrefix: "http://localhost:8081" }) - expect(response).to.deep.equal([2,3,4,5,6]) + expect(response).to.deep.equal([2, 3, 4, 5, 6]) }) it('http get check request', async () => { - const result = await CounterService.HTTPGet({[getFieldName('num_to_increase')]: 10}, {pathPrefix: "http://localhost:8081"}) + const result = await CounterService.HTTPGet({ [getFieldName('num_to_increase')]: 10 }, { pathPrefix: "http://localhost:8081" }) expect(result.result).to.equal(11) }) it('http post body check request with nested body path', async () => { - const result = await CounterService.HTTPPostWithNestedBodyPath({a: 10, req: { b: 15 }}, {pathPrefix: "http://localhost:8081"}) + const result = await CounterService.HTTPPostWithNestedBodyPath({ a: 10, req: { b: 15 } }, { pathPrefix: "http://localhost:8081" }) expect(getField(result, 'post_result')).to.equal(25) }) - it('http post body check request with star in path', async () => { - const result = await CounterService.HTTPPostWithStarBodyPath({a: 10, req: { b: 15 }, c: 23}, {pathPrefix: "http://localhost:8081"}) + const result = await CounterService.HTTPPostWithStarBodyPath({ a: 10, req: { b: 15 }, c: 23 }, { pathPrefix: "http://localhost:8081" }) expect(getField(result, 'post_result')).to.equal(48) }) it('able to communicate with external message reference without package defined', async () => { - const result = await CounterService.ExternalMessage({ content: "hello" }, {pathPrefix: "http://localhost:8081"}) + const result = await CounterService.ExternalMessage({ content: "hello" }, { pathPrefix: "http://localhost:8081" }) expect(getField(result, 'result')).to.equal("hello!!") }) it('http patch request with star in path', async () => { - const result = await CounterService.HTTPPatch({a: 10, c: 23}, {pathPrefix: "http://localhost:8081"}) + const result = await CounterService.HTTPPatch({ a: 10, c: 23 }, { pathPrefix: "http://localhost:8081" }) expect(getField(result, 'patch_result')).to.equal(33) }) it('http delete check request', async () => { - const result = await CounterService.HTTPDelete({a: 10}, {pathPrefix: "http://localhost:8081"}) + const result = await CounterService.HTTPDelete({ a: 10 }, { pathPrefix: "http://localhost:8081" }) expect(result).to.be.empty }) + + it('http get request with url search parameters', async () => { + const result = await CounterService.HTTPGetWithURLSearchParams({ a: 10, [getFieldName('post_req')]: { b: 0 }, c: [23, 25], [getFieldName('ext_msg')]: { d: 12 } }, { pathPrefix: "http://localhost:8081" }) + expect(getField(result, 'url_search_params_result')).to.equal(70) + }) + it('http get request with zero value url search parameters', async () => { + const result = await CounterService.HTTPGetWithZeroValueURLSearchParams({ a: "A", b: "", [getFieldName('zero_value_msg')]: { c: 1, d: [1, 0, 2], e: false } }, { pathPrefix: "http://localhost:8081" }) + expect(result).to.deep.equal({ a: "A", b: "hello", [getFieldName('zero_value_msg')]: { c: 2, d: [2, 1, 3], e: true } }) + }) }) diff --git a/integration_tests/msg.pb.go b/integration_tests/msg.pb.go index e3abbe9..6a23ebd 100644 --- a/integration_tests/msg.pb.go +++ b/integration_tests/msg.pb.go @@ -1,12 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 +// protoc-gen-go v1.25.0 +// protoc v3.15.6 // source: msg.proto package main import ( + proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -20,6 +21,57 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type ExternalMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + D int32 `protobuf:"varint,1,opt,name=d,proto3" json:"d,omitempty"` +} + +func (x *ExternalMessage) Reset() { + *x = ExternalMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_msg_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExternalMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExternalMessage) ProtoMessage() {} + +func (x *ExternalMessage) ProtoReflect() protoreflect.Message { + mi := &file_msg_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExternalMessage.ProtoReflect.Descriptor instead. +func (*ExternalMessage) Descriptor() ([]byte, []int) { + return file_msg_proto_rawDescGZIP(), []int{0} +} + +func (x *ExternalMessage) GetD() int32 { + if x != nil { + return x.D + } + return 0 +} + type ExternalRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -31,7 +83,7 @@ type ExternalRequest struct { func (x *ExternalRequest) Reset() { *x = ExternalRequest{} if protoimpl.UnsafeEnabled { - mi := &file_msg_proto_msgTypes[0] + mi := &file_msg_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -44,7 +96,7 @@ func (x *ExternalRequest) String() string { func (*ExternalRequest) ProtoMessage() {} func (x *ExternalRequest) ProtoReflect() protoreflect.Message { - mi := &file_msg_proto_msgTypes[0] + mi := &file_msg_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -57,7 +109,7 @@ func (x *ExternalRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ExternalRequest.ProtoReflect.Descriptor instead. func (*ExternalRequest) Descriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{0} + return file_msg_proto_rawDescGZIP(), []int{1} } func (x *ExternalRequest) GetContent() string { @@ -78,7 +130,7 @@ type ExternalResponse struct { func (x *ExternalResponse) Reset() { *x = ExternalResponse{} if protoimpl.UnsafeEnabled { - mi := &file_msg_proto_msgTypes[1] + mi := &file_msg_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91,7 +143,7 @@ func (x *ExternalResponse) String() string { func (*ExternalResponse) ProtoMessage() {} func (x *ExternalResponse) ProtoReflect() protoreflect.Message { - mi := &file_msg_proto_msgTypes[1] + mi := &file_msg_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104,7 +156,7 @@ func (x *ExternalResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ExternalResponse.ProtoReflect.Descriptor instead. func (*ExternalResponse) Descriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{1} + return file_msg_proto_rawDescGZIP(), []int{2} } func (x *ExternalResponse) GetResult() string { @@ -117,14 +169,16 @@ func (x *ExternalResponse) GetResult() string { var File_msg_proto protoreflect.FileDescriptor var file_msg_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x0f, 0x45, - 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, - 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x2a, 0x0a, 0x10, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x3b, 0x6d, 0x61, 0x69, 0x6e, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1f, 0x0a, 0x0f, 0x45, + 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0c, + 0x0a, 0x01, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x64, 0x22, 0x2b, 0x0a, 0x0f, + 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x2a, 0x0a, 0x10, 0x45, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x3b, 0x6d, 0x61, 0x69, 0x6e, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -139,10 +193,11 @@ func file_msg_proto_rawDescGZIP() []byte { return file_msg_proto_rawDescData } -var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_msg_proto_goTypes = []interface{}{ - (*ExternalRequest)(nil), // 0: ExternalRequest - (*ExternalResponse)(nil), // 1: ExternalResponse + (*ExternalMessage)(nil), // 0: ExternalMessage + (*ExternalRequest)(nil), // 1: ExternalRequest + (*ExternalResponse)(nil), // 2: ExternalResponse } var file_msg_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -159,7 +214,7 @@ func file_msg_proto_init() { } if !protoimpl.UnsafeEnabled { file_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExternalRequest); i { + switch v := v.(*ExternalMessage); i { case 0: return &v.state case 1: @@ -171,6 +226,18 @@ func file_msg_proto_init() { } } file_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExternalRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ExternalResponse); i { case 0: return &v.state @@ -189,7 +256,7 @@ func file_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/integration_tests/msg.proto b/integration_tests/msg.proto index 1e8f935..0d6bbbd 100644 --- a/integration_tests/msg.proto +++ b/integration_tests/msg.proto @@ -1,6 +1,10 @@ syntax = "proto3"; option go_package = "./;main"; +message ExternalMessage { + int32 d = 1; +} + message ExternalRequest { string content = 1; } diff --git a/integration_tests/scripts/gen-server-proto.sh b/integration_tests/scripts/gen-server-proto.sh index b6485d9..3d52023 100755 --- a/integration_tests/scripts/gen-server-proto.sh +++ b/integration_tests/scripts/gen-server-proto.sh @@ -1,7 +1,15 @@ #!/bin/bash +# remove binaries to ensure that binaries present in tools.go are installed +rm -f $GOBIN/protoc-gen-go $GOBIN/protoc-gen-grpc-gateway $GOBIN/protoc-gen-swagger + +go install \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger + protoc -I . -I ../.. --go_out ./ --go_opt plugins=grpc --go_opt paths=source_relative \ --grpc-gateway_out ./ --grpc-gateway_opt logtostderr=true \ --grpc-gateway_opt paths=source_relative \ --grpc-gateway_opt generate_unbound_methods=true \ - service.proto msg.proto \ No newline at end of file + service.proto msg.proto diff --git a/integration_tests/service.go b/integration_tests/service.go index e8fd757..1e0649d 100644 --- a/integration_tests/service.go +++ b/integration_tests/service.go @@ -67,3 +67,29 @@ func (r *RealCounterService) HTTPPatch(ctx context.Context, in *HttpPatchRequest func (r *RealCounterService) HTTPDelete(ctx context.Context, req *HttpDeleteRequest) (*emptypb.Empty, error) { return &emptypb.Empty{}, nil } + +func (r *RealCounterService) HTTPGetWithURLSearchParams(ctx context.Context, in *HTTPGetWithURLSearchParamsRequest) (*HTTPGetWithURLSearchParamsResponse, error) { + totalC := 0 + for _, c := range in.GetC() { + totalC += int(c) + } + return &HTTPGetWithURLSearchParamsResponse{ + UrlSearchParamsResult: in.GetA() + in.PostReq.GetB() + in.ExtMsg.GetD() + int32(totalC), + }, nil +} + +func (r *RealCounterService) HTTPGetWithZeroValueURLSearchParams(ctx context.Context, in *HTTPGetWithZeroValueURLSearchParamsRequest) (*HTTPGetWithZeroValueURLSearchParamsResponse, error) { + var incrementedD []int32 + for _, d := range in.ZeroValueMsg.GetD() { + incrementedD = append(incrementedD, d+1) + } + return &HTTPGetWithZeroValueURLSearchParamsResponse{ + A: in.GetA(), + B: in.GetB() + "hello", + ZeroValueMsg: &ZeroValueMsg{ + C: in.ZeroValueMsg.GetC() + 1, + D: incrementedD, + E: !in.ZeroValueMsg.GetE(), + }, + }, nil +} diff --git a/integration_tests/service.pb.go b/integration_tests/service.pb.go index 9e9778f..cb3894e 100644 --- a/integration_tests/service.pb.go +++ b/integration_tests/service.pb.go @@ -1,13 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 +// protoc-gen-go v1.25.0 +// protoc v3.15.6 // source: service.proto package main import ( context "context" + proto "github.com/golang/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -26,6 +27,10 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + type UnaryRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -614,6 +619,313 @@ func (x *HttpDeleteRequest) GetA() int32 { return 0 } +type HTTPGetWithURLSearchParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + A int32 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` + PostReq *PostRequest `protobuf:"bytes,2,opt,name=post_req,json=postReq,proto3" json:"post_req,omitempty"` + C []int32 `protobuf:"varint,3,rep,packed,name=c,proto3" json:"c,omitempty"` + ExtMsg *ExternalMessage `protobuf:"bytes,4,opt,name=ext_msg,json=extMsg,proto3" json:"ext_msg,omitempty"` +} + +func (x *HTTPGetWithURLSearchParamsRequest) Reset() { + *x = HTTPGetWithURLSearchParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HTTPGetWithURLSearchParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HTTPGetWithURLSearchParamsRequest) ProtoMessage() {} + +func (x *HTTPGetWithURLSearchParamsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HTTPGetWithURLSearchParamsRequest.ProtoReflect.Descriptor instead. +func (*HTTPGetWithURLSearchParamsRequest) Descriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{12} +} + +func (x *HTTPGetWithURLSearchParamsRequest) GetA() int32 { + if x != nil { + return x.A + } + return 0 +} + +func (x *HTTPGetWithURLSearchParamsRequest) GetPostReq() *PostRequest { + if x != nil { + return x.PostReq + } + return nil +} + +func (x *HTTPGetWithURLSearchParamsRequest) GetC() []int32 { + if x != nil { + return x.C + } + return nil +} + +func (x *HTTPGetWithURLSearchParamsRequest) GetExtMsg() *ExternalMessage { + if x != nil { + return x.ExtMsg + } + return nil +} + +type HTTPGetWithURLSearchParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UrlSearchParamsResult int32 `protobuf:"varint,1,opt,name=url_search_params_result,json=urlSearchParamsResult,proto3" json:"url_search_params_result,omitempty"` +} + +func (x *HTTPGetWithURLSearchParamsResponse) Reset() { + *x = HTTPGetWithURLSearchParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HTTPGetWithURLSearchParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HTTPGetWithURLSearchParamsResponse) ProtoMessage() {} + +func (x *HTTPGetWithURLSearchParamsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HTTPGetWithURLSearchParamsResponse.ProtoReflect.Descriptor instead. +func (*HTTPGetWithURLSearchParamsResponse) Descriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{13} +} + +func (x *HTTPGetWithURLSearchParamsResponse) GetUrlSearchParamsResult() int32 { + if x != nil { + return x.UrlSearchParamsResult + } + return 0 +} + +type ZeroValueMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + C int32 `protobuf:"varint,1,opt,name=c,proto3" json:"c,omitempty"` + D []int32 `protobuf:"varint,2,rep,packed,name=d,proto3" json:"d,omitempty"` + E bool `protobuf:"varint,3,opt,name=e,proto3" json:"e,omitempty"` +} + +func (x *ZeroValueMsg) Reset() { + *x = ZeroValueMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ZeroValueMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ZeroValueMsg) ProtoMessage() {} + +func (x *ZeroValueMsg) ProtoReflect() protoreflect.Message { + mi := &file_service_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ZeroValueMsg.ProtoReflect.Descriptor instead. +func (*ZeroValueMsg) Descriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{14} +} + +func (x *ZeroValueMsg) GetC() int32 { + if x != nil { + return x.C + } + return 0 +} + +func (x *ZeroValueMsg) GetD() []int32 { + if x != nil { + return x.D + } + return nil +} + +func (x *ZeroValueMsg) GetE() bool { + if x != nil { + return x.E + } + return false +} + +type HTTPGetWithZeroValueURLSearchParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + A string `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` + B string `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` + ZeroValueMsg *ZeroValueMsg `protobuf:"bytes,3,opt,name=zero_value_msg,json=zeroValueMsg,proto3" json:"zero_value_msg,omitempty"` +} + +func (x *HTTPGetWithZeroValueURLSearchParamsRequest) Reset() { + *x = HTTPGetWithZeroValueURLSearchParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HTTPGetWithZeroValueURLSearchParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HTTPGetWithZeroValueURLSearchParamsRequest) ProtoMessage() {} + +func (x *HTTPGetWithZeroValueURLSearchParamsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HTTPGetWithZeroValueURLSearchParamsRequest.ProtoReflect.Descriptor instead. +func (*HTTPGetWithZeroValueURLSearchParamsRequest) Descriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{15} +} + +func (x *HTTPGetWithZeroValueURLSearchParamsRequest) GetA() string { + if x != nil { + return x.A + } + return "" +} + +func (x *HTTPGetWithZeroValueURLSearchParamsRequest) GetB() string { + if x != nil { + return x.B + } + return "" +} + +func (x *HTTPGetWithZeroValueURLSearchParamsRequest) GetZeroValueMsg() *ZeroValueMsg { + if x != nil { + return x.ZeroValueMsg + } + return nil +} + +type HTTPGetWithZeroValueURLSearchParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + A string `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` + B string `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` + ZeroValueMsg *ZeroValueMsg `protobuf:"bytes,3,opt,name=zero_value_msg,json=zeroValueMsg,proto3" json:"zero_value_msg,omitempty"` +} + +func (x *HTTPGetWithZeroValueURLSearchParamsResponse) Reset() { + *x = HTTPGetWithZeroValueURLSearchParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HTTPGetWithZeroValueURLSearchParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HTTPGetWithZeroValueURLSearchParamsResponse) ProtoMessage() {} + +func (x *HTTPGetWithZeroValueURLSearchParamsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HTTPGetWithZeroValueURLSearchParamsResponse.ProtoReflect.Descriptor instead. +func (*HTTPGetWithZeroValueURLSearchParamsResponse) Descriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{16} +} + +func (x *HTTPGetWithZeroValueURLSearchParamsResponse) GetA() string { + if x != nil { + return x.A + } + return "" +} + +func (x *HTTPGetWithZeroValueURLSearchParamsResponse) GetB() string { + if x != nil { + return x.B + } + return "" +} + +func (x *HTTPGetWithZeroValueURLSearchParamsResponse) GetZeroValueMsg() *ZeroValueMsg { + if x != nil { + return x.ZeroValueMsg + } + return nil +} + var File_service_proto protoreflect.FileDescriptor var file_service_proto_rawDesc = []byte{ @@ -658,50 +970,104 @@ var file_service_proto_rawDesc = []byte{ 0x63, 0x68, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x21, 0x0a, 0x11, 0x48, 0x74, 0x74, 0x70, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x61, 0x32, - 0x8f, 0x05, 0x0a, 0x0e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x12, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x55, 0x6e, 0x61, 0x72, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x13, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, - 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x30, 0x01, 0x12, 0x56, 0x0a, 0x07, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x12, 0x14, 0x2e, - 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x7b, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x6f, - 0x5f, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x7d, 0x12, 0x63, 0x0a, 0x1a, 0x48, 0x54, - 0x54, 0x50, 0x50, 0x6f, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, - 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x15, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, - 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x22, - 0x09, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2f, 0x7b, 0x61, 0x7d, 0x3a, 0x03, 0x72, 0x65, 0x71, 0x12, - 0x63, 0x0a, 0x18, 0x48, 0x54, 0x54, 0x50, 0x50, 0x6f, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x53, - 0x74, 0x61, 0x72, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x15, 0x2e, 0x6d, 0x61, - 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x12, 0x22, 0x0d, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x7b, 0x63, - 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x4f, 0x0a, 0x09, 0x48, 0x54, 0x54, 0x50, 0x50, 0x61, 0x74, 0x63, - 0x68, 0x12, 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, - 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, - 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x32, 0x06, 0x2f, 0x70, 0x61, 0x74, - 0x63, 0x68, 0x3a, 0x01, 0x2a, 0x12, 0x52, 0x0a, 0x0a, 0x48, 0x54, 0x54, 0x50, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x12, 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x2a, 0x0b, 0x2f, 0x64, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x2f, 0x7b, 0x61, 0x7d, 0x12, 0x36, 0x0a, 0x0f, 0x45, 0x78, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x10, 0x2e, 0x45, - 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, - 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x3b, 0x6d, 0x61, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x61, 0x22, + 0x98, 0x01, 0x0a, 0x21, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x55, + 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x01, 0x61, 0x12, 0x2c, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x50, 0x6f, 0x73, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x70, 0x6f, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x12, 0x0c, 0x0a, 0x01, 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x01, 0x63, 0x12, + 0x29, 0x0a, 0x07, 0x65, 0x78, 0x74, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x52, 0x06, 0x65, 0x78, 0x74, 0x4d, 0x73, 0x67, 0x22, 0x5d, 0x0a, 0x22, 0x48, 0x54, + 0x54, 0x50, 0x47, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x55, 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x37, 0x0a, 0x18, 0x75, 0x72, 0x6c, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x15, 0x75, 0x72, 0x6c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x38, 0x0a, 0x0c, 0x5a, 0x65, 0x72, + 0x6f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x73, 0x67, 0x12, 0x0c, 0x0a, 0x01, 0x63, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x63, 0x12, 0x0c, 0x0a, 0x01, 0x64, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x05, 0x52, 0x01, 0x64, 0x12, 0x0c, 0x0a, 0x01, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x01, 0x65, 0x22, 0x82, 0x01, 0x0a, 0x2a, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x57, + 0x69, 0x74, 0x68, 0x5a, 0x65, 0x72, 0x6f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x55, 0x52, 0x4c, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x61, + 0x12, 0x0c, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x62, 0x12, 0x38, + 0x0a, 0x0e, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x73, 0x67, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x5a, 0x65, + 0x72, 0x6f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x0c, 0x7a, 0x65, 0x72, 0x6f, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x73, 0x67, 0x22, 0x83, 0x01, 0x0a, 0x2b, 0x48, 0x54, 0x54, + 0x50, 0x47, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x5a, 0x65, 0x72, 0x6f, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x55, 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x01, 0x61, 0x12, 0x0c, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x01, 0x62, 0x12, 0x38, 0x0a, 0x0e, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, + 0x61, 0x69, 0x6e, 0x2e, 0x5a, 0x65, 0x72, 0x6f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x73, 0x67, + 0x52, 0x0c, 0x7a, 0x65, 0x72, 0x6f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x73, 0x67, 0x32, 0xbb, + 0x07, 0x0a, 0x0e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x34, 0x0a, 0x09, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, + 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x13, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x16, + 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, + 0x01, 0x12, 0x56, 0x0a, 0x07, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x12, 0x14, 0x2e, 0x6d, + 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x7b, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x6f, 0x5f, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x7d, 0x12, 0x63, 0x0a, 0x1a, 0x48, 0x54, 0x54, + 0x50, 0x50, 0x6f, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x42, + 0x6f, 0x64, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x15, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, + 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, + 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x22, 0x09, + 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2f, 0x7b, 0x61, 0x7d, 0x3a, 0x03, 0x72, 0x65, 0x71, 0x12, 0x63, + 0x0a, 0x18, 0x48, 0x54, 0x54, 0x50, 0x50, 0x6f, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x53, 0x74, + 0x61, 0x72, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x15, 0x2e, 0x6d, 0x61, 0x69, + 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x12, 0x22, 0x0d, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x7b, 0x63, 0x7d, + 0x3a, 0x01, 0x2a, 0x12, 0x4f, 0x0a, 0x09, 0x48, 0x54, 0x54, 0x50, 0x50, 0x61, 0x74, 0x63, 0x68, + 0x12, 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x63, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, + 0x48, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x32, 0x06, 0x2f, 0x70, 0x61, 0x74, 0x63, + 0x68, 0x3a, 0x01, 0x2a, 0x12, 0x52, 0x0a, 0x0a, 0x48, 0x54, 0x54, 0x50, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x12, 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x2a, 0x0b, 0x2f, 0x64, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x2f, 0x7b, 0x61, 0x7d, 0x12, 0x36, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x10, 0x2e, 0x45, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, + 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x87, 0x01, 0x0a, 0x1a, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, + 0x55, 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x27, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x57, 0x69, + 0x74, 0x68, 0x55, 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, + 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x55, 0x52, 0x4c, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x7b, 0x61, 0x7d, 0x12, 0x9f, 0x01, 0x0a, 0x23, 0x48, + 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x5a, 0x65, 0x72, 0x6f, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x55, 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x30, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, + 0x74, 0x57, 0x69, 0x74, 0x68, 0x5a, 0x65, 0x72, 0x6f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x55, 0x52, + 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x54, 0x54, 0x50, + 0x47, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x5a, 0x65, 0x72, 0x6f, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x55, 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12, + 0x0b, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x42, 0x09, 0x5a, 0x07, + 0x2e, 0x2f, 0x3b, 0x6d, 0x61, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -716,47 +1082,61 @@ func file_service_proto_rawDescGZIP() []byte { return file_service_proto_rawDescData } -var file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_service_proto_goTypes = []interface{}{ - (*UnaryRequest)(nil), // 0: main.UnaryRequest - (*UnaryResponse)(nil), // 1: main.UnaryResponse - (*StreamingRequest)(nil), // 2: main.StreamingRequest - (*StreamingResponse)(nil), // 3: main.StreamingResponse - (*HttpGetRequest)(nil), // 4: main.HttpGetRequest - (*HttpGetResponse)(nil), // 5: main.HttpGetResponse - (*HttpPostRequest)(nil), // 6: main.HttpPostRequest - (*PostRequest)(nil), // 7: main.PostRequest - (*HttpPostResponse)(nil), // 8: main.HttpPostResponse - (*HttpPatchRequest)(nil), // 9: main.HttpPatchRequest - (*HttpPatchResponse)(nil), // 10: main.HttpPatchResponse - (*HttpDeleteRequest)(nil), // 11: main.HttpDeleteRequest - (*ExternalRequest)(nil), // 12: ExternalRequest - (*emptypb.Empty)(nil), // 13: google.protobuf.Empty - (*ExternalResponse)(nil), // 14: ExternalResponse + (*UnaryRequest)(nil), // 0: main.UnaryRequest + (*UnaryResponse)(nil), // 1: main.UnaryResponse + (*StreamingRequest)(nil), // 2: main.StreamingRequest + (*StreamingResponse)(nil), // 3: main.StreamingResponse + (*HttpGetRequest)(nil), // 4: main.HttpGetRequest + (*HttpGetResponse)(nil), // 5: main.HttpGetResponse + (*HttpPostRequest)(nil), // 6: main.HttpPostRequest + (*PostRequest)(nil), // 7: main.PostRequest + (*HttpPostResponse)(nil), // 8: main.HttpPostResponse + (*HttpPatchRequest)(nil), // 9: main.HttpPatchRequest + (*HttpPatchResponse)(nil), // 10: main.HttpPatchResponse + (*HttpDeleteRequest)(nil), // 11: main.HttpDeleteRequest + (*HTTPGetWithURLSearchParamsRequest)(nil), // 12: main.HTTPGetWithURLSearchParamsRequest + (*HTTPGetWithURLSearchParamsResponse)(nil), // 13: main.HTTPGetWithURLSearchParamsResponse + (*ZeroValueMsg)(nil), // 14: main.ZeroValueMsg + (*HTTPGetWithZeroValueURLSearchParamsRequest)(nil), // 15: main.HTTPGetWithZeroValueURLSearchParamsRequest + (*HTTPGetWithZeroValueURLSearchParamsResponse)(nil), // 16: main.HTTPGetWithZeroValueURLSearchParamsResponse + (*ExternalMessage)(nil), // 17: ExternalMessage + (*ExternalRequest)(nil), // 18: ExternalRequest + (*emptypb.Empty)(nil), // 19: google.protobuf.Empty + (*ExternalResponse)(nil), // 20: ExternalResponse } var file_service_proto_depIdxs = []int32{ 7, // 0: main.HttpPostRequest.req:type_name -> main.PostRequest - 0, // 1: main.CounterService.Increment:input_type -> main.UnaryRequest - 2, // 2: main.CounterService.StreamingIncrements:input_type -> main.StreamingRequest - 4, // 3: main.CounterService.HTTPGet:input_type -> main.HttpGetRequest - 6, // 4: main.CounterService.HTTPPostWithNestedBodyPath:input_type -> main.HttpPostRequest - 6, // 5: main.CounterService.HTTPPostWithStarBodyPath:input_type -> main.HttpPostRequest - 9, // 6: main.CounterService.HTTPPatch:input_type -> main.HttpPatchRequest - 11, // 7: main.CounterService.HTTPDelete:input_type -> main.HttpDeleteRequest - 12, // 8: main.CounterService.ExternalMessage:input_type -> ExternalRequest - 1, // 9: main.CounterService.Increment:output_type -> main.UnaryResponse - 3, // 10: main.CounterService.StreamingIncrements:output_type -> main.StreamingResponse - 5, // 11: main.CounterService.HTTPGet:output_type -> main.HttpGetResponse - 8, // 12: main.CounterService.HTTPPostWithNestedBodyPath:output_type -> main.HttpPostResponse - 8, // 13: main.CounterService.HTTPPostWithStarBodyPath:output_type -> main.HttpPostResponse - 10, // 14: main.CounterService.HTTPPatch:output_type -> main.HttpPatchResponse - 13, // 15: main.CounterService.HTTPDelete:output_type -> google.protobuf.Empty - 14, // 16: main.CounterService.ExternalMessage:output_type -> ExternalResponse - 9, // [9:17] is the sub-list for method output_type - 1, // [1:9] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 7, // 1: main.HTTPGetWithURLSearchParamsRequest.post_req:type_name -> main.PostRequest + 17, // 2: main.HTTPGetWithURLSearchParamsRequest.ext_msg:type_name -> ExternalMessage + 14, // 3: main.HTTPGetWithZeroValueURLSearchParamsRequest.zero_value_msg:type_name -> main.ZeroValueMsg + 14, // 4: main.HTTPGetWithZeroValueURLSearchParamsResponse.zero_value_msg:type_name -> main.ZeroValueMsg + 0, // 5: main.CounterService.Increment:input_type -> main.UnaryRequest + 2, // 6: main.CounterService.StreamingIncrements:input_type -> main.StreamingRequest + 4, // 7: main.CounterService.HTTPGet:input_type -> main.HttpGetRequest + 6, // 8: main.CounterService.HTTPPostWithNestedBodyPath:input_type -> main.HttpPostRequest + 6, // 9: main.CounterService.HTTPPostWithStarBodyPath:input_type -> main.HttpPostRequest + 9, // 10: main.CounterService.HTTPPatch:input_type -> main.HttpPatchRequest + 11, // 11: main.CounterService.HTTPDelete:input_type -> main.HttpDeleteRequest + 18, // 12: main.CounterService.ExternalMessage:input_type -> ExternalRequest + 12, // 13: main.CounterService.HTTPGetWithURLSearchParams:input_type -> main.HTTPGetWithURLSearchParamsRequest + 15, // 14: main.CounterService.HTTPGetWithZeroValueURLSearchParams:input_type -> main.HTTPGetWithZeroValueURLSearchParamsRequest + 1, // 15: main.CounterService.Increment:output_type -> main.UnaryResponse + 3, // 16: main.CounterService.StreamingIncrements:output_type -> main.StreamingResponse + 5, // 17: main.CounterService.HTTPGet:output_type -> main.HttpGetResponse + 8, // 18: main.CounterService.HTTPPostWithNestedBodyPath:output_type -> main.HttpPostResponse + 8, // 19: main.CounterService.HTTPPostWithStarBodyPath:output_type -> main.HttpPostResponse + 10, // 20: main.CounterService.HTTPPatch:output_type -> main.HttpPatchResponse + 19, // 21: main.CounterService.HTTPDelete:output_type -> google.protobuf.Empty + 20, // 22: main.CounterService.ExternalMessage:output_type -> ExternalResponse + 13, // 23: main.CounterService.HTTPGetWithURLSearchParams:output_type -> main.HTTPGetWithURLSearchParamsResponse + 16, // 24: main.CounterService.HTTPGetWithZeroValueURLSearchParams:output_type -> main.HTTPGetWithZeroValueURLSearchParamsResponse + 15, // [15:25] is the sub-list for method output_type + 5, // [5:15] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_service_proto_init() } @@ -910,6 +1290,66 @@ func file_service_proto_init() { return nil } } + file_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HTTPGetWithURLSearchParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HTTPGetWithURLSearchParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ZeroValueMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HTTPGetWithZeroValueURLSearchParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HTTPGetWithZeroValueURLSearchParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -917,7 +1357,7 @@ func file_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_service_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 17, NumExtensions: 0, NumServices: 1, }, @@ -951,6 +1391,8 @@ type CounterServiceClient interface { HTTPPatch(ctx context.Context, in *HttpPatchRequest, opts ...grpc.CallOption) (*HttpPatchResponse, error) HTTPDelete(ctx context.Context, in *HttpDeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) ExternalMessage(ctx context.Context, in *ExternalRequest, opts ...grpc.CallOption) (*ExternalResponse, error) + HTTPGetWithURLSearchParams(ctx context.Context, in *HTTPGetWithURLSearchParamsRequest, opts ...grpc.CallOption) (*HTTPGetWithURLSearchParamsResponse, error) + HTTPGetWithZeroValueURLSearchParams(ctx context.Context, in *HTTPGetWithZeroValueURLSearchParamsRequest, opts ...grpc.CallOption) (*HTTPGetWithZeroValueURLSearchParamsResponse, error) } type counterServiceClient struct { @@ -1056,6 +1498,24 @@ func (c *counterServiceClient) ExternalMessage(ctx context.Context, in *External return out, nil } +func (c *counterServiceClient) HTTPGetWithURLSearchParams(ctx context.Context, in *HTTPGetWithURLSearchParamsRequest, opts ...grpc.CallOption) (*HTTPGetWithURLSearchParamsResponse, error) { + out := new(HTTPGetWithURLSearchParamsResponse) + err := c.cc.Invoke(ctx, "/main.CounterService/HTTPGetWithURLSearchParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *counterServiceClient) HTTPGetWithZeroValueURLSearchParams(ctx context.Context, in *HTTPGetWithZeroValueURLSearchParamsRequest, opts ...grpc.CallOption) (*HTTPGetWithZeroValueURLSearchParamsResponse, error) { + out := new(HTTPGetWithZeroValueURLSearchParamsResponse) + err := c.cc.Invoke(ctx, "/main.CounterService/HTTPGetWithZeroValueURLSearchParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // CounterServiceServer is the server API for CounterService service. type CounterServiceServer interface { Increment(context.Context, *UnaryRequest) (*UnaryResponse, error) @@ -1066,6 +1526,8 @@ type CounterServiceServer interface { HTTPPatch(context.Context, *HttpPatchRequest) (*HttpPatchResponse, error) HTTPDelete(context.Context, *HttpDeleteRequest) (*emptypb.Empty, error) ExternalMessage(context.Context, *ExternalRequest) (*ExternalResponse, error) + HTTPGetWithURLSearchParams(context.Context, *HTTPGetWithURLSearchParamsRequest) (*HTTPGetWithURLSearchParamsResponse, error) + HTTPGetWithZeroValueURLSearchParams(context.Context, *HTTPGetWithZeroValueURLSearchParamsRequest) (*HTTPGetWithZeroValueURLSearchParamsResponse, error) } // UnimplementedCounterServiceServer can be embedded to have forward compatible implementations. @@ -1096,6 +1558,12 @@ func (*UnimplementedCounterServiceServer) HTTPDelete(context.Context, *HttpDelet func (*UnimplementedCounterServiceServer) ExternalMessage(context.Context, *ExternalRequest) (*ExternalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ExternalMessage not implemented") } +func (*UnimplementedCounterServiceServer) HTTPGetWithURLSearchParams(context.Context, *HTTPGetWithURLSearchParamsRequest) (*HTTPGetWithURLSearchParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HTTPGetWithURLSearchParams not implemented") +} +func (*UnimplementedCounterServiceServer) HTTPGetWithZeroValueURLSearchParams(context.Context, *HTTPGetWithZeroValueURLSearchParamsRequest) (*HTTPGetWithZeroValueURLSearchParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HTTPGetWithZeroValueURLSearchParams not implemented") +} func RegisterCounterServiceServer(s *grpc.Server, srv CounterServiceServer) { s.RegisterService(&_CounterService_serviceDesc, srv) @@ -1248,6 +1716,42 @@ func _CounterService_ExternalMessage_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _CounterService_HTTPGetWithURLSearchParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HTTPGetWithURLSearchParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CounterServiceServer).HTTPGetWithURLSearchParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/main.CounterService/HTTPGetWithURLSearchParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CounterServiceServer).HTTPGetWithURLSearchParams(ctx, req.(*HTTPGetWithURLSearchParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CounterService_HTTPGetWithZeroValueURLSearchParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HTTPGetWithZeroValueURLSearchParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CounterServiceServer).HTTPGetWithZeroValueURLSearchParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/main.CounterService/HTTPGetWithZeroValueURLSearchParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CounterServiceServer).HTTPGetWithZeroValueURLSearchParams(ctx, req.(*HTTPGetWithZeroValueURLSearchParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _CounterService_serviceDesc = grpc.ServiceDesc{ ServiceName: "main.CounterService", HandlerType: (*CounterServiceServer)(nil), @@ -1280,6 +1784,14 @@ var _CounterService_serviceDesc = grpc.ServiceDesc{ MethodName: "ExternalMessage", Handler: _CounterService_ExternalMessage_Handler, }, + { + MethodName: "HTTPGetWithURLSearchParams", + Handler: _CounterService_HTTPGetWithURLSearchParams_Handler, + }, + { + MethodName: "HTTPGetWithZeroValueURLSearchParams", + Handler: _CounterService_HTTPGetWithZeroValueURLSearchParams_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/integration_tests/service.pb.gw.go b/integration_tests/service.pb.gw.go index d8ef044..1e0bb7a 100644 --- a/integration_tests/service.pb.gw.go +++ b/integration_tests/service.pb.gw.go @@ -448,6 +448,114 @@ func local_request_CounterService_ExternalMessage_0(ctx context.Context, marshal } +var ( + filter_CounterService_HTTPGetWithURLSearchParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_CounterService_HTTPGetWithURLSearchParams_0(ctx context.Context, marshaler runtime.Marshaler, client CounterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HTTPGetWithURLSearchParamsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CounterService_HTTPGetWithURLSearchParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HTTPGetWithURLSearchParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_CounterService_HTTPGetWithURLSearchParams_0(ctx context.Context, marshaler runtime.Marshaler, server CounterServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HTTPGetWithURLSearchParamsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CounterService_HTTPGetWithURLSearchParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HTTPGetWithURLSearchParams(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_CounterService_HTTPGetWithZeroValueURLSearchParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_CounterService_HTTPGetWithZeroValueURLSearchParams_0(ctx context.Context, marshaler runtime.Marshaler, client CounterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HTTPGetWithZeroValueURLSearchParamsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CounterService_HTTPGetWithZeroValueURLSearchParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HTTPGetWithZeroValueURLSearchParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_CounterService_HTTPGetWithZeroValueURLSearchParams_0(ctx context.Context, marshaler runtime.Marshaler, server CounterServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HTTPGetWithZeroValueURLSearchParamsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CounterService_HTTPGetWithZeroValueURLSearchParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HTTPGetWithZeroValueURLSearchParams(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterCounterServiceHandlerServer registers the http handlers for service CounterService to "mux". // UnaryRPC :call CounterServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -622,6 +730,52 @@ func RegisterCounterServiceHandlerServer(ctx context.Context, mux *runtime.Serve }) + mux.Handle("GET", pattern_CounterService_HTTPGetWithURLSearchParams_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_CounterService_HTTPGetWithURLSearchParams_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CounterService_HTTPGetWithURLSearchParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_CounterService_HTTPGetWithZeroValueURLSearchParams_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_CounterService_HTTPGetWithZeroValueURLSearchParams_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CounterService_HTTPGetWithZeroValueURLSearchParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -823,6 +977,46 @@ func RegisterCounterServiceHandlerClient(ctx context.Context, mux *runtime.Serve }) + mux.Handle("GET", pattern_CounterService_HTTPGetWithURLSearchParams_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_CounterService_HTTPGetWithURLSearchParams_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CounterService_HTTPGetWithURLSearchParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_CounterService_HTTPGetWithZeroValueURLSearchParams_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_CounterService_HTTPGetWithZeroValueURLSearchParams_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CounterService_HTTPGetWithZeroValueURLSearchParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -842,6 +1036,10 @@ var ( pattern_CounterService_HTTPDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"delete", "a"}, "", runtime.AssumeColonVerbOpt(true))) pattern_CounterService_ExternalMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"main.CounterService", "ExternalMessage"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_CounterService_HTTPGetWithURLSearchParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"api", "query", "a"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_CounterService_HTTPGetWithZeroValueURLSearchParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"path", "query"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -860,4 +1058,8 @@ var ( forward_CounterService_HTTPDelete_0 = runtime.ForwardResponseMessage forward_CounterService_ExternalMessage_0 = runtime.ForwardResponseMessage + + forward_CounterService_HTTPGetWithURLSearchParams_0 = runtime.ForwardResponseMessage + + forward_CounterService_HTTPGetWithZeroValueURLSearchParams_0 = runtime.ForwardResponseMessage ) diff --git a/integration_tests/service.proto b/integration_tests/service.proto index 1937985..6a30739 100644 --- a/integration_tests/service.proto +++ b/integration_tests/service.proto @@ -57,6 +57,35 @@ message HttpDeleteRequest { int32 a = 1; } +message HTTPGetWithURLSearchParamsRequest { + int32 a = 1; + PostRequest post_req = 2; + repeated int32 c = 3; + ExternalMessage ext_msg = 4; +} + +message HTTPGetWithURLSearchParamsResponse { + int32 url_search_params_result = 1; +} + +message ZeroValueMsg { + int32 c = 1; + repeated int32 d = 2; + bool e = 3; +} + +message HTTPGetWithZeroValueURLSearchParamsRequest { + string a = 1; + string b = 2; + ZeroValueMsg zero_value_msg = 3; +} + +message HTTPGetWithZeroValueURLSearchParamsResponse { + string a = 1; + string b = 2; + ZeroValueMsg zero_value_msg = 3; +} + service CounterService { rpc Increment(UnaryRequest) returns (UnaryResponse); rpc StreamingIncrements(StreamingRequest) returns (stream StreamingResponse); @@ -89,4 +118,15 @@ service CounterService { }; } rpc ExternalMessage(ExternalRequest) returns (ExternalResponse); + rpc HTTPGetWithURLSearchParams(HTTPGetWithURLSearchParamsRequest) returns (HTTPGetWithURLSearchParamsResponse) { + option (google.api.http) = { + get: "/api/query/{a}" + }; + } + rpc HTTPGetWithZeroValueURLSearchParams(HTTPGetWithZeroValueURLSearchParamsRequest) returns (HTTPGetWithZeroValueURLSearchParamsResponse) { + option (google.api.http) = { + get: "/path/query" + }; + } } +