protoc-gen-angular

command module
v0.0.0-...-fde4f60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

README

Angular service code gen

An utility tool to generate an angular REST client from the protobuf spec service definitions used by grpc-gateway.
Usage
Setup

Ensure that you have your $GOPATH set as the protoc toolchain seems to be unable to resolve imports that are resolved through modules. You must provide the imports that are specified inside the input proto file to the protoc binary using the -I options. You might also have to set your $GOBIN.

Install the protoc-gen-angular binary by running:

go build && go install
Options

Options are passed to the protoc flag in the following way: --angular_out=service_name=foo,filename=bar.ts:..

  • filename: The filename for the generated output.
  • service_name: The name of the generated TypeScript service class.
Generate the Angular service
Example
protoc -I. -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway -I../vendor --angular_out=filename=console.service.ts,service_name=ConsoleService:. <input file.proto>

The output file is: console.service.ts.

Limitations

The code generator has only been checked against a limited set of grpc-gateway service definitions and might have trouble handling nested enumerables inside message definitions YMMV.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL