middleware

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 9 Imported by: 106 modules, 106 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const EchoContextKey = "oapi-codegen/echo-context"
View Source
const UserDataKey = "oapi-codegen/user-data"

Variables

This section is empty.

Functions

func GetEchoContext added in v1.1.6

func GetEchoContext(c context.Context) echo.Context

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

func GetUserData added in v1.1.6

func GetUserData(c context.Context) interface{}

func OapiRequestValidator

func OapiRequestValidator(swagger *openapi3.Swagger) echo.MiddlewareFunc

Create a validator from a swagger object.

func OapiRequestValidatorWithOptions added in v1.1.6

func OapiRequestValidatorWithOptions(swagger *openapi3.Swagger, options *Options) echo.MiddlewareFunc

Create a validator from a swagger object, with validation options

func OapiValidatorFromYamlFile

func OapiValidatorFromYamlFile(path string) (echo.MiddlewareFunc, error)

Create validator middleware from a YAML file path

func ValidateRequestFromContext

func ValidateRequestFromContext(ctx echo.Context, router *openapi3filter.Router, options *Options) error

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

Types

type Options added in v1.1.6

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

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

Jump to

Keyboard shortcuts

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