Documentation ¶
Overview ¶
Package glue contains miscellaneous utilities for the OpenAPI bindings layer. This includes functions such as error handling, error mapping and validation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPErrorHandler ¶
HTTPErrorHandler provides an error handler function for use with the Echo router. The purpose of this implementation is to map application level errors to HTTP status codes. This is achieved (currently) with the use of a library called errtag which enables the decoration of error chains with a basic kind of category which helps organise the kind of errors that occur within an app.
func ParameterContext ¶
func ParameterContext(next echo.HandlerFunc) echo.HandlerFunc
ParameterContext is a simple middleware for injecting request metadata into a context object for use with the errctx library. This makes diagnostics easy.
func ValidatorErrorHandler ¶
func ValidatorErrorHandler() func(c echo.Context, err *echo.HTTPError) error
ValidatorErrorHandler is an OpenAPI validator function for structured errors. This is used with `OapiRequestValidatorWithOptions` in order to handle errors that occur at the request validation level before the request reaches the app layer. Validation failures happen due to security schemes not being satisfied or requests not satisfying the specification. The purpose of this function is to process the various types of error that can occur and turn the errors into structured errors which can be serialised properly with `errctx` for logging.
Types ¶
This section is empty.