File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -1489,6 +1489,8 @@ type SchemaError struct {
1489
1489
Origin error
1490
1490
}
1491
1491
1492
+ var _ interface { Unwrap () error } = SchemaError {}
1493
+
1492
1494
func markSchemaErrorKey (err error , key string ) error {
1493
1495
if v , ok := err .(* SchemaError ); ok {
1494
1496
v .reversePath = append (v .reversePath , key )
@@ -1564,6 +1566,10 @@ func (err *SchemaError) Error() string {
1564
1566
return buf .String ()
1565
1567
}
1566
1568
1569
+ func (err SchemaError ) Unwrap () error {
1570
+ return err .Origin
1571
+ }
1572
+
1567
1573
func isSliceOfUniqueItems (xs []interface {}) bool {
1568
1574
s := len (xs )
1569
1575
m := make (map [string ]struct {}, s )
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ type RequestError struct {
17
17
Err error
18
18
}
19
19
20
+ var _ interface { Unwrap () error } = RequestError {}
21
+
20
22
func (err * RequestError ) Error () string {
21
23
reason := err .Reason
22
24
if e := err .Err ; e != nil {
@@ -35,6 +37,10 @@ func (err *RequestError) Error() string {
35
37
}
36
38
}
37
39
40
+ func (err RequestError ) Unwrap () error {
41
+ return err .Err
42
+ }
43
+
38
44
var _ error = & ResponseError {}
39
45
40
46
// ResponseError is returned by ValidateResponse when response does not match OpenAPI spec
@@ -44,6 +50,8 @@ type ResponseError struct {
44
50
Err error
45
51
}
46
52
53
+ var _ interface { Unwrap () error } = ResponseError {}
54
+
47
55
func (err * ResponseError ) Error () string {
48
56
reason := err .Reason
49
57
if e := err .Err ; e != nil {
@@ -56,6 +64,10 @@ func (err *ResponseError) Error() string {
56
64
return reason
57
65
}
58
66
67
+ func (err ResponseError ) Unwrap () error {
68
+ return err .Err
69
+ }
70
+
59
71
var _ error = & SecurityRequirementsError {}
60
72
61
73
// SecurityRequirementsError is returned by ValidateSecurityRequirements
Original file line number Diff line number Diff line change 4
4
"encoding/json"
5
5
"errors"
6
6
"fmt"
7
- "gopkg.in/yaml.v2"
8
7
"io"
9
8
"io/ioutil"
10
9
"mime"
@@ -15,6 +14,8 @@ import (
15
14
"strconv"
16
15
"strings"
17
16
17
+ "gopkg.in/yaml.v2"
18
+
18
19
"github.com/getkin/kin-openapi/openapi3"
19
20
)
20
21
@@ -42,6 +43,8 @@ type ParseError struct {
42
43
path []interface {}
43
44
}
44
45
46
+ var _ interface { Unwrap () error } = ParseError {}
47
+
45
48
func (e * ParseError ) Error () string {
46
49
var msg []string
47
50
if p := e .Path (); len (p ) > 0 {
@@ -81,6 +84,10 @@ func (e *ParseError) RootCause() error {
81
84
return e .Cause
82
85
}
83
86
87
+ func (e ParseError ) Unwrap () error {
88
+ return e .Cause
89
+ }
90
+
84
91
// Path returns a path to the root cause.
85
92
func (e * ParseError ) Path () []interface {} {
86
93
var path []interface {}
You can’t perform that action at this time.
0 commit comments