validators

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoDiscoverExternal

func AutoDiscoverExternal(override bool) error

Types

type ExtendedValidationItem

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

func (ExtendedValidationItem) Definition

func (ExtendedValidationItem) Response

type FindExecFunc

type FindExecFunc func(string) (string, error)

type SlimValidationItem

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

func (SlimValidationItem) Definition

func (i SlimValidationItem) Definition() definitions.Endpoint

func (SlimValidationItem) Response

type ValidationItem

type ValidationItem interface {
	Response() validation.EndpointResponse
	Definition() definitions.Endpoint
}

func NewValidationItem

func NewValidationItem(response validation.EndpointResponse, definition definitions.Endpoint) ValidationItem

type Validator

type Validator interface {
	Name() string
	Validate(item ValidationItem) error
	IsFatal() bool
	IsSlim() bool
}

func LoadExternalValidators

func LoadExternalValidators() ([]Validator, error)

LoadExternalValidators loads the exernal validators from the definitions

func NewExternalValidator

func NewExternalValidator(definition ValidatorDefinition) Validator

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

func NewSchemaValidator

func NewSchemaValidator() Validator

NewSchemaValidator returns a new schema 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
	Fatal bool     // Fatal controls whether the validator is fatal or not that is if it fails the pipeline should stop
	Slim  bool     // Slim controls how much data the validator gets. Setting this to true reduces the context the validator gets
}

ValidatorDefinition is the definition of an external validator

type ValidatorStatus

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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