Documentation ¶
Overview ¶
Package middleware implements middleware function for server implementations, 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.
Index ¶
- func GetFiberContext(c context.Context) *fiber.Ctx
- func GetUserData(c context.Context) interface{}deprecated
- func OapiRequestValidator(swagger *openapi3.T) fiber.Handler
- func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) fiber.Handler
- func OapiValidatorFromYamlFile(path string) (fiber.Handler, error)
- func ValidateRequestFromContext(c *fiber.Ctx, router routers.Router, options *Options) error
- type ErrorHandler
- type MultiErrorHandler
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFiberContext ¶
GetFiberContext gets the fiber context from within requests. It returns nil if not found or wrong type. Deprecated: This has been replaced by github.com/oapi-codegen/fiber-middleware#GetFiberContext
func GetUserData
deprecated
func OapiRequestValidator ¶
OapiRequestValidator is a fiber 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 with error message Deprecated: This has been replaced by github.com/oapi-codegen/fiber-middleware#OapiRequestValidator
func OapiRequestValidatorWithOptions ¶
OapiRequestValidatorWithOptions creates a validator from a swagger object, with validation options Deprecated: This has been replaced by github.com/oapi-codegen/fiber-middleware#OapiRequestValidatorWithOptions
func OapiValidatorFromYamlFile ¶
OapiValidatorFromYamlFile creates a validator middleware from a YAML file path Deprecated: This has been replaced by github.com/oapi-codegen/fiber-middleware#OapiValidatorFromYamlFile
func ValidateRequestFromContext ¶
ValidateRequestFromContext is called from the middleware above and actually does the work of validating a request. Deprecated: This has been replaced by github.com/oapi-codegen/fiber-middleware#
Types ¶
type ErrorHandler ¶
ErrorHandler is called when there is an error in validation Deprecated: This has been replaced by github.com/oapi-codegen/fiber-middleware#ErrorHandler
type MultiErrorHandler ¶
type MultiErrorHandler func(openapi3.MultiError) error
MultiErrorHandler is called when oapi returns a MultiError type Deprecated: This has been replaced by github.com/oapi-codegen/fiber-middleware#MultiErrorHandler
type Options ¶
type Options struct { Options openapi3filter.Options ErrorHandler ErrorHandler ParamDecoder openapi3filter.ContentParameterDecoder UserData interface{} MultiErrorHandler MultiErrorHandler }
Options to customize request validation. These are passed through to openapi3filter. Deprecated: This has been replaced by github.com/oapi-codegen/fiber-middleware#Options