Back to

Package middleware

Latest Go to latest

The latest major version is .

Published: Feb 25, 2020 | License: Apache-2.0 | Module:



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

func GetEchoContext

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

func GetUserData(c context.Context) interface{}

func OapiRequestValidator

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

Create a validator from a swagger object.

func OapiRequestValidatorWithOptions

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.

type Options

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

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier