Documentation ¶
Index ¶
- func IsValidationError(err error) bool
- type PathBuilder
- type ValidationError
- func (v *ValidationError) Add(err ValidationError)
- func (v *ValidationError) AddError(rootField string, validationErr ValidationError)
- func (v *ValidationError) AddErrorAt(path PathBuilder, validationErr ValidationError)
- func (v *ValidationError) AddViolation(field string, message string)
- func (v *ValidationError) AddViolationAt(path PathBuilder, message string)
- func (v *ValidationError) Error() string
- func (v *ValidationError) HasViolations() bool
- func (v *ValidationError) OrNil() error
- func (v *ValidationError) Transform(transformFunc func(Violation) Violation) *ValidationError
- type Violation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidationError ¶
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.
Click to show internal directories.
Click to hide internal directories.