schema

package
v0.37.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AnnotationNullable     template.AnnotationName = "schema/nullable"
	AnnotationType         template.AnnotationName = "schema/type"
	TypeAnnotationKwargAny string                  = "any"
)

Variables

This section is empty.

Functions

func NewMismatchedTypeAssertionError added in v0.35.0

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

func NewSchemaError added in v0.35.0

func NewSchemaError(summary string, errs ...error) error

func NewUnexpectedKeyAssertionError added in v0.35.0

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

Types

type Annotation added in v0.34.0

type Annotation interface {
	NewTypeFromAnn() yamlmeta.Type
}

type AnyType added in v0.34.0

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

func (AnyType) AssignTypeTo added in v0.34.0

func (a AnyType) AssignTypeTo(yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (AnyType) CheckType added in v0.34.0

func (a AnyType) CheckType(_ yamlmeta.TypeWithValues) (chk yamlmeta.TypeCheck)

func (AnyType) GetDefaultValue added in v0.35.0

func (a AnyType) GetDefaultValue() interface{}

func (AnyType) GetDefinitionPosition added in v0.35.0

func (a AnyType) GetDefinitionPosition() *filepos.Position

func (AnyType) GetValueType added in v0.34.0

func (a AnyType) GetValueType() yamlmeta.Type

func (AnyType) String added in v0.34.0

func (a AnyType) String() string

type ArrayItemType

type ArrayItemType struct {
	ValueType yamlmeta.Type
	Position  *filepos.Position
	// contains filtered or unexported fields
}

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) GetDefaultValue added in v0.35.0

func (a ArrayItemType) GetDefaultValue() interface{}

func (ArrayItemType) GetDefinitionPosition added in v0.35.0

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

func (ArrayItemType) GetValueType

func (a ArrayItemType) GetValueType() yamlmeta.Type

func (ArrayItemType) String added in v0.32.0

func (a ArrayItemType) String() string

type ArrayType

type ArrayType struct {
	ItemsType yamlmeta.Type
	Position  *filepos.Position
	// contains filtered or unexported fields
}

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) GetDefaultValue added in v0.35.0

func (a ArrayType) GetDefaultValue() interface{}

func (ArrayType) GetDefinitionPosition added in v0.35.0

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

func (ArrayType) GetValueType

func (a ArrayType) GetValueType() yamlmeta.Type

func (ArrayType) String added in v0.32.0

func (a ArrayType) String() string

type DocumentSchema

type DocumentSchema struct {
	Source *yamlmeta.Document

	DocType yamlmeta.Type
	// contains filtered or unexported fields
}

func NewDocumentSchema

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

func NewNullSchema added in v0.35.0

func NewNullSchema() *DocumentSchema

NewNullSchema provides the "Null Object" value of Schema. This is used in the case where no schema was provided.

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 DocumentSchemaEnvelope added in v0.34.0

type DocumentSchemaEnvelope struct {
	Doc *DocumentSchema
	// contains filtered or unexported fields
}

func NewDocumentSchemaEnvelope added in v0.34.0

func NewDocumentSchemaEnvelope(doc *yamlmeta.Document) (*DocumentSchemaEnvelope, error)

func (*DocumentSchemaEnvelope) Desc added in v0.34.0

func (e *DocumentSchemaEnvelope) Desc() string

func (*DocumentSchemaEnvelope) IntendedForAnotherLibrary added in v0.34.0

func (e *DocumentSchemaEnvelope) IntendedForAnotherLibrary() bool

func (*DocumentSchemaEnvelope) IsUsed added in v0.34.0

func (e *DocumentSchemaEnvelope) IsUsed() bool

func (*DocumentSchemaEnvelope) Source added in v0.34.0

func (*DocumentSchemaEnvelope) UsedInLibrary added in v0.34.0

func (e *DocumentSchemaEnvelope) UsedInLibrary(expectedRefPiece ref.LibraryRef) (*DocumentSchemaEnvelope, bool)

type DocumentType

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

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) GetDefaultValue added in v0.35.0

func (t DocumentType) GetDefaultValue() interface{}

func (*DocumentType) GetDefinitionPosition added in v0.35.0

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

func (*DocumentType) GetValueType

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

func (*DocumentType) String added in v0.32.0

func (t *DocumentType) String() string

type ExtractLibRefs added in v0.34.0

type ExtractLibRefs interface {
	FromAnnotation(template.NodeAnnotations) ([]ref.LibraryRef, error)
}

type MapItemType

type MapItemType struct {
	Key       interface{} // usually a string
	ValueType yamlmeta.Type
	Position  *filepos.Position
	// contains filtered or unexported fields
}

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) GetDefaultValue added in v0.35.0

func (t MapItemType) GetDefaultValue() interface{}

func (MapItemType) GetDefinitionPosition added in v0.35.0

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

func (MapItemType) GetValueType

func (t MapItemType) GetValueType() yamlmeta.Type

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) GetDefaultValue added in v0.35.0

func (m MapType) GetDefaultValue() interface{}

func (MapType) GetDefinitionPosition added in v0.35.0

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

func (MapType) GetValueType

func (m MapType) GetValueType() yamlmeta.Type

func (MapType) String added in v0.32.0

func (m MapType) String() string

type NullType added in v0.34.0

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

func (NullType) AssignTypeTo added in v0.34.0

func (n NullType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (NullType) CheckType added in v0.34.0

func (n NullType) CheckType(node yamlmeta.TypeWithValues) (chk yamlmeta.TypeCheck)

func (NullType) GetDefaultValue added in v0.35.0

func (n NullType) GetDefaultValue() interface{}

func (NullType) GetDefinitionPosition added in v0.35.0

func (n NullType) GetDefinitionPosition() *filepos.Position

func (NullType) GetValueType added in v0.34.0

func (n NullType) GetValueType() yamlmeta.Type

func (NullType) String added in v0.34.0

func (n NullType) String() string

type NullableAnnotation added in v0.34.0

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

func NewNullableAnnotation added in v0.34.0

func NewNullableAnnotation(ann template.NodeAnnotation, valueType yamlmeta.Type, pos *filepos.Position) (*NullableAnnotation, error)

func (*NullableAnnotation) NewTypeFromAnn added in v0.34.0

func (n *NullableAnnotation) NewTypeFromAnn() yamlmeta.Type

type ScalarType

type ScalarType struct {
	ValueType interface{}
	Position  *filepos.Position
	// contains filtered or unexported fields
}

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) GetDefaultValue added in v0.35.0

func (m ScalarType) GetDefaultValue() interface{}

func (ScalarType) GetDefinitionPosition added in v0.35.0

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

func (ScalarType) GetValueType

func (m ScalarType) GetValueType() yamlmeta.Type

func (ScalarType) String added in v0.32.0

func (m ScalarType) String() string

type TypeAnnotation added in v0.34.0

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

func NewTypeAnnotation added in v0.34.0

func NewTypeAnnotation(ann template.NodeAnnotation, inferredType yamlmeta.Type, pos *filepos.Position) (*TypeAnnotation, error)

func (*TypeAnnotation) IsAny added in v0.34.0

func (t *TypeAnnotation) IsAny() bool

func (*TypeAnnotation) NewTypeFromAnn added in v0.34.0

func (t *TypeAnnotation) NewTypeFromAnn() yamlmeta.Type

Jump to

Keyboard shortcuts

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