modeler

package
v0.0.0-...-a649549 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnparsablePayload = errors.New("unparsable piped payload")
	ErrNoSuchSchema      = errors.New("no such schema")
)

Functions

func FindControlCharacters

func FindControlCharacters(str string) (err error)

FindControlCharacters finds control characters that annoy YAML.

func StripControlCharacters

func StripControlCharacters(str string) string

StripControlCharacters removes control characters that annoy YAML.

Types

type Caller

type Caller interface {
	// RequestProto returns call input as used by the client
	RequestProto() *fm.Clt_CallRequestRaw

	// Do sends the request and waits for the response
	Do(context.Context)

	// ResponseProto returns call output as received by the client
	ResponseProto() *fm.Clt_CallResponseRaw

	// NextCallerCheck returns ("",nil) when out of checks to run.
	// Otherwise it returns named checks inherent to the caller.
	NextCallerCheck() (string, CheckerFunc)
}

Caller performs a request and awaits a response.

type CheckerFunc

type CheckerFunc func() (string, string, []string)

CheckerFunc returns whether validation succeeded, was skipped or failed.

type Interface

type Interface interface {
	// Name uniquely identifies this instance
	Name() string

	// ToProto marshals a modeler.Interface implementation into a *fm.Clt_Fuzz_Model
	ToProto() *fm.Clt_Fuzz_Model

	// Lint goes through specs and unsures they are valid
	Lint(ctx context.Context, showSpec bool) error

	// InputsCount sums the amount of named schemas or types APIs define
	InputsCount() int
	// WriteAbsoluteReferences pretty-prints the API's named types
	WriteAbsoluteReferences(w io.Writer)
	// FilterEndpoints restricts which API endpoints are considered
	FilterEndpoints(criteria []string) ([]uint32, error)

	ValidateAgainstSchema(ref string, data []byte) error
	Validate(uint32, *structpb.Value) []string

	// NewCaller is called before making each call
	NewCaller(ctx context.Context, call *fm.Srv_Call, showf ShowFunc) Caller
}

Interface describes checkable models. A package defining a type that implements Interface also has to define: * a non-empty const Name that names the Starlark builtin * a func of type Maker named New that instanciates a new model

type Maker

type Maker func(kwargs []starlark.Tuple) (Interface, error)

Maker types the New func that instanciates new models

type NoSuchRefError

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

NoSuchRefError represents a schema path that is not found

func NewNoSuchRefError

func NewNoSuchRefError(ref string) *NoSuchRefError

NewNoSuchRefError creates a new error with the given absRef

func (*NoSuchRefError) Error

func (e *NoSuchRefError) Error() string

type ShowFunc

type ShowFunc func(string, ...interface{})

ShowFunc can be used to display informational messages to the tester

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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