Validate (Validate v1.3.1)

Validate, validate incoming requests in an easy to reason-about way.

Summary

Functions

Validates an input against a given list of rules

Functions

Link to this function

validate(input, rules)

Validates an input against a given list of rules

Examples

iex> {:ok, _data} = Validate.validate("Jane", required: true, type: :string)
iex> {:error, _errors} = Validate.validate([], required: true, type: :list)
iex> {:ok, _data} = Validate.validate(%{"name" => "Jane"}, %{"name" => [required: true, type: :string]})