Skip to content

sonatard/proto-to-postman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

proto-to-postman

proto-to-postman is a command line tool to create postman API import collection from .proto.

Install

go get -u github.com/sonatard/proto-to-postman

Usage

proto-to-postman \
    -n xxx-api \
    -b "https://exmaple.com/" \
    -h "Content-Type:application/json,Accept:application/json"  \
    -i proto/ \
    api/v1/*.proto

Support proto file format

google.api.http annotation

Possible to create multi APIs {URL}/{AnnotationValue}.

import "google/api/annotations.proto";

service UserService {
  rpc GetUser(GetUserRequest) returns (GetUserResponse){
    option (google.api.http) = {
      post: "/UserService/GetUser"
      body: "user"
      additional_bindings {
        post: "/UserService/GetUser2"
        body: "*"
      }
      additional_bindings {
        get: "/UserService/GetUser"
      }
    };
  };
}

message GetUserRequest {
  User user = 1;
}

message GetUserResponse {}

message User {
  string user_id= 1;
  string user_name = 2;
}

google.api.http spec is here.

https://cloud.google.com/endpoints/docs/grpc-service-config/reference/rpc/google.api#google.api.HttpRule

Limitation

  • Only supported for Postman v2.1.0 scheme

About

proto-to-postman is a command line tool to create postman API import collection from .proto.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages