protoc-gen-pu

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: MIT Imports: 11 Imported by: 0

README

protoc-gen-pu

protoc plugin to generate a plant UML class diagram.

prerequisites

  • go ~> v1.19
  • protoc ~> 3.15

install

go install github.com/lp-peg/protoc-gen-pu@latest

usage

protoc --pu_out=. testdata/pet.proto

then, you can see diagram as below:

options

You can use these plugin options.
Pass option via --pu_opt flag.

option key description default
out output file name out.pu
skinparams skin param. Required format is <param>:<value>. You can pass this opt multiple times. "linetype:ortho"
circle hide or show circle hide

example:

❯ protoc -Itestdata \
  --pu_opt=out=pet.pu \
  --pu_opt=skinparams=linetype:ortho \
  --pu_opt=skinparams=classFontSize:10 \
  --pu_opt=circle=show \
  --pu_out=. \
  testdata/pet.proto
@startuml


skinparam linetype ortho
skinparam classFontSize 10

entity Pet {
  name (STRING)
  age (INT32)
  animal (Animal<FK>)
}

entity Animal {
  name (STRING)
  category (AnimalCategory<FK>)
}

entity AnimalCategory {
  UNSPECIFIED (ENUM: 0)
  DOG (ENUM: 1)
  CAT (ENUM: 2)
  COW (ENUM: 3)
  BEAR (ENUM: 4)
}

Animal <-- Pet
AnimalCategory <-- Animal

@enduml

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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