Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseAndValidate ¶
func ParseAndValidate(fiberCtx *fiber.Ctx, s interface{}) error
ParseAndValidate is a wrapper function for ParseBody and customvalidator.ValidateJSON
func ParseBody ¶
func ParseBody(fiberCtx *fiber.Ctx, s interface{}) error
ParseBody parses a pointer to a struct with fiber's body parse.
It returns custom errors that are not present in the fiber implementation.
func RegisterErrorHandler ¶
RegisterErrorHandler registers a new Fiber Error Handler. It needs to be used with the Panic MW
It overrides the REST error response when the application has an unexpected error (to avoid information disclosure to the client).
That's why it needs to be used when the panic MW is active to avoid information disclosure to the client.
Instead, it redirects the client to home.
(More info on: https://docs.gofiber.io/api/middleware/recover and https://docs.gofiber.io/guide/error-handling)
func ValidateJSON ¶
func ValidateJSON(s interface{}) []error
ValidateJSON accepts a struct and validates it according to its model's tags. It returns a slice of errors.
When iterating there's no need to check if errors are nil, because it doesn't return empty errors.
Types ¶
This section is empty.