Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNilSchema = errors.New("nil schema")
)
Functions ¶
func AddValidationErrorStruct ¶
func AddValidationErrorStruct(perr *error, ve *ValidationError)
AddValidationErrorStruct adds a ValidationError to an existing error. The provided ve should already have basic fields populated.
func IsValidationError ¶
IsValidationError reports whether err is a validation error.
Types ¶
type ValidationError ¶
type ValidationError struct {
// Basic output fields per JSON Schema output format (basic):
// https://json-schema.org/draft/2020-12/json-schema-core.html#name-output-formats
// These are the canonical fields consumers should use.
Message string `json:"error"`
KeywordLocation string `json:"keywordLocation"`
InstanceLocation string `json:"instanceLocation"`
}
ValidationError is returned by a validation function when an instance fails validation.
func (*ValidationError) Error ¶
func (ve *ValidationError) Error() string
Error returns the error message that a user should see. This implements the error interface.
type ValidationErrors ¶
type ValidationErrors struct {
Errs []*ValidationError
}
ValidationErrors is a collection of ValidationError values.
func (*ValidationErrors) Error ¶
func (ves *ValidationErrors) Error() string
Error returns the error message that a user should see. This implements the error interface.
Click to show internal directories.
Click to hide internal directories.