schemagen

package
v0.24.8 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ApiVersionMismatch = func(expected, actual string) error {
		return eris.Errorf("Expected ApiVersion [%s] but found [%s]", expected, actual)
	}
)

Functions

func GenerateOpenApiValidationSchemas

func GenerateOpenApiValidationSchemas(project *model.Project, options *ValidationSchemaOptions, importsCollector collector.Collector, absoluteRoot string) error

func GetCRDFromFile added in v0.20.2

func GetCRDFromFile(pathToFile string) (apiextv1.CustomResourceDefinition, error)

func GetCRDsFromDirectory added in v0.20.2

func GetCRDsFromDirectory(crdDirectory string) ([]apiextv1.CustomResourceDefinition, error)

func NewCueGenerator

func NewCueGenerator(importsCollector collector.Collector, absoluteRoot string) *cueGenerator

func NewProtocGenerator

func NewProtocGenerator(importsCollector collector.Collector, absoluteRoot string, validationSchemaOptions *ValidationSchemaOptions) *protocGenerator

Types

type CrdWriter

type CrdWriter struct {
	// contains filtered or unexported fields
}

func NewCrdWriter

func NewCrdWriter(crdDirectory string) *CrdWriter

func (*CrdWriter) ApplyValidationSchemaToCRD

func (c *CrdWriter) ApplyValidationSchemaToCRD(crd apiextv1.CustomResourceDefinition, validationSchema *apiextv1.CustomResourceValidation) error

type JsonSchemaGenerator

type JsonSchemaGenerator interface {
	GetJsonSchemaForProject(project *model.Project) (map[schema.GroupVersionKind]*apiextv1.JSONSchemaProps, error)
}

type OpenApiSchemas

type OpenApiSchemas map[string]*openapi.OrderedMap

Mapping from protobuf message name to OpenApi schema

type ValidationSchemaOptions

type ValidationSchemaOptions struct {
	// Path to the directory where CRDs will be read from and written to
	CrdDirectory string

	// Tool used to generate JsonSchemas, defaults to protoc
	JsonSchemaTool string

	// Whether to remove descriptions from validation schemas
	// Default: false
	//
	// NOTE: I'd prefer a positive field name (ie includeDescriptions)
	//	but I wanted to avoid changing the default behavior
	RemoveDescriptionsFromSchema bool

	// The maximum number of characters to include in a description
	// If RemoveDescriptionsFromSchema is true, this will be ignored
	// A 0 value will be interpreted as "include all characters"
	// Default: 0
	MaxDescriptionCharacters int

	// Whether to assign Enum fields the `x-kubernetes-int-or-string` property
	// which allows the value to either be an integer or a string
	// If this is false, only string values are allowed
	// Default: false
	EnumAsIntOrString bool
}

Jump to

Keyboard shortcuts

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