Introduction
Markdown documentation generator for proto3 protocol.
This project consists of a custom program designed to parse Protocol Buffers (protobuf) definition files, specifically
focusing on extracting documentation annotations present in the comments. These annotations follow a custom doc
protocol, facilitating the generation of MD5 documentation from the protobuf files.
Syntax
Comments in the protobuf files use a special syntax to annotate documentation. Here is an outline of the annotation
syntax:
-
Description Comments
-
Code Block Annotations
-
Autocode Annotations
-
Header Annotations
-
Ignore Annotations
In addition to the previously mentioned comment annotations, the program also supports the following annotations for
enhancing the detail and constraints in the protobuf file documentation:
-
Max Annotation
-
Min Annotation
-
Len Annotation
-
(AutoCode only!) Val Annotation
-
Type Annotation
You can combine all these annotations with field descriptions:
message ExampleMessage {
string emailField = 1; // that is my custom email field @type=email
}
These extended annotations provide additional context and constraints for the fields in the protobuf definitions, aiding
in the generation of more detailed and accurate documentation.
Program Usage
-
Parsing Protobuf Files
- Run the program specifying the path to the
.proto
file as an argument.
- The program will parse the file, extracting annotations and associated definitions.
-
Generating MD5 Documentation
- Upon successful parsing, the program generates MD5 documentation.
- The documentation is based on the annotated comments and the protobuf elements they describe.
-
Output
- The generated documentation is either displayed to the user, saved to a file, or both, depending on the program
configuration and user preferences.
Example usage
go get -u github.com/kordax/pb-md5-generator
pb-md5-generator -d protobufs/my-project/ -o ./README.md -p ./my-prefix-doc.md
There's a test_protofile
in internal/test-proto
directory for you to check out.
Libraries Used in the Project
This document lists the libraries used in the project that are licensed under the MIT License, in accordance with their respective licenses.
MIT Licensed Libraries
Note: The above links and license information are for illustrative purposes and may not be accurate. Please verify the license information by visiting the respective library's repository and reviewing their license file.