# `FeaturevisorSchemas.Refinement`
[🔗](https://github.com/featurevisor/featurevisor-elixir/blob/v2.1.0/lib/featurevisor_schemas/structs.ex#L140)

A check in code that rules cannot express, such as whether a username is
taken. `check` gets the value at `path` and a `FeaturevisorSchemas.CheckInfo`,
and returns true when the value passes, false when it does not, or
`{:error, reason}` when it cannot tell. It runs after the rules, and only
where they found no issue at or inside its path, nor in a field it `reads`.
A check that errors, raises or exits reports `refineError`.

    %FeaturevisorSchemas.Refinement{
      key: "passwordsMatch",
      path: "confirm",
      reads: ["password"],
      message: "Passwords must match",
      check: fn value, info -> value == FeaturevisorSchemas.CheckInfo.read(info, "password") end
    }

# `t`

```elixir
@type t() :: %FeaturevisorSchemas.Refinement{
  check: (term(), FeaturevisorSchemas.CheckInfo.t() -&gt;
            boolean() | {:error, term()}),
  key: String.t(),
  message: String.t() | nil,
  path: String.t(),
  reads: [String.t()]
}
```

---

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