Skip to content

Commit

Permalink
fix build with kin-openapi 0.61.0 (#348)
Browse files Browse the repository at this point in the history
* fix build with kin-openapi 0.61.0

Addresses changes from getkin/kin-openapi#351

* go mod tidy
  • Loading branch information
mgabeler-lee-6rs authored May 18, 2021
1 parent c88b33d commit 56fd5b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions oapi_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ type Options struct {

// OapiRequestValidator Creates middleware to validate request by swagger spec.
// This middleware is good for net/http either since go-chi is 100% compatible with net/http.
func OapiRequestValidator(swagger *openapi3.Swagger) func(next http.Handler) http.Handler {
func OapiRequestValidator(swagger *openapi3.T) func(next http.Handler) http.Handler {
return OapiRequestValidatorWithOptions(swagger, nil)
}

// OapiRequestValidatorWithOptions Creates middleware to validate request by swagger spec.
// This middleware is good for net/http either since go-chi is 100% compatible with net/http.
func OapiRequestValidatorWithOptions(swagger *openapi3.Swagger, options *Options) func(next http.Handler) http.Handler {
func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) func(next http.Handler) http.Handler {
router, err := legacy.NewRouter(swagger)
if err != nil {
panic(err)
Expand Down
4 changes: 2 additions & 2 deletions oapi_validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func doPost(t *testing.T, mux *chi.Mux, url string, jsonBody interface{}) *httpt
}

func TestOapiRequestValidator(t *testing.T) {
swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(testSchema))
swagger, err := openapi3.NewLoader().LoadFromData([]byte(testSchema))
require.NoError(t, err, "Error initializing swagger")

r := chi.NewRouter()
Expand All @@ -115,7 +115,7 @@ func TestOapiRequestValidator(t *testing.T) {
}

func TestOapiRequestValidatorWithOptions(t *testing.T) {
swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(testSchema))
swagger, err := openapi3.NewLoader().LoadFromData([]byte(testSchema))
require.NoError(t, err, "Error initializing swagger")

r := chi.NewRouter()
Expand Down

0 comments on commit 56fd5b6

Please sign in to comment.