Help us shape the future of Go! Take the 2026 Go Developer Survey

validators

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validator

type Validator interface {
	Name() string
	Validate(item fetcher.TestCase) error
	IsFatal() bool
}

func All

func All() []Validator

func LoadExternalValidators

func LoadExternalValidators() ([]Validator, error)

func NewExternalValidator

func NewExternalValidator(definition ValidatorDefinition) Validator

NewExternalValidator creates a new external validator based on the given definition and returns a validation.Validator

func NewRangeValidator

func NewRangeValidator() Validator

NewRangeValidator creates a new instance of a range validator

func NewSchemaValidator

func NewSchemaValidator() Validator

NewSchemaValidator returns a new schema validator

func NewStatusValidator

func NewStatusValidator() Validator

NewStatusValidator returns a new status validator that checks for status codes other than 200

func NewStatusValidatorC

func NewStatusValidatorC(code int) Validator

NewStatusValidatorC returns a new status validator that checks for status codes other than the given code

func Without

func Without(names ...string) []Validator

type ValidatorDefinition

type ValidatorDefinition struct {
	Name          string   // Name is the name of the validator
	Path          string   // Path is the path to the executable
	Args          []string // Args are the arguments to pass to the executable
	ReadFromStdin bool     // ReadFromStdin controls whether the validator expects the item to validate on stdin
	Fatal         bool     // Fatal controls whether the validator is fatal or not that is if it fails the pipeline should stop
}

ValidatorDefinition is the definition of an external validator

type ValidatorStatus added in v1.1.0

type ValidatorStatus string
const (
	ValidatorStatusUnknown ValidatorStatus = "unknown"
	ValidatorStatusSuccess ValidatorStatus = "success"
	ValidatorStatusSkipped ValidatorStatus = "skipped"
	ValidatorStatusFail    ValidatorStatus = "fail"
)

Jump to

Keyboard shortcuts

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