Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func (s *Schema) Validate(spec *cdi.Spec) error {
return s.ValidateType(spec)
}

// Error wraps a JSON validation result.
type Error struct {
Result *schema.Result
// validationError wraps a JSON validation result.
type validationError struct {
result *schema.Result
}

// Set sets the default validating JSON schema.
Expand Down Expand Up @@ -239,7 +239,7 @@ func (s *Schema) validate(doc schema.JSONLoader) error {
return nil
}

return &Error{Result: docErr}
return &validationError{result: docErr}
}

type schemaContents map[string]interface{}
Expand Down Expand Up @@ -337,14 +337,14 @@ func (s *Schema) validateContents(any map[string]interface{}) error {
return nil
}

// Error returns the given Result's errors as a single error string.
func (e *Error) Error() string {
if e == nil || e.Result == nil || e.Result.Valid() {
// validationError returns the given result's errors as a single error string.
func (e *validationError) Error() string {
if e == nil || e.result == nil || e.result.Valid() {
return ""
}

errs := []error{}
for _, err := range e.Result.Errors() {
for _, err := range e.result.Errors() {
errs = append(errs, fmt.Errorf("%v", err))
}

Expand Down