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
mgabeler-lee-6rs authored May 18, 2021
1 parent 551a3d4 commit 77cf27d
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions oapi_validate.go
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ func OapiValidatorFromYamlFile(path string) (echo.MiddlewareFunc, error) {
return nil, fmt.Errorf("error reading %s: %s", path, err)
}

swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData(data)
swagger, err := openapi3.NewLoader().LoadFromData(data)
if err != nil {
return nil, fmt.Errorf("error parsing %s as Swagger YAML: %s",
path, err)
@@ -52,7 +52,7 @@ func OapiValidatorFromYamlFile(path string) (echo.MiddlewareFunc, error) {
}

// Create a validator from a swagger object.
func OapiRequestValidator(swagger *openapi3.Swagger) echo.MiddlewareFunc {
func OapiRequestValidator(swagger *openapi3.T) echo.MiddlewareFunc {
return OapiRequestValidatorWithOptions(swagger, nil)
}

@@ -66,7 +66,7 @@ type Options struct {
}

// Create a validator from a swagger object, with validation options
func OapiRequestValidatorWithOptions(swagger *openapi3.Swagger, options *Options) echo.MiddlewareFunc {
func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) echo.MiddlewareFunc {
router, err := legacy.NewRouter(swagger)
if err != nil {
panic(err)
2 changes: 1 addition & 1 deletion oapi_validate_test.go
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ func doPost(t *testing.T, e *echo.Echo, 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")

// Create a new echo router

0 comments on commit 77cf27d

Please sign in to comment.