validationfile

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAssertionsBlock

func ParseAssertionsBlock(contents []byte) (*blocks.Assertions, error)

ParseAssertionsBlock parses the given contents as an assertions block.

func ParseExpectedRelationsBlock added in v1.5.0

func ParseExpectedRelationsBlock(contents []byte) (*blocks.ParsedExpectedRelations, error)

ParseExpectedRelationsBlock parses the given contents as an expected relations block.

Types

type PopulatedValidationFile added in v1.5.0

type PopulatedValidationFile struct {
	// Schema is the entered schema text, if any.
	Schema string

	// NamespaceDefinitions are the namespaces defined in the validation file, in either
	// direct or compiled from schema form.
	NamespaceDefinitions []*core.NamespaceDefinition

	// Tuples are the relation tuples defined in the validation file, either directly
	// or in the relationships block.
	Tuples []*core.RelationTuple

	// ParsedFiles are the underlying parsed validation files.
	ParsedFiles []ValidationFile
}

PopulatedValidationFile contains the fully parsed information from a validation file.

func PopulateFromFiles

func PopulateFromFiles(ds datastore.Datastore, filePaths []string) (*PopulatedValidationFile, decimal.Decimal, error)

PopulateFromFiles populates the given datastore with the namespaces and tuples found in the validation file(s) specified.

type ValidationFile

type ValidationFile struct {
	// Schema is the schema.
	Schema blocks.ParsedSchema `yaml:"schema"`

	// Relationships are the relationships specified in the validation file.
	Relationships blocks.ParsedRelationships `yaml:"relationships"`

	// Assertions are the assertions defined in the validation file. May be nil
	// if no assertions are defined.
	Assertions blocks.Assertions `yaml:"assertions"`

	// ExpectedRelations is the map of expected relations.
	ExpectedRelations blocks.ParsedExpectedRelations `yaml:"validation"`

	// NamespaceConfigs are the namespace configuration protos, in text format.
	// Deprecated: only for internal use. Use Schema.
	NamespaceConfigs []string `yaml:"namespace_configs"`

	// ValidationTuples are the validation tuples, in tuple string syntax.
	// Deprecated: only for internal use. Use Relationships.
	ValidationTuples []string `yaml:"validation_tuples"`
}

ValidationFile is a structural representation of the validation file format.

func DecodeValidationFile added in v1.5.0

func DecodeValidationFile(contents []byte) (*ValidationFile, error)

DecodeValidationFile decodes the validation file as found in the contents bytes and returns it.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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