validationfile

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: Apache-2.0 Imports: 13 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(ctx context.Context, ds datastore.Datastore, filePaths []string) (*PopulatedValidationFile, datastore.Revision, error)

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

func PopulateFromFilesContents added in v1.11.0

func PopulateFromFilesContents(ctx context.Context, ds datastore.Datastore, filesContents map[string][]byte) (*PopulatedValidationFile, datastore.Revision, error)

PopulateFromFilesContents populates the given datastore with the namespaces and tuples found in the validation file(s) contents 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