schema

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationSchemaNullable structmeta.AnnotationName = "schema/nullable"
)

Variables

This section is empty.

Functions

func NewInvalidArrayDefinitionError added in v0.32.0

func NewInvalidArrayDefinitionError(found yamlmeta.Node, hint string) error

func NewInvalidSchemaError added in v0.32.0

func NewInvalidSchemaError(found yamlmeta.Node, message, hint string) error

func NewMismatchedTypeError added in v0.32.0

func NewMismatchedTypeError(foundType yamlmeta.TypeWithValues, expectedType yamlmeta.Type) error

func NewUnexpectedKeyError added in v0.32.0

func NewUnexpectedKeyError(found *yamlmeta.MapItem, definition *filepos.Position) error

Types

type AnySchema

type AnySchema struct {
}

func (*AnySchema) AssignType

func (as *AnySchema) AssignType(typeable yamlmeta.Typeable) yamlmeta.TypeCheck

func (*AnySchema) DefaultDataValues added in v0.32.0

func (as *AnySchema) DefaultDataValues() *yamlmeta.Document

func (*AnySchema) ValidateWithValues added in v0.32.0

func (as *AnySchema) ValidateWithValues(valuesFilesCount int) error

type ArrayItemType

type ArrayItemType struct {
	ValueType yamlmeta.Type
	Position  *filepos.Position
}

func NewArrayItemType

func NewArrayItemType(item *yamlmeta.ArrayItem) (*ArrayItemType, error)

func (*ArrayItemType) AssignTypeTo

func (a *ArrayItemType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (*ArrayItemType) CheckType

func (a *ArrayItemType) CheckType(node yamlmeta.TypeWithValues) (chk yamlmeta.TypeCheck)

func (ArrayItemType) GetValueType

func (a ArrayItemType) GetValueType() yamlmeta.Type

func (ArrayItemType) PositionOfDefinition added in v0.32.0

func (a ArrayItemType) PositionOfDefinition() *filepos.Position

func (ArrayItemType) String added in v0.32.0

func (a ArrayItemType) String() string

type ArrayType

type ArrayType struct {
	ItemsType yamlmeta.Type
	Position  *filepos.Position
}

func NewArrayType

func NewArrayType(a *yamlmeta.Array) (*ArrayType, error)

func (*ArrayType) AssignTypeTo

func (a *ArrayType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (*ArrayType) CheckType

func (a *ArrayType) CheckType(node yamlmeta.TypeWithValues) (chk yamlmeta.TypeCheck)

func (ArrayType) GetValueType

func (a ArrayType) GetValueType() yamlmeta.Type

func (ArrayType) PositionOfDefinition added in v0.32.0

func (a ArrayType) PositionOfDefinition() *filepos.Position

func (ArrayType) String added in v0.32.0

func (a ArrayType) String() string

type DocumentSchema

type DocumentSchema struct {
	Name   string
	Source *yamlmeta.Document

	Allowed *DocumentType
	// contains filtered or unexported fields
}

func NewDocumentSchema

func NewDocumentSchema(doc *yamlmeta.Document) (*DocumentSchema, error)

func (*DocumentSchema) AssignType

func (s *DocumentSchema) AssignType(typeable yamlmeta.Typeable) yamlmeta.TypeCheck

func (*DocumentSchema) DefaultDataValues added in v0.32.0

func (s *DocumentSchema) DefaultDataValues() *yamlmeta.Document

func (*DocumentSchema) ValidateWithValues added in v0.32.0

func (s *DocumentSchema) ValidateWithValues(valuesFilesCount int) error

type DocumentType

type DocumentType struct {
	Source    *yamlmeta.Document
	ValueType yamlmeta.Type // typically one of: MapType, ArrayType, ScalarType
	Position  *filepos.Position
}

func NewDocumentType added in v0.32.0

func NewDocumentType(doc *yamlmeta.Document) (*DocumentType, error)

func (*DocumentType) AssignTypeTo

func (t *DocumentType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (*DocumentType) CheckType

func (t *DocumentType) CheckType(_ yamlmeta.TypeWithValues) (chk yamlmeta.TypeCheck)

func (*DocumentType) GetValueType

func (t *DocumentType) GetValueType() yamlmeta.Type

func (*DocumentType) PositionOfDefinition added in v0.32.0

func (t *DocumentType) PositionOfDefinition() *filepos.Position

func (*DocumentType) String added in v0.32.0

func (t *DocumentType) String() string

type MapItemType

type MapItemType struct {
	Key          interface{} // usually a string
	ValueType    yamlmeta.Type
	DefaultValue interface{}
	Position     *filepos.Position
	Annotations  TypeAnnotations
}

func NewMapItemType

func NewMapItemType(item *yamlmeta.MapItem) (*MapItemType, error)

func (*MapItemType) AssignTypeTo

func (t *MapItemType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (*MapItemType) CheckType

func (t *MapItemType) CheckType(node yamlmeta.TypeWithValues) (chk yamlmeta.TypeCheck)

func (MapItemType) GetValueType

func (t MapItemType) GetValueType() yamlmeta.Type

func (MapItemType) IsNullable

func (t MapItemType) IsNullable() bool

func (MapItemType) PositionOfDefinition added in v0.32.0

func (t MapItemType) PositionOfDefinition() *filepos.Position

func (MapItemType) String added in v0.32.0

func (t MapItemType) String() string

type MapType

type MapType struct {
	Items    []*MapItemType
	Position *filepos.Position
}

func NewMapType

func NewMapType(m *yamlmeta.Map) (*MapType, error)

func (*MapType) AllowsKey

func (m *MapType) AllowsKey(key interface{}) bool

func (*MapType) AssignTypeTo

func (m *MapType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (*MapType) CheckType

func (m *MapType) CheckType(node yamlmeta.TypeWithValues) (chk yamlmeta.TypeCheck)

func (MapType) GetValueType

func (m MapType) GetValueType() yamlmeta.Type

func (MapType) PositionOfDefinition added in v0.32.0

func (m MapType) PositionOfDefinition() *filepos.Position

func (MapType) String added in v0.32.0

func (m MapType) String() string

type NullSchema added in v0.32.0

type NullSchema struct {
}

func (NullSchema) AssignType added in v0.32.0

func (n NullSchema) AssignType(typeable yamlmeta.Typeable) yamlmeta.TypeCheck

func (NullSchema) DefaultDataValues added in v0.32.0

func (n NullSchema) DefaultDataValues() *yamlmeta.Document

func (NullSchema) ValidateWithValues added in v0.32.0

func (n NullSchema) ValidateWithValues(valuesFilesCount int) error

type ScalarType

type ScalarType struct {
	Value    interface{}
	Position *filepos.Position
}

func (*ScalarType) AssignTypeTo

func (m *ScalarType) AssignTypeTo(typeable yamlmeta.Typeable) yamlmeta.TypeCheck

func (*ScalarType) CheckType

func (m *ScalarType) CheckType(node yamlmeta.TypeWithValues) (chk yamlmeta.TypeCheck)

func (ScalarType) GetValueType

func (m ScalarType) GetValueType() yamlmeta.Type

func (ScalarType) PositionOfDefinition added in v0.32.0

func (m ScalarType) PositionOfDefinition() *filepos.Position

func (ScalarType) String added in v0.32.0

func (m ScalarType) String() string

type TypeAnnotations

type TypeAnnotations map[structmeta.AnnotationName]interface{}

Jump to

Keyboard shortcuts

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