Skip to content

Commit 3605205

Browse files
committed
adapt multierror
Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
1 parent c71680b commit 3605205

File tree

4 files changed

+84
-165
lines changed

4 files changed

+84
-165
lines changed

openapi3/errors.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ func (e ValidationError) Errors() []gojsonschema.ResultError {
3030
return e
3131
}
3232

33+
func (e ValidationError) asMultiError() MultiError {
34+
errs := make([]error, 0, len(e))
35+
for _, re := range e {
36+
errs = append(errs, errors.New(re.String()))
37+
}
38+
return errs
39+
}
40+
3341
// MultiError is a collection of errors, intended for when
3442
// multiple issues need to be reported upstream
3543
type MultiError []error

0 commit comments

Comments
 (0)