View Source Request.Validator behaviour (RequestValidator v0.8.5)
Summary
Callbacks
Determine if the user is authorized to make this request.
Get the validation rules that apply to the request.
Types
@type validation_result() :: :ok | {:error, map()}
Callbacks
@callback authorize(Plug.Conn.t()) :: boolean()
Determine if the user is authorized to make this request.
def authorize(conn) do
user(conn).is_admin
end
@callback rules(Plug.Conn.t()) :: keyword() | Ecto.Changeset.t()
Get the validation rules that apply to the request.
Functions
@spec validate(module(), map() | keyword(), keyword()) :: validation_result()