validation

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecorateWithBody

func DecorateWithBody[T any](h func(c *fiber.Ctx, body *T) error) fiber.Handler

DecorateWithBody decorates a handler with the validated request.

func DecorateWithBodyEx

func DecorateWithBodyEx[T any](validate *validator.Validate, h func(c *fiber.Ctx, body *T) error) fiber.Handler

DecorateWithBodyEx decorates a handler with the validated request.

func GetValidatedBody

func GetValidatedBody[T any](c *fiber.Ctx) (*T, bool)

GetValidatedBody retrieves the validated request from the context.

func Middleware

func Middleware(c *fiber.Ctx) error

func NewBody

func NewBody[T any](validate *validator.Validate) fiber.Handler

NewBody validates the request body and stores the validated request in the context.

func NewErrors

func NewErrors(err error) error

NewErrors converts validator errors to ValidationErrors.

func ValidateBody

func ValidateBody[T any](c *fiber.Ctx, validate *validator.Validate) (*T, error)

ValidateBody validates the request body.

Types

type Error

type Error struct {
	Field   string `json:"field"`
	Tag     string `json:"tag"`
	Value   string `json:"value,omitempty"`
	Message string `json:"message"`
}

Error represents a validation error with field details.

type Errors

type Errors []Error

Errors represents multiple validation errors.

func (Errors) Error

func (ve Errors) Error() string

Jump to

Keyboard shortcuts

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