Skip to content

Commit

Permalink
show errors in security requirements (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
danicc097 committed Oct 16, 2022
1 parent e95ed34 commit ac18113
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion openapi3filter/errors.go
@@ -1,6 +1,7 @@
package openapi3filter

import (
"bytes"
"fmt"

"github.com/getkin/kin-openapi/openapi3"
Expand Down Expand Up @@ -78,5 +79,14 @@ type SecurityRequirementsError struct {
}

func (err *SecurityRequirementsError) Error() string {
return "Security requirements failed"
buff := &bytes.Buffer{}
buff.WriteString("security requirements failed: ")
for i, e := range err.Errors {
buff.WriteString(e.Error())
if i != len(err.Errors)-1 {
buff.WriteString(" | ")
}
}

return buff.String()
}

0 comments on commit ac18113

Please sign in to comment.