GithubHelp home page GithubHelp logo

protoc-gen-api-config's Introduction

protoc-gen-api-config

protoc-gen-api-config is a protoc plugin to make standard URL path based on grpc-gateway gRPC API Configuration.

中文介绍

Install

go install github.com/defool/protoc-gen-api-config

Example

./example/foo/v1/api.proto:

syntax = "proto3";

package foo.v1;
option go_package="foo/v1";


message SayHelloRequest {
  string name = 1;
}

message SayHelloResponse {
  string reply = 1;
}

service ExampleService {
  rpc SayHello (SayHelloRequest) returns (SayHelloResponse);
}

generate stub file in two step by protoc:

protoc  -I . --go_out="./example/generated"  ./example/foo/v1/api.proto
protoc  -I . --api-config_out="./example/generated"  ./example/foo/v1/api.proto

OR buf use case:

buf.gen.yaml:

version: v1
plugins:
  - name: go
    out: generated
    opt: paths=source_relative
  - name: go-grpc
    out: generated
    opt:
      - paths=source_relative
  - name: api-config
    out: generated
    opt: paths=source_relative

buf.gen.second.yaml:

version: v1
plugins:  
  - name: grpc-gateway
    out: generated
    opt:
    - grpc_api_configuration=generated/api-config.yaml
    - paths=source_relative
  - name: openapiv2
    out: generated
    opt:
    - grpc_api_configuration=generated/api-config.yaml

generate stub file in two step:

buf generate
buf generate --template buf.gen.second.yaml

protoc-gen-api-config's People

Contributors

defool avatar

Watchers

 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.