# `EctoContext.Validate`
[🔗](https://github.com/exfoundry/ecto_context/blob/v0.1.0/lib/ecto_context/validate.ex#L1)

Validation helpers used by the EEx templates in `priv/templates/ecto_context/`.

These functions are called at runtime from code generated by `EctoContext`.
They guard against invalid options and unknown associations before
queries hit the database.

# `validate_assoc!`

```elixir
@spec validate_assoc!(module(), atom()) :: :ok
```

Validates that `assoc_atom` is a known association or `_id` field on `module`.

Raises `ArgumentError` if neither a `belongs_to` association nor a
corresponding `_id` field exists on the schema.

# `validate_opts!`

```elixir
@spec validate_opts!(
  keyword(),
  [atom()]
) :: :ok
```

Validates that all keys in `opts` are in the `valid_keys` list.

Raises `ArgumentError` listing the unsupported keys if any are found.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
