middleware

package
v1.9.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultSkipper

func DefaultSkipper(*fiber.Ctx) bool

DefaultSkipper returns false which processes the middleware.

func GetFiberContext

func GetFiberContext(c context.Context) *fiber.Ctx

Helper function to get the fiber context from within requests. It returns nil if not found or wrong type.

func GetUserData

func GetUserData(c context.Context) interface{}

func OapiRequestValidator

func OapiRequestValidator(swagger *openapi3.T) fiber.Handler

Create a validator from a swagger object.

func OapiRequestValidatorWithOptions

func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) fiber.Handler

Create a validator from a swagger object, with validation options

func OapiValidatorFromYamlFile

func OapiValidatorFromYamlFile(path string) (fiber.Handler, error)

Create validator middleware from a YAML file path

func ValidateRequestFromContext

func ValidateRequestFromContext(ctx *fiber.Ctx, router routers.Router, options *Options) error

ValidateRequestFromContext is called from the middleware above and actually does the work of validating a request.

Types

type Options

type Options struct {
	Options      openapi3filter.Options
	ParamDecoder openapi3filter.ContentParameterDecoder
	UserData     interface{}
	Skipper      Skipper
}

Options to customize request validation. These are passed through to openapi3filter.

type Skipper

type Skipper func(*fiber.Ctx) bool

Skipper defines a function to skip middleware. Returning true skips processing the middleware.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL