jeaux v0.5.3 Jeaux

This is the main and only access point for the module.

Summary

Functions

Validates a map against a schema

Functions

validate(params, schema)

Validates a map against a schema.

returns {:ok, validated_params} or {:error, error_message}

for example:

params = %{"limit" => "2", "sort_by" => "name", "sort_dir" => "asc"}
schema = %{
  limit: [type: :integer, default: 10, min: 1, max: 100],
  offset: [type: :integer, default: 0, min: 0],
  sort_by: [type: :string, default: "created_at"],
  sort_dir: [type: :string, default: "asc"]
}

{:ok, valid_params} = Jeaux.validate(params, schema)