validator

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingPrefix     = errors.New("missing tag prefix '" + prefix + "'")
	ErrDuplicateRuleTags = errors.New("tag name already registered")
	ErrNilRule           = errors.New("rule is nil")
	ErrReferenceIsNil    = errors.New("reference is nil")
)

Functions

This section is empty.

Types

type InheritNonExistingTagError

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

InheritNonExistingTagError indicate that defined heredity does not exist.

func (InheritNonExistingTagError) Error

type InvalidTypeError

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

InvalidTypeError indicate that a type is invalid.

func (InvalidTypeError) Error

func (i InvalidTypeError) Error() string

type UnknownPathError

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

UnknownPathError indicate that defined path does not exist.

func (UnknownPathError) Error

func (u UnknownPathError) Error() string

type UnknownRuleError

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

UnknownRuleError indicate that requested rule is not known.

func (UnknownRuleError) Error

func (u UnknownRuleError) Error() string

type Validator

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

Validator interprets reference to validate JSON patch operations.

func NewValidator

func NewValidator(referenceType reflect.Type) (*Validator, error)

NewValidator create a new instance of validator using given reference.

func (*Validator) RegisterRule

func (v *Validator) RegisterRule(key string, rule rule.Rule) error

RegisterRule register addition rule for specific key (must have prefix `jp_`).

func (*Validator) UseReference

func (v *Validator) UseReference(referenceType reflect.Type) error

UseReference interpret given reference to model rule set.

func (Validator) Validate

func (v Validator) Validate(operationSpec operation.Spec) error

Validate a given JSON patch operations again rules.

Jump to

Keyboard shortcuts

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