Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Fenoll <[email protected]>
  • Loading branch information
fenollp committed Oct 13, 2022
1 parent 255e8d8 commit 7588564
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion openapi3filter/req_resp_decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ func TestDecodeParameter(t *testing.T) {
require.NoError(t, err)

input := &RequestValidationInput{Request: req, PathParams: pathParams, Route: route}
got, found, err := decodeStyledParameter(tc.param, input)
got, found, err := decodeStyledParameter(tc.param, input, tc.param.Schema)

require.Truef(t, found == tc.found, "got found: %t, want found: %t", found, tc.found)

Expand Down
5 changes: 3 additions & 2 deletions openapi3filter/validate_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ func ValidateParameter(ctx context.Context, input *RequestValidationInput, param
err = fmt.Errorf("multiple content types for parameter %q", parameter.Name)
return &RequestError{Input: input, Parameter: parameter, Err: err}
} else {
mt := parameter.Content.Get("application/json")
const ct = "application/json"
mt := parameter.Content.Get(ct)
if mt == nil {
err = fmt.Errorf("parameter %q has no content schema", parameter.Name)
err = fmt.Errorf("parameter %q has no content schema for %q", parameter.Name, ct)
return &RequestError{Input: input, Parameter: parameter, Err: err}
}
schemaRef = mt.Schema
Expand Down

0 comments on commit 7588564

Please sign in to comment.