package spec import ( "strings" "github.com/pkg/errors" "github.com/qri-io/jsonschema" ) var ErrUnknownSchema = errors.New("unknown schema") type ValidationError struct { keyErrors []jsonschema.KeyError } func (e *ValidationError) Error() string { var sb strings.Builder if _, err := sb.WriteString("validation error: "); err != nil { panic(errors.WithStack(err)) } for i, err := range e.keyErrors { if i != 0 { if _, err := sb.WriteString(", "); err != nil { panic(errors.WithStack(err)) } } if _, err := sb.WriteString(err.Error()); err != nil { panic(errors.WithStack(err)) } } return sb.String() }