compiler

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 5

Documentation

Index

Constants

View Source
const Ellipsis = "..."

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseCompilerError added in v1.5.0

type BaseCompilerError struct {
	BaseMessage string
	// contains filtered or unexported fields
}

BaseCompilerError defines an error with contains the base message of the issue that occurred.

type CompiledSchema added in v1.14.0

type CompiledSchema struct {
	// ObjectDefinitions holds the object definitions in the schema.
	ObjectDefinitions []*core.NamespaceDefinition

	// CaveatDefinitions holds the caveat definitions in the schema.
	CaveatDefinitions []*core.CaveatDefinition

	// OrderedDefinitions holds the object and caveat definitions in the schema, in the
	// order in which they were found.
	OrderedDefinitions []SchemaDefinition
}

CompiledSchema is the result of compiling a schema when there are no errors.

func Compile

func Compile(schema InputSchema, prefix ObjectPrefixOption, opts ...Option) (*CompiledSchema, error)

Compile compilers the input schema into a set of namespace definition protos.

type ErrorWithContext

type ErrorWithContext struct {
	BaseCompilerError
	SourceRange     input.SourceRange
	Source          input.Source
	ErrorSourceCode string
}

ErrorWithContext defines an error which contains contextual information.

func (ErrorWithContext) DetailsMetadata added in v1.14.0

func (ewc ErrorWithContext) DetailsMetadata() map[string]string

DetailsMetadata returns the metadata for details for this error.

func (ErrorWithContext) Unwrap added in v1.14.0

func (ewc ErrorWithContext) Unwrap() error

type InputSchema

type InputSchema struct {
	// Source is the source of the schema being compiled.
	Source input.Source

	// Schema is the contents being compiled.
	SchemaString string
}

InputSchema defines the input for a Compile.

type ObjectPrefixOption added in v1.29.0

type ObjectPrefixOption func(*config)

func AllowUnprefixedObjectType added in v1.29.0

func AllowUnprefixedObjectType() ObjectPrefixOption

func ObjectTypePrefix added in v1.29.0

func ObjectTypePrefix(prefix string) ObjectPrefixOption

func RequirePrefixedObjectType added in v1.29.0

func RequirePrefixedObjectType() ObjectPrefixOption

type Option added in v1.29.0

type Option func(*config)

func SkipValidation added in v1.29.0

func SkipValidation() Option

type SchemaDefinition added in v1.14.0

type SchemaDefinition interface {
	proto.Message

	GetName() string
}

SchemaDefinition represents an object or caveat definition in a schema.

Jump to

Keyboard shortcuts

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