A protoc
plugin which generates a JSON representation of protobuf files.
This is used by Trinsic to enable generation of rich documentation for our API objects, which are defined in proto files.
As with all protoc
plugins, its usage is simple.
The simplest option: simply place protoc-gen-json[.exe]
somewhere that your PATH can see.
Then, invoke it:
protoc --json_out={OUTPUT_DIRECTORY} --json_opt={OUTPUT_FILENAME} [standard protoc flags follow]
protoc --plugin=protoc-gen-json={PATH_TO_EXECUTABLE} --json_out={OUTPUT_DIRECTORY} --json_opt={OUTPUT_FILENAME} [standard protoc flags follow]
--json_out
should point to the output directory, where you would like your output JSON file to be saved.
--json_opt
(optional) is the output filename. Defaults to proto.json
if not specified.
For example, --json_out=/foo/bar --json_opt=baz.json
will write the output file to /foo/bar/baz.json
.
See OUTPUT.md for documentation about the output format.
- Full Custom Option Support
- Handle Options on all non-Field objects
- Handle non-primitive Option types
- Handle
bytes
Option types
- Improved label handling (repeated/optional/etc.)
- Add default value support