Skip to content

Commit ac18113

Browse files
authored
show errors in security requirements (#637)
1 parent e95ed34 commit ac18113

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

openapi3filter/errors.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package openapi3filter
22

33
import (
4+
"bytes"
45
"fmt"
56

67
"github.com/getkin/kin-openapi/openapi3"
@@ -78,5 +79,14 @@ type SecurityRequirementsError struct {
7879
}
7980

8081
func (err *SecurityRequirementsError) Error() string {
81-
return "Security requirements failed"
82+
buff := &bytes.Buffer{}
83+
buff.WriteString("security requirements failed: ")
84+
for i, e := range err.Errors {
85+
buff.WriteString(e.Error())
86+
if i != len(err.Errors)-1 {
87+
buff.WriteString(" | ")
88+
}
89+
}
90+
91+
return buff.String()
8292
}

0 commit comments

Comments
 (0)