Documentation
¶
Index ¶
- Variables
- func NewCollector(customImports, commonImports []string) *collector
- func NewProtoCompiler(collector Collector, customImports, customGoArgs, customPlugins []string, ...) *protoCompiler
- type Collector
- type DefaultProtocExecutor
- type DescriptorWithPath
- type ImportsExtractor
- type ImportsFetcher
- type OpenApiProtocExecutor
- type ProtoCompiler
- type ProtocExecutor
- type ProtocOptions
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
}
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
// Whether to exclude kubebuilder markers and validations (such as PreserveUnknownFields, MinItems, default, and all CEL rules)
// Type and Required markers will be included regardless
DisableKubeMarkers bool
// when set, this list of substrings will be used to identify kubebuilder markers to ignore. When multiple are
// supplied, this will function as a logical OR i.e. any rule which contains a provided substring will be ignored
IgnoredKubeMarkerSubstrings []string
}
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
// When set, it will replace the value before the "=" with the value after it in the hash function of the generated code.
// This is use to maintain backward compatibility of the hash function in the case where the package name changes.
TransformPackageForHash string
}
Click to show internal directories.
Click to hide internal directories.