Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithManualConfig ¶ added in v0.3.0
func WithManualConfig(cfg ManualConfig) echo.MiddlewareFunc
WithManualConfig returns an echo.MiddlewareFunc for the echo server cfg is the ManualConfig of the middleware
func WithOpenApiConfig ¶ added in v0.3.0
func WithOpenApiConfig(cfg OApiConfig) echo.MiddlewareFunc
Types ¶
type ManualConfig ¶ added in v0.3.0
type ManualConfig struct { BasePath string PathMapping PathItems DefaultValidation ValidationFunc }
ManualConfig is the middleware configuration. BasePath a baseURL to apply to each PathItem to simplify and cleanup mappings PathMapping contains a list of validation functions, grouped by path and method. DefaultValidation is the default validation action taken if no mapping is matched
type OApiConfig ¶ added in v0.3.0
type OApiConfig struct {
// contains filtered or unexported fields
}
func NewOApiConfig ¶ added in v0.3.0
func NewOApiConfig(openapi []byte, validators map[string]OApiValidationFunc) (OApiConfig, error)
type OApiEchoSec ¶ added in v0.3.0
type OApiValidationFunc ¶ added in v0.3.0
type PathItem ¶
type PathItem struct { Methods ValidationMap Patterns Patterns PathValidation ValidationFunc }
PathItem is a validation item. Patterns is a list of URL patterns to which this validation PathItem responds to Methods is a list of mappings based on methods. This can be NIL. PathValidation is the default validation for this path, if all Methods validations did not find a match
func (PathItem) FindMethodValidator ¶
func (i PathItem) FindMethodValidator(method string) ValidationFunc
FindMethodValidator looks for a method validator that matches the provided method. It will return NIL if Methods is NIL or if no method matchers are found
type ValidationFunc ¶
type ValidationFunc func(c echo.Context) error
ValidationFunc is any function meant to validate access to a path or method
type ValidationMap ¶
type ValidationMap map[string]ValidationFunc
ValidationMap maps string keys to validation functions