You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-18Lines changed: 23 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,51 +1,56 @@
1
1
# protoc-gen-grpc-gateway-ts
2
2
3
-
`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.
4
-
3
+
`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.
5
4
6
5
## Features:
7
-
1.idiomatic Typescript clients and messages
8
-
2. Supports both One way and server side streaming gRPC calls
9
-
3. POJO request construction guarded by message type definitions, which is way easier compare to `grpc-web`
6
+
1.Idiomatic Typescript clients and messages.
7
+
2. Supports both one way and server side streaming gRPC calls.
8
+
3. POJO request construction guarded by message type definitions, which is way easier compare to `grpc-web`.
10
9
4. No need to use swagger/open api to generate client code for the web.
11
10
12
-
## Get Started
11
+
## Getting Started:
13
12
14
13
### Install `protoc-gen-grpc-gateway-ts`
15
-
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 .`
14
+
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`
16
15
17
-
### Sample Usage
18
-
`protoc-gen-grpc-gateway-ts`will be used along with the `protoc` command. A sample invocation looks like the following:
16
+
### Sample Usage:
17
+
`protoc-gen-grpc-gateway-ts`should be used along with the `protoc` command. A sample invocation looks like the following:
As a result the generated file will be `input.pb.ts` in the same directory.
21
+
As a result the generated file will be `input.pb.ts` in the same directory.
23
22
24
23
## Parameters:
25
24
### `ts_import_roots`
26
-
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)`
25
+
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)`
27
26
28
27
### `ts_import_root_aliases`
29
-
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 "".
28
+
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 "".
30
29
31
30
`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.
32
31
33
32
### `fetch_module_directory` and `fetch_module_filename`
34
-
`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`
33
+
`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`
35
34
36
35
### `use_proto_names`
37
36
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.
38
37
39
38
### `logtostderr`
40
-
Turn Ton logging to stderr. Default to false.
39
+
Turn on logging to stderr. Default to false.
41
40
42
41
### `loglevel`
43
42
Defines the logging levels. Default to info. Valid values are: debug, info, warn, error
44
43
44
+
### Notes:
45
+
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:
0 commit comments