Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImageFileToDescriptor ¶
func ImageFileToDescriptor(img *imagev1.ImageFile) *descriptorpb.FileDescriptorProto
ImageFileToDescriptor maps a buf.ImageFile to it's FileDescriptorProto.
A buf.ImageFile is essentially just a wrapper around FileDescriptorProto, but with some additional buf specific extensions, which aren't relevant for us here (they are relevant in ImageToCodeGenerationRequest).
func ImageToCodeGeneratorRequest ¶
func ImageToCodeGeneratorRequest(image *imagev1.Image, plug *v1alpha1.PluginGenerationRequest) (*pluginpb.CodeGeneratorRequest, error)
ImageToCodeGeneratorRequest builds a CodeGeneratorRequest from an Image (FileDescriptorSet, with extra bits) and a PluginGenerationRequest, which contains the plugin configuration (i.e. opts, include_imports, include_well_known_types).
func IsWellKnownType ¶
IsWellKnownType marks a proto file as a well-known type, based on its filepath.
Types ¶
type Plugin ¶
Plugin wraps a plugin binary for local execution.
func (*Plugin) Generate ¶
func (p *Plugin) Generate(ctx context.Context, req *pluginpb.CodeGeneratorRequest) (*pluginpb.CodeGeneratorResponse, error)
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the container which points to all available plugins.
func LocalRegistry ¶
LocalRegistry reads the available plugins from the folder structure at "path".
It will panic if the folder structure does not match our expectations.
The expectation is that for a remote plugin request of `<host>/<owner>/<plugin>:<version>`
e.g. ``` # buf.gen.yaml plugins: - remote: <host>/<owner>/<plugin>:<version> ```
There is an executable file at `<owner>/<plugin>/<version>/<plugin>`
<version> is required to match `v1.2.3` (or `/v\d+\.\d+\.\d+`).