Versions in this module Expand all Collapse all v0 v0.122.0 Dec 18, 2023 Changes in this version type Options + ExcludeRequestQueryParams bool v0.120.0 Nov 27, 2023 Changes in this version + const ErrCodeCannotFindRoute + const ErrCodeOK + const ErrCodeRequestInvalid + const ErrCodeResponseInvalid + var ErrAuthenticationServiceMissing = errors.New("missing AuthenticationFunc") + var ErrInvalidEmptyValue = errors.New("empty value is not allowed") + var ErrInvalidRequired = errors.New("value is required but missing") + var JSONPrefixes = []string + func ConvertErrors(err error) error + func DefaultErrorEncoder(_ context.Context, err error, w http.ResponseWriter) + func FileBodyDecoder(body io.Reader, header http.Header, schema *openapi3.SchemaRef, ...) (interface{}, error) + func NoopAuthenticationFunc(context.Context, *AuthenticationInput) error + func RegisterBodyDecoder(contentType string, decoder BodyDecoder) + func RegisterBodyEncoder(contentType string, encoder BodyEncoder) + func TrimJSONPrefix(data []byte) []byte + func UnregisterBodyDecoder(contentType string) + func UnregisterBodyEncoder(contentType string) + func ValidateParameter(ctx context.Context, input *RequestValidationInput, ...) error + func ValidateRequest(ctx context.Context, input *RequestValidationInput) (err error) + func ValidateRequestBody(ctx context.Context, input *RequestValidationInput, ...) error + func ValidateResponse(ctx context.Context, input *ResponseValidationInput) error + func ValidateSecurityRequirements(ctx context.Context, input *RequestValidationInput, ...) error + type AuthenticationFunc func(context.Context, *AuthenticationInput) error + type AuthenticationInput struct + RequestValidationInput *RequestValidationInput + Scopes []string + SecurityScheme *openapi3.SecurityScheme + SecuritySchemeName string + func (input *AuthenticationInput) NewError(err error) error + type BodyDecoder func(io.Reader, http.Header, *openapi3.SchemaRef, EncodingFn) (interface{}, error) + func RegisteredBodyDecoder(contentType string) BodyDecoder + type BodyEncoder func(body interface{}) ([]byte, error) + func RegisteredBodyEncoder(contentType string) BodyEncoder + type ContentParameterDecoder func(param *openapi3.Parameter, values []string) (interface{}, *openapi3.Schema, error) + type CustomSchemaErrorFunc func(err *openapi3.SchemaError) string + type EncodingFn func(partName string) *openapi3.Encoding + type ErrCode int + type ErrFunc func(w http.ResponseWriter, status int, code ErrCode, err error) + type ErrorEncoder func(ctx context.Context, err error, w http.ResponseWriter) + type Headerer interface + Headers func() http.Header + type LogFunc func(message string, err error) + type Options struct + AuthenticationFunc AuthenticationFunc + ExcludeReadOnlyValidations bool + ExcludeRequestBody bool + ExcludeResponseBody bool + ExcludeWriteOnlyValidations bool + IncludeResponseStatus bool + MultiError bool + SkipSettingDefaults bool + func (o *Options) WithCustomSchemaErrorFunc(f CustomSchemaErrorFunc) + type ParseError struct + Cause error + Kind ParseErrorKind + Reason string + Value interface{} + func (e *ParseError) Error() string + func (e *ParseError) Path() []interface{} + func (e *ParseError) RootCause() error + func (e ParseError) Unwrap() error + type ParseErrorKind int + const KindInvalidFormat + const KindOther + const KindUnsupportedFormat + type RequestError struct + Err error + Input *RequestValidationInput + Parameter *openapi3.Parameter + Reason string + RequestBody *openapi3.RequestBody + func (err *RequestError) Error() string + func (err RequestError) Unwrap() error + type RequestValidationInput struct + Options *Options + ParamDecoder ContentParameterDecoder + PathParams map[string]string + QueryParams url.Values + Request *http.Request + Route *routers.Route + func (input *RequestValidationInput) GetQueryParams() url.Values + type ResponseError struct + Err error + Input *ResponseValidationInput + Reason string + func (err *ResponseError) Error() string + func (err ResponseError) Unwrap() error + type ResponseValidationInput struct + Body io.ReadCloser + Header http.Header + Options *Options + RequestValidationInput *RequestValidationInput + Status int + func (input *ResponseValidationInput) SetBodyBytes(value []byte) *ResponseValidationInput + type SecurityRequirementsError struct + Errors []error + SecurityRequirements openapi3.SecurityRequirements + func (err *SecurityRequirementsError) Error() string + type StatusCoder interface + StatusCode func() int + type ValidationError struct + Code string + Detail string + Id string + Source *ValidationErrorSource + Status int + Title string + func (e *ValidationError) Error() string + func (e *ValidationError) StatusCode() int + type ValidationErrorEncoder struct + Encoder ErrorEncoder + func (enc *ValidationErrorEncoder) Encode(ctx context.Context, err error, w http.ResponseWriter) + type ValidationErrorSource struct + Parameter string + Pointer string + type ValidationHandler struct + AuthenticationFunc AuthenticationFunc + ErrorEncoder ErrorEncoder + File string + Handler http.Handler + func (h *ValidationHandler) Load() error + func (h *ValidationHandler) Middleware(next http.Handler) http.Handler + func (h *ValidationHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Validator struct + func NewValidator(router routers.Router, options ...ValidatorOption) *Validator + func (v *Validator) Middleware(h http.Handler) http.Handler + type ValidatorOption func(*Validator) + func OnErr(f ErrFunc) ValidatorOption + func OnLog(f LogFunc) ValidatorOption + func Strict(strict bool) ValidatorOption + func ValidationOptions(options Options) ValidatorOption