Documentation
¶
Index ¶
- Constants
- func GetEchoContext(c context.Context) echo.Context
- func GetUserData(c context.Context) interface{}
- func OapiRequestValidator(swagger *openapi3.T) echo.MiddlewareFunc
- func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) echo.MiddlewareFunc
- func OapiValidatorFromYamlFile(path string) (echo.MiddlewareFunc, error)
- func ValidateRequestFromContext(ctx echo.Context, router routers.Router, options *Options) *echo.HTTPError
- type ErrorHandler
- type MultiErrorHandler
- type Options
Constants ¶
const ( EchoContextKey = "oapi-codegen/echo-context" UserDataKey = "oapi-codegen/user-data" )
Variables ¶
This section is empty.
Functions ¶
func GetEchoContext ¶
GetEchoContext gets the echo context from within requests. It returns nil if not found or wrong type.
func GetUserData ¶
func OapiRequestValidator ¶
func OapiRequestValidator(swagger *openapi3.T) echo.MiddlewareFunc
OapiRequestValidator creates a validator from a swagger object.
func OapiRequestValidatorWithOptions ¶
func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) echo.MiddlewareFunc
OapiRequestValidatorWithOptions creates a validator from a swagger object, with validation options
func OapiValidatorFromYamlFile ¶
func OapiValidatorFromYamlFile(path string) (echo.MiddlewareFunc, error)
OapiValidatorFromYamlFile is an Echo middleware function which validates incoming HTTP requests to make sure that they conform to the given OAPI 3.0 specification. When OAPI validation fails on the request, we return an HTTP/400. Create validator middleware from a YAML file path
Types ¶
type ErrorHandler ¶
ErrorHandler is called when there is an error in validation
type MultiErrorHandler ¶
type MultiErrorHandler func(openapi3.MultiError) *echo.HTTPError
MultiErrorHandler is called when oapi returns a MultiError type
type Options ¶
type Options struct {
ErrorHandler ErrorHandler
Options openapi3filter.Options
ParamDecoder openapi3filter.ContentParameterDecoder
UserData interface{}
Skipper echomiddleware.Skipper
MultiErrorHandler MultiErrorHandler
// SilenceServersWarning allows silencing a warning for https://github.com/deepmap/oapi-codegen/issues/882 that reports when an OpenAPI spec has `spec.Servers != nil`
SilenceServersWarning bool
}
Options to customize request validation. These are passed through to openapi3filter.