Documentation
The protoc-gen-go-temporal plugin provides automatic documentation generation for your Temporal workflows, activities, queries, signals, and updates. This feature extracts information from your protobuf definitions and generates comprehensive Markdown documentation.
See github.com/cludden/protoc-gen-go-temporal/proto/README.md for an example of the generated documentation using the default template.
Overview
The documentation feature parses your protobuf files and generates documentation that includes:
- Services: Temporal services with their task queues and configuration
- Workflows: Input/output types, configuration options, and associated queries/signals/updates
- Queries: Input/output types and configuration
- Signals: Input types and start workflow capabilities
- Updates: Input/output types, validation, and wait policies
- Activities: Input/output types, timeouts, retry policies, and task queues
- Messages: All protobuf message types referenced by your Temporal resources
Generating Documentation
To generate documentation, use the --docs-out
flag when running the plugin:
- buf
- protoc
# buf.gen.yaml
version: v1
plugins:
- plugin: go-temporal
out: .
opt:
- docs-out=proto/docs.md
protoc \
--go-temporal_out=. \
--go-temporal_opt=docs-out=proto/docs.md \
proto/*.proto
Template Options
The plugin supports two documentation template options:
Built-in Template (Default)
Use the built-in "basic" template (default):
- buf
- protoc
# buf.gen.yaml
version: v1
plugins:
- plugin: go-temporal
out: .
opt:
- docs-out=proto/docs.md
- docs-template=basic
protoc \
--go-temporal_out=. \
--go-temporal_opt=docs-out=proto/docs.md \
--go-temporal_opt=docs-template=basic \
proto/*.proto
Custom Template
Provide a path to your own Go template file:
- buf
- protoc
# buf.gen.yaml
version: v1
plugins:
- plugin: go-temporal
out: .
opt:
- docs-out=proto/docs.md
- docs-template=path/to/custom.tpl
protoc \
--go-temporal_out=. \
--go-temporal_opt=docs-out=proto/docs.md \
--go-temporal_opt=docs-template=path/to/custom.tpl \
proto/*.proto
Generated Documentation Structure
The generated documentation includes:
Table of Contents
A hierarchical table of contents listing all packages, services, and their Temporal resources.
Service Documentation
For each service with Temporal resources:
- Service name and comments
- Task queue configuration
- Lists of workflows, queries, signals, updates, and activities