Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion openapi3filter/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var _ interface{ Unwrap() error } = RequestError{}
func (err *RequestError) Error() string {
reason := err.Reason
if e := err.Err; e != nil {
if len(reason) == 0 {
if len(reason) == 0 || reason == e.Error() {
reason = e.Error()
} else {
reason += ": " + e.Error()
Expand Down
6 changes: 3 additions & 3 deletions openapi3filter/validation_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func getValidationTests(t *testing.T) []*validationTest {
},
wantErrParam: "status",
wantErrParamIn: "query",
wantErrBody: `parameter "status" in query has an error: value is required but missing: value is required but missing`,
wantErrBody: `parameter "status" in query has an error: value is required but missing`,
wantErrReason: "value is required but missing",
wantErrResponse: &ValidationError{Status: http.StatusBadRequest,
Title: `parameter "status" in query is required`},
Expand Down Expand Up @@ -214,7 +214,7 @@ func getValidationTests(t *testing.T) []*validationTest {
},
wantErrParam: "tags",
wantErrParamIn: "query",
wantErrBody: `parameter "tags" in query has an error: empty value is not allowed: empty value is not allowed`,
wantErrBody: `parameter "tags" in query has an error: empty value is not allowed`,
wantErrReason: "empty value is not allowed",
wantErrResponse: &ValidationError{Status: http.StatusBadRequest,
Title: `parameter "tags" in query is not allowed to be empty`},
Expand Down Expand Up @@ -444,7 +444,7 @@ func getValidationTests(t *testing.T) []*validationTest {
},
wantErrParam: "petId",
wantErrParamIn: "path",
wantErrBody: `parameter "petId" in path has an error: value is required but missing: value is required but missing`,
wantErrBody: `parameter "petId" in path has an error: value is required but missing`,
wantErrReason: "value is required but missing",
wantErrResponse: &ValidationError{Status: http.StatusBadRequest,
Title: `parameter "petId" in path is required`},
Expand Down