Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidationError

func IsValidationError(err error) bool

Types

type PathBuilder

type PathBuilder []string

func RootedAt

func RootedAt(name string) PathBuilder

func (PathBuilder) Field

func (p PathBuilder) Field(name string) PathBuilder

func (PathBuilder) Index

func (p PathBuilder) Index(index int) PathBuilder

func (PathBuilder) Key

func (p PathBuilder) Key(key string) PathBuilder

func (PathBuilder) String

func (p PathBuilder) String() string

type ValidationError

type ValidationError struct {
	Violations []Violation `json:"violations"`
}

func (*ValidationError) Add

func (v *ValidationError) Add(err ValidationError)

func (*ValidationError) AddError

func (v *ValidationError) AddError(rootField string, validationErr ValidationError)

func (*ValidationError) AddErrorAt

func (v *ValidationError) AddErrorAt(path PathBuilder, validationErr ValidationError)

func (*ValidationError) AddViolation

func (v *ValidationError) AddViolation(field string, message string)

func (*ValidationError) AddViolationAt

func (v *ValidationError) AddViolationAt(path PathBuilder, message string)

func (*ValidationError) Error

func (v *ValidationError) Error() string

func (*ValidationError) HasViolations

func (v *ValidationError) HasViolations() bool

func (*ValidationError) OrNil

func (v *ValidationError) OrNil() error

func (*ValidationError) Transform

func (v *ValidationError) Transform(transformFunc func(Violation) Violation) *ValidationError

    Transform returns a new ValidationError with every violation transformed by a given transformFunc.

    type Violation

    type Violation struct {
    	Field   string `json:"field"`
    	Message string `json:"message"`
    }

    Source Files