bufpb

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package bufpb provides wrappers to the Buf Protobuf API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image interface {
	protodescpb.BaseFileDescriptorSet

	GetBufbuildImageExtension() *imagev1beta1.ImageExtension

	// ImportNames returns the sorted import names.
	ImportNames() ([]string, error)

	// WithoutImports returns a copy of the Image without imports.
	//
	// If GetBufbuildImageExtension() is nil, returns the original Image.
	// If there are no imports, returns the original Image.
	//
	// Backing FileDescriptorProtos are not copied, only the references are copied.
	// This will result in unknown fields being dropped from the backing Image, but not
	// the backing FileDescriptorProtos.
	//
	// Validates the output.
	WithoutImports() (Image, error)

	// WithSpecificNames returns a copy of the Image with only the Files with the given names.
	//
	// Names are normalized and validated.
	// If allowNotExist is false, the specific names must exist on the input image.
	// Backing FileDescriptorProtos are not copied, only the references are copied.
	// Validates the output.
	//
	WithSpecificNames(allowNotExist bool, specificNames ...string) (Image, error)

	// ToFileDescriptorSet converts the Image to a native FileDescriptorSet.
	//
	// This strips the backing ImageExtension and then re-validates using protodescpb validation.
	//
	// Backing FileDescriptorProtos are not copied, only the references are copied.
	// This will result in unknown fields being dropped from the backing FileDescriptorSet, but not
	// the backing FileDescriptorProtos.
	ToFileDescriptorSet() (protodescpb.FileDescriptorSet, error)

	// ToCodeGeneratorRequest converts the image to a CodeGeneratorRequest.
	//
	// The files to generate must be within the Image.
	// Files to generate are normalized and validated.
	//
	// TODO: this should only be for testing, move somewhere else if possible
	ToCodeGeneratorRequest(parameter string, fileToGenerate ...string) (*plugin_go.CodeGeneratorRequest, error)
}

Image is an interface to wrap imagev1beta1.Images.

Fields should not be modified.

func CodeGeneratorRequestToImage

func CodeGeneratorRequestToImage(request *plugin_go.CodeGeneratorRequest) (Image, error)

CodeGeneratorRequestToImage converts the CodeGeneratorRequest to an Image.

func NewImage

func NewImage(backing *imagev1beta1.Image) (Image, error)

NewImage returns a new validated Image for the imagev1beta1.Image.

func UnmarshalJSONDataImage

func UnmarshalJSONDataImage(data []byte) (Image, error)

UnmarshalJSONDataImage returns a new validated Image for the imagev1beta1.Image.

func UnmarshalWireDataImage

func UnmarshalWireDataImage(data []byte) (Image, error)

UnmarshalWireDataImage returns a new validated Image for the imagev1beta1.Image.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL