fix: fix upload specify file format is fail (#1613)

This commit is contained in:
CorrectRoadH 2024-01-18 11:39:49 +08:00 committed by GitHub
parent 54a115ae89
commit 29d16d13ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -116,6 +116,12 @@ func InitV2Router() http.Handler {
// })
e.Use(middleware.OapiRequestValidatorWithOptions(_swagger, &middleware.Options{
Skipper: func(c echo.Context) bool {
// jump validate when upload file
// because file upload can't pass validate
// issue: https://github.com/deepmap/oapi-codegen/issues/514
return strings.Contains(c.Request().URL.Path, "file/upload")
},
Options: openapi3filter.Options{AuthenticationFunc: openapi3filter.NoopAuthenticationFunc},
}))