Skip to content

Commit

Permalink
Fixed validation errors in openapi file to be logged as errors instea…
Browse files Browse the repository at this point in the history
…d of panic (#21)
  • Loading branch information
Johannes Koch authored and Marcel Ludwig committed Dec 9, 2020
1 parent 627fa8c commit d1a762d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion handler/openapi_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ func NewOpenAPIValidatorFactory(openapi *config.OpenAPI) (*OpenAPIValidatorFacto
if err != nil {
return nil, err
}
router := openapi3filter.NewRouter()
err = router.AddSwaggerFromFile(dir + "/" + openapi.File)
if err != nil {
return nil, err
}
return &OpenAPIValidatorFactory{
router: openapi3filter.NewRouter().WithSwaggerFromFile(dir + "/" + openapi.File),
router: router,
ignoreRequestViolations: openapi.IgnoreRequestViolations,
ignoreResponseViolations: openapi.IgnoreResponseViolations,
}, nil
Expand Down

0 comments on commit d1a762d

Please sign in to comment.