generated from PenaSide/GolangTemplate
21 lines
523 B
Go
21 lines
523 B
Go
![]() |
package swagger
|
||
|
|
||
|
import (
|
||
|
"github.com/deepmap/oapi-codegen/pkg/middleware"
|
||
|
"github.com/getkin/kin-openapi/openapi3"
|
||
|
"github.com/getkin/kin-openapi/openapi3filter"
|
||
|
"github.com/labstack/echo/v4"
|
||
|
)
|
||
|
|
||
|
func CreateMiddleware(swagger *openapi3.T, authenticationFunc openapi3filter.AuthenticationFunc) echo.MiddlewareFunc {
|
||
|
validator := middleware.OapiRequestValidatorWithOptions(swagger,
|
||
|
&middleware.Options{
|
||
|
Options: openapi3filter.Options{
|
||
|
AuthenticationFunc: authenticationFunc,
|
||
|
},
|
||
|
},
|
||
|
)
|
||
|
|
||
|
return validator
|
||
|
}
|