protoseye

module
v0.0.0-...-b3e2fea Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: MIT

README

ProtosEye

Bird's-view of your proto RPCs in JSON.

Supports

✅ Supports google.protobuf.* types.

✅ Supports all standard protobuf types.

Installation

Here are two ways that you can install this tool.

  1. Go install:
go install github.com/AmirSoleimani/protoseye/cmd/...
  1. From source code:
git clone git@github.com:AmirSoleimani/protoseye.git
cd protoseye
go install ./cmd/...
protoc-gen-protoseye version

How to use!

Once you install it, You can easily use it with protoc

find . -name '*.proto' -exec protoc -I=. \
    --protoseye_out=./outputs {} \;
Example

E.g. Input:

message GetBirdRequest {
    string id = 1;
}

message GetBirdResponse {
    string id = 1;
    string name = 2;
    int age = 3;
    google.protobuf.Timestamp created_at = 4;
}

service BirdService {
    rpc GetBird(GetBirdRequest) GetBirdResponse;
}

Output:

// BirdService_bird.GetBirdRequest.json
{
    "id": "mystring"
}

// BirdService_bird.GetBirdResponse.json
{
    "id": "mystring",
    "name": "name",
    "age": 13,
    "created_at": {
        "nanos": 32,
        "seconds": 64
    }
}

Motivation

If you have a complex data structure, getting a good insight into the input and output of your RPCs won't be easy (It gets worse when you have an enormous payload). This tool helps you generate a JSON representation of the RPC request and response.

TODOs

  • Enhance test coverage.
  • Generate smarter and more specific random values.
  • Support custom and predefined field value.
  • Support Directory Tree style besides JSON.

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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