{"modulePath":"github.com/deepmap/oapi-codegen","version":"v1.16.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package middleware\n\n## Constants\n\n```go\nconst (\n\tEchoContextKey = \"oapi-codegen/echo-context\"\n\tUserDataKey    = \"oapi-codegen/user-data\"\n)\n```\n\n## Functions\n\n```go\nfunc GetEchoContext(c context.Context) echo.Context\n```\nGetEchoContext gets the echo context from within requests. It returns nil if not found or wrong type.\n\nDeprecated: This has been replaced by [https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#GetEchoContext](https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#GetEchoContext)\n\n```go\nfunc GetUserData(c context.Context) interface{}\n```\nDeprecated: This has been replaced by [https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#GetUserData](https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#GetUserData)\n\n```go\nfunc OapiRequestValidator(swagger *openapi3.T) echo.MiddlewareFunc\n```\nOapiRequestValidator creates a validator from a swagger object.\n\nDeprecated: This has been replaced by [https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#OapiRequestValidator](https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#OapiRequestValidator)\n\n```go\nfunc OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) echo.MiddlewareFunc\n```\nOapiRequestValidatorWithOptions creates a validator from a swagger object, with validation options\n\nDeprecated: This has been replaced by [https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#OapiRequestValidatorWithOptions](https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#OapiRequestValidatorWithOptions)\n\n```go\nfunc OapiValidatorFromYamlFile(path string) (echo.MiddlewareFunc, error)\n```\nOapiValidatorFromYamlFile 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\n\nDeprecated: This has been replaced by [https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#OapiValidatorFromYamlFile](https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#OapiValidatorFromYamlFile)\n\n```go\nfunc ValidateRequestFromContext(ctx echo.Context, router routers.Router, options *Options) *echo.HTTPError\n```\nValidateRequestFromContext is called from the middleware above and actually does the work of validating a request.\n\nDeprecated: This has been replaced by [https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#ValidateRequestFromContext](https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#ValidateRequestFromContext)\n\n## Types\n\n```go\ntype ErrorHandler func(c echo.Context, err *echo.HTTPError) error\n```\nErrorHandler is called when there is an error in validation\n\nDeprecated: This has been replaced by [https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#ErrorHandler](https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#ErrorHandler)\n\n```go\ntype MultiErrorHandler func(openapi3.MultiError) *echo.HTTPError\n```\nMultiErrorHandler is called when oapi returns a MultiError type\n\nDeprecated: This has been replaced by [https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#MultiErrorHandler](https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#MultiErrorHandler)\n\n```go\ntype Options struct {\n\tErrorHandler      ErrorHandler\n\tOptions           openapi3filter.Options\n\tParamDecoder      openapi3filter.ContentParameterDecoder\n\tUserData          interface{}\n\tSkipper           echomiddleware.Skipper\n\tMultiErrorHandler MultiErrorHandler\n\t// SilenceServersWarning allows silencing a warning for https://github.com/deepmap/oapi-codegen/issues/882 that reports when an OpenAPI spec has `spec.Servers != nil`\n\tSilenceServersWarning bool\n}\n```\nOptions to customize request validation. These are passed through to openapi3filter.\n\nDeprecated: This has been replaced by [https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#Options](https://pkg.go.dev/github.com/oapi-codegen/echo-middleware#Options)\n\n","path":"github.com/deepmap/oapi-codegen/pkg/middleware","name":"middleware","synopsis":"","isRedistributable":true}
