protoc-gen-restapi

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

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

Go to latest
Published: Aug 21, 2022 License: MIT Imports: 9 Imported by: 0

README

Overview:

A Protobuf Generator which generates from .proto files helper variables and functions which can be imported by microservices.

It can be installed with:

go install github.com/zyros90/protoc-gen-restapi@latest

if you have i.e. a user.proto file which have google api proto annotations:

import "google/api/annotations.proto";
service UserSvc {
  rpc Create(CreateUserReq) returns (UserResp) {
    option (google.api.http) = {
      post : "/user/v1"
      body : "*"
    };
  };

it generates a user.pb.api.go file

import (
	restapi "github.com/zYros90/protoc-gen-restapi/utils"
)

const UserSvc_Create_Method = "POST"
const UserSvc_Create_Path = "/user/v1"

var UserSvcHTTP []*restapi.ApiAnnotations = []*restapi.ApiAnnotations{
	{
		Method: UserSvc_Create_Method,
		Path:   UserSvc_Create_Path,
	},
}

The generated file can be used in your service without rewriting the paths and methods redundantly.

Project State:

In development

Used Technologies:

TODOs

  • Add generation of echo handler functions for registering routes

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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