GithubHelp home page GithubHelp logo

eqyiel / protoc-gen-jsonpb-ts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sue71/protoc-gen-jsonpb-ts

0.0 2.0 0.0 355 KB

protoc plugin for generating TypeScript definitions

License: MIT License

JavaScript 0.17% TypeScript 83.97% HTML 14.27% Shell 1.59%

protoc-gen-jsonpb-ts's Introduction

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

protoc-gen-jsonpb-ts's People

Contributors

sue71 avatar renovate-bot avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.