Coder Social home page Coder Social logo

seamia / protodot Goto Github PK

View Code? Open in Web Editor NEW
388.0 8.0 39.0 48.33 MB

transforming your .proto files into .dot files (and .svg, .png if you happen to have graphviz installed)

License: BSD 3-Clause "New" or "Revised" License

Go 100.00%
visualization protobuf protocol-buffers protoc proto3 grpc graphviz-dot-language dot graphviz graph

protodot's Introduction

protodot

transforming your .proto files into .dot files (and .svg, .png if you happen to have graphviz installed)

online demo

you can find an online demo of this tool here

data pipeline

installation

you can download the sources (from this page) and build protodot yourself, or you can download pre-built binaries for a few selected environments (or from here):

protodot output is highly customizable through its configuration file and a set of templates files. if you installed protodot from the binary distribution - you may want to extract aforementioned files by running:

   ./protodot -install

command line arguments

  • -src what.proto - location and name of the source file, required
  • -config config.json - location and name of the configuration file, optional
  • -select .one.two;three.four - name(s) of the selected elements to show, optional, explained later in this document
  • -output save-it-here - name of the output file, optional
  • -inc /abc/def;/xyz - (semicolon separated) list of the include directories, optional

configuration file

tbd

selected output

sometimes the resulting diagram can be overwhelming. you have an option to limit the output to the elements that interest you the most, hence -select args command line option. so far, args in -select args can take one of the three available forms:

  • list of the elements (and their dependencies) that you want to see included (separated by ;). the elements can be enums, messages, rpc methods and services.
  • if you specify * as an argument - this will result in the inclusion of the elements declared in the main .proto file (specified in -src argument) and their dependencies. in other words: all the unused elements declared in all the included .proto files will not be shown.
  • if you specify imports as an argument - protodot will generate import dependency graph (see an example below)

an example of output

an illustration of effects of different -select options

using https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto as the source

not using -select

everything declared in the root .proto file and all the imports will be produced:

using -select *

only elements declared in the root .proto file and their dependencies will be produced:

using -select imports

only imports dependency graph will be produced:

using -select .ListDlpJobs

in this particular case, the name of the rpc method was specified: this will result in production of the requested rpc method, it's encompasing service element and all the dependencied of the method:

using -select .AnalyzeDataSourceRiskDetails

same as above, but instead of rpc method, name of the message was specified:

how to (automatically) generate .svg and/or .png images from produced .dot file

  1. install graphviz (see https://graphviz.gitlab.io/download/ for the instructions)
  2. specify the location of the dot utility (which is a part of graphviz) in your version of configuration file, e.g.
{
	"locations": {
		"graphviz":	"/path/to/dot",
  1. set approptiate options in your version of configuration file, e.g.
{
	"options" : {
		"generate .png file":		false,
		"generate .svg file":		true,

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.