Validate v1.2.1 Validate

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

Link to this section Summary

Functions

Validates an input against a given list of rules

Link to this section 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]})