Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump github.com/getkin/kin-openapi from 0.61.0 to 0.62.0 #9

Merged
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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/huk-coburg/openapirouter
go 1.15

require (
github.com/getkin/kin-openapi v0.61.0
github.com/getkin/kin-openapi v0.62.0
github.com/go-openapi/swag v0.19.15 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/stretchr/testify v1.7.0
Expand Down
6 changes: 4 additions & 2 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ func (router *Router) ServeHTTP(writer http.ResponseWriter, request *http.Reques
}
handler, ok := router.implementations[route]
if ok {
err = openapi3filter.ValidateRequest(context.Background(), &openapi3filter.RequestValidationInput{
validationInput := &openapi3filter.RequestValidationInput{
Request: request,
PathParams: pathParams,
QueryParams: request.URL.Query(),
Route: route,
Options: handler.options,
})
}
err = openapi3filter.ValidateRequest(request.Context(), validationInput)
if err != nil {
switch typedErr := err.(type) {
case *openapi3filter.RequestError:
Expand All @@ -75,6 +76,7 @@ func (router *Router) ServeHTTP(writer http.ResponseWriter, request *http.Reques
response.write(writer)
return
}
request = validationInput.Request
ctx := context.WithValue(request.Context(), pathParamsKey, pathParams)
handler.ServeHTTP(writer, request.WithContext(ctx))
} else {
Expand Down