Skip to content

Plugin Architecture

Tim Burks edited this page Feb 28, 2017 · 7 revisions

gnostic can invoke third-party OpenAPI tools using a plugin architecture that is similar to the one used by protoc, the Protocol Buffer compiler.

gnostic plugins can be written in any language that can read and write Protocol Buffers. They interface with gnostic by reading from stdin and writing to stdout. When gnostic calls a plugin, it launches the plugin process and writes a PluginRequest message to the plugin's stdin and waits for the plugin to write a PluginResponse message to its stdout.

Plugins are invoked by passing an option to gnostic of the form --<plugin>_out=<path> where path is a directory where the plugin's output should be written. Plugin binaries are expected to be named gnostic_<plugin> and in the current search path. For example --go_service_out=. will invoke the gnostic_go_service plugin and write its output in the current working directory.

For details of the plugin interface and examples, see the plugins directory.

Plugin Parameters

We would like to be able to pass parameters to plugins, and to do that, will include support similar to the plugin parameter support in protoc. Plugin invocations can include options in the following form:

--<plugin>_out=[<options>:]<path>

where <options> is a comma-separated list of key=value pairs.

Clone this wiki locally