0.1.9 • Published 5 years ago

protoc-gen-jsonpb-ts v0.1.9

Weekly downloads
59
License
MIT
Repository
-
Last release
5 years ago

protoc-gen-jsonpb-ts

This is protoc plugin for generating TypeScript definitions.

Feature

Installation

First you need to install ProtocolBuffers v3.0.0 or later. Then, install this plugin via npm.

npm install protoc-gen-jsonpb-ts --save-dev

Usage

This plugin uses custom options. You should define these options in proto.

Example

rpc Method(Request) returns (Response) {
  option (google.api.http) = {
    post : "/v1/method"
    body : "*"
  };
}

Then, generate definitions using protoc command.

protoc \
  -I submodules/grpc-ecosystem/grpc-gateway/third_party/googleapis \
  --plugin=./node_modules/.bin/protoc-gen-jsonpb-ts \
  --jsonpb-ts_out=. \
  path/to/your_service.proto

Configuration

This plugin looks for a config file named protoc-gen-tsconfig.json and loads settings from it.

{
  ignorePackage: boolean; // defalut false
  jsonFormat: boolean;    // default true
}

Also supporting cli options.

protoc --jsonpb-ts_out=ignorePackage=true:. 

Options

  • ignorePackage

By default, use package as a namespace. If true, namespace will not be made.

  • jsonFormat

By default, the well-known type is changed according to this specification. If true, you can use all types as it is.

Examples

Some examples are available under example directory

License

MIT

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago