server

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OapiRequestValidator

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

OapiRequestValidator creates a validator from a swagger object.

func OapiRequestValidatorWithOptions

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

OapiRequestValidatorWithOptions creates a validator from a swagger object, with validation options.

func UnicodePrintableCharsChecker

func UnicodePrintableCharsChecker(next echo.HandlerFunc) echo.HandlerFunc

UnicodePrintableCharsChecker checks if the request body contains just unicode characters and returns error if it finds any non unicode characters.

func UnicodePrintableCharsCheckerMiddleware

func UnicodePrintableCharsCheckerMiddleware() echo.MiddlewareFunc

func ValidateQuery

func ValidateQuery(values url.Values, query interface{}) error

ValidateQuery performs the validation of an expected set of fields contained in a query struct against the provided query parameters of an HTTP request. If the query expects values and those match the provided values, the validation returns nil, otherwise it resturns an error. It uses ToMapKeys function to get the names of the fields of a query struct, and then uses QueryChecker to validate those fields against the provided query values.

func ValidateRequestFromContext

func ValidateRequestFromContext(ctx echo.Context, router routers.Router, options *Options) *echo.HTTPError

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

Types

type Echokeys

type Echokeys string
const (
	EchoContextKey Echokeys = "oapi-codegen/echo-context"
	UserDataKey    Echokeys = "oapi-codegen/user-data"
)

type ErrorHandler

type ErrorHandler func(c echo.Context, err *echo.HTTPError) error

ErrorHandler is called when there is an error in validation.

type Manager

type Manager struct {
	Ready chan bool
	Term  chan bool
	// contains filtered or unexported fields
}

func NewManager

func NewManager(
	cfg *common.GlobalConfig,
	jobCh chan types.Job,
	ready, termChan chan bool,
	wg *sync.WaitGroup,
) (*Manager, error)

func (*Manager) Start

func (m *Manager) Start() error

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context) error

type MultiErrorHandler

type MultiErrorHandler func(openapi3.MultiError) *echo.HTTPError

MultiErrorHandler is called when oapi returns a MultiError type.

type Options

type Options struct {
	ErrorHandler          ErrorHandler
	Options               openapi3filter.Options
	ParamDecoder          openapi3filter.ContentParameterDecoder
	UserData              interface{}
	Skipper               echomiddleware.Skipper
	MultiErrorHandler     MultiErrorHandler
	SilenceServersWarning bool
}

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

type RESTHandlers

type RESTHandlers interface {
	api.ServerInterface
	DispatchAndWait(job *types.Job) types.Response
}

func NewHandlers

func NewHandlers(jobCh chan types.Job, timeout time.Duration) (RESTHandlers, error)

Jump to

Keyboard shortcuts

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