# `Alternera.Resource.Verifiers`
[🔗](https://github.com/10e-ab/alternera-sdk/blob/v0.9.0/alternera_resource_sdk/lib/alternera/resource/verifiers.ex#L1)

The contract a resource of a resource package must keep, one module per
rule (`data-model.md` § Validation rules):

1. `Multitenancy`: attribute multitenancy on `tenant_id`, not global.
2. `DataLayer`: AshPostgres on `Alternera.Resource.Repo`, in the
   package's schema `resources_<package id>`.
3. `Policies`: the policy prefix comes first.
4. `LookupKey`: a lookup key is unique per tenant through an identity on it alone.
5. `Expose`: every exposed route and action exists, with the right type.
6. `ListFields`: the list fields are public attributes.
7. `PaperTrail`: the paper trail is on, in snapshot mode, with versions on destroy.
8. `Cache`: `cache` is `false`, `true` or `[ttl_ms: n]` with n > 0.
9. `TenantReferences`: every `belongs_to` is matched on `tenant_id`.
10. `UI`: the `ui` section names public attributes, unique ids and Ash
    actions that fit what each action acts on.

`Alternera.Resource.Transformers.Verify` runs them at compile time;
`problems/1` runs them on a compiled resource, for the contract test kit.

# `identity`

```elixir
@spec identity(module() | map()) :: map() | nil
```

What `use Alternera.Resource` recorded about the resource
(`%{package_id, resource_id, table, schema}`), or `nil` for a resource that
adds the extension without it.

# `problems`

```elixir
@spec problems(module() | map()) :: [{module(), String.t()}]
```

The rules a resource breaks, as `{rule, message}`, for a compiled module or
a DSL state during compilation. Empty when it keeps the contract.

# `rules`

```elixir
@spec rules() :: [module()]
```

The rule modules, in order.

---

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