From 29d16d13ba6c1d55cd81d47d45730963cf4ed459 Mon Sep 17 00:00:00 2001 From: CorrectRoadH Date: Thu, 18 Jan 2024 11:39:49 +0800 Subject: [PATCH] fix: fix upload specify file format is fail (#1613) --- route/v2.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/route/v2.go b/route/v2.go index e68c566..d324920 100644 --- a/route/v2.go +++ b/route/v2.go @@ -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}, }))