View Source Request.Validator.Plug (RequestValidator v0.8.5)

Summary

Functions

Performs validations on conn.params If all validations are successful returns the connection struct Otherwise returns an error map in the following structure: %{param: ["some error", ...]} Will call the given on_error callback in case some validation failed

Init the Request.Validator.Plug with an optional error callback and handlers with their corresponding request validator module.

The default callback to be invoked when there is a param that fails validation.

Functions

Performs validations on conn.params If all validations are successful returns the connection struct Otherwise returns an error map in the following structure: %{param: ["some error", ...]} Will call the given on_error callback in case some validation failed

Init the Request.Validator.Plug with an optional error callback and handlers with their corresponding request validator module.

plug Request.Validator.Plug,
  register: App.Requests.RegisterRequest,
  on_error: fn conn, errors -> json_resp(conn, "Handle your errors: #{inspect errors}") end

The default callback to be invoked when there is a param that fails validation.