collector

package
v0.38.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FetchImportsTimeout = func(filename string) error {
		return eris.Errorf("Timed out while fetching imports for proto file: [%s]", filename)
	}
)

Functions

func NewCollector

func NewCollector(customImports, commonImports []string) *collector

func NewProtoCompiler

func NewProtoCompiler(
	collector Collector,
	customImports, customGoArgs, customPlugins []string,
	descriptorOutDir string,
	wantCompile func(string) bool,
	protocOptions ProtocOptions,
) *protoCompiler

Types

type Collector

type Collector interface {
	CollectImportsForFile(root, protoFile string) ([]string, error)
}

type DefaultProtocExecutor added in v0.37.0

type DefaultProtocExecutor struct {
	// The output directory
	OutputDir string
	// whether or not to do a regular go-proto generate while collecting descriptors
	ShouldCompileFile func(string) bool
	// arguments for go_out=
	CustomGoArgs []string
	// custom plugins
	// each will append a <plugin>_out= directive to protoc command
	CustomPlugins []string
}

func (*DefaultProtocExecutor) Execute added in v0.37.0

func (d *DefaultProtocExecutor) Execute(protoFile string, toFile string, imports []string) error

type DescriptorWithPath

type DescriptorWithPath struct {
	*descriptor.FileDescriptorProto
	// path to the file
	ProtoFilePath string
	// the set of imports this file requires
	Imports []string
}

func (*DescriptorWithPath) GetMessage

func (file *DescriptorWithPath) GetMessage(typeName string) *descriptor.DescriptorProto

type ImportsExtractor

type ImportsExtractor interface {
	FetchImportsForFile(protoFile string, importsFetcher ImportsFetcher) ([]string, error)
}

func NewSynchronizedImportsExtractor

func NewSynchronizedImportsExtractor() ImportsExtractor

type ImportsFetcher

type ImportsFetcher func(file string) ([]string, error)

type OpenApiProtocExecutor added in v0.37.0

type OpenApiProtocExecutor struct {
	OutputDir string

	// Whether to include descriptions in validation schemas
	IncludeDescriptionsInSchema bool

	// Whether to assign Enum fields the `x-kubernetes-int-or-string` property
	// which allows the value to either be an integer or a string
	EnumAsIntOrString bool

	// A list of messages (core.solo.io.Status) whose validation schema should
	// not be generated
	MessagesWithEmptySchema []string
}

func (*OpenApiProtocExecutor) Execute added in v0.37.0

func (o *OpenApiProtocExecutor) Execute(protoFile string, toFile string, imports []string) error

type ProtoCompiler

type ProtoCompiler interface {
	CompileDescriptorsFromRoot(root string, skipDirs []string) ([]*DescriptorWithPath, error)
}

type ProtocExecutor added in v0.37.0

type ProtocExecutor interface {
	Execute(protoFile string, toFile string, imports []string) error
}

type ProtocOptions

type ProtocOptions struct {
	// declare mappings from proto files to full import paths of the corresponding generated Go code
	// used when the source proto files don't define `go_package`
	GoPackage map[string]string

	// Additional custom protoc imports
	CustomImports []string

	// Skip compiling these directories
	SkipDirs []string

	// Extra flags to provide to invocations of protoc
	ProtocExtraFlags []string
}

Jump to

Keyboard shortcuts

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