# `FeaturevisorSchemas.Handle`
[🔗](https://github.com/featurevisor/featurevisor-elixir/blob/v2.1.0/lib/featurevisor_schemas/handle.ex#L1)

A schema's handle, or a field's. Everything it does reads the current
datafile when it is used, so one handle stays right for the life of an
application. A handle is a plain term, safe to keep and share.

# `t`

```elixir
@type t() :: %FeaturevisorSchemas.Handle{
  form: term(),
  key: term(),
  options: term(),
  path: term(),
  schemas: term(),
  steps: term(),
  view: term()
}
```

A handle. Read it through this module's functions, since its fields may change.

# `annotations`

```elixir
@spec annotations(t()) :: map()
```

Its annotations, over those of a schema its field references.

# `constraints`

```elixir
@spec constraints(t()) :: FeaturevisorSchemas.Constraints.t()
```

The HTML validation attributes its rules imply, with required from the object it sits in.

# `field`

```elixir
@spec field(t(), String.t()) :: t()
```

The handle for a field at a path, such as `address.city`, `items[].name` or `labels.*`.

# `field_constraints`

```elixir
@spec field_constraints(t()) :: %{
  required(String.t()) =&gt; FeaturevisorSchemas.Constraints.t()
}
```

An object's fields' constraints by dot path, such as `address.city`.

# `field_options`

```elixir
@spec field_options(t()) :: %{
  required(String.t()) =&gt; [FeaturevisorSchemas.Option.t()]
}
```

An object's fields' choices by dot path, for the fields that list some.

# `fields`

```elixir
@spec fields(t()) :: [t()]
```

An object's fields' handles, in its order, or none for any other value.

# `key`

```elixir
@spec key(t()) :: String.t()
```

The schema's key, such as `signUp`.

# `lookup`

```elixir
@spec lookup(t(), term(), keyword()) ::
  {:ok, FeaturevisorSchemas.Option.t()} | :error | {:error, term()}
```

The choice for a value: `{:ok, option}` from the schema's own choices or else
the field's option source, `:error` for none, or the source's `{:error, reason}`.

# `name`

```elixir
@spec name(t()) :: String.t()
```

Its own key in the object it sits in, such as `city`, or empty for the schema itself.

# `option`

```elixir
@spec option(t(), term()) :: FeaturevisorSchemas.Option.t() | nil
```

The schema's own choice for a value, or nil.

# `options`

```elixir
@spec options(t()) :: [FeaturevisorSchemas.Option.t()]
```

The choices the field allows, in the order its rules list them, empty when it lists none.

# `path`

```elixir
@spec path(t()) :: String.t()
```

The field's path in its schema, such as `address.city` or `items[].name`, or empty for the schema.

# `reads`

```elixir
@spec reads(t()) :: [String.t()]
```

The fields, relative to this handle, that its mutations' and issues' conditions read.

# `render_as`

```elixir
@spec render_as(t()) :: String.t() | nil
```

What the rules say the field renders as, such as `text`, `select` or `date-time`, or nil for a oneOf of shapes.

# `search`

```elixir
@spec search(t(), String.t(), keyword()) ::
  {:ok, [FeaturevisorSchemas.Option.t()]} | {:error, term()}
```

Suggestions from the field's option source for a query: `{:ok, options}`,
empty without a source that searches, or the source's `{:error, reason}`.

# `searchable?`

```elixir
@spec searchable?(t()) :: boolean()
```

Whether an option source suggests choices for this field.

# `subscribe`

```elixir
@spec subscribe(t(), (-&gt; any())) :: (-&gt; :ok)
```

Calls back when the datafile changes this handle's schema, until the returned function is called.

# `valid?`

```elixir
@spec valid?(t(), term(), keyword()) :: boolean()
```

Whether a value passes.

# `validate`

```elixir
@spec validate(t(), term(), keyword()) ::
  {:ok, term()} | {:error, [FeaturevisorSchemas.Issue.t()]}
```

Validates a value: `{:ok, value}` when it passes, or `{:error, issues}`. Maps
with string or atom keys, lists, primitives and structs are read as JSON has
them. Checks in code run in order, after the rules. A `:context` given is
merged over the instance's.

# `validate!`

```elixir
@spec validate!(t(), term(), keyword()) :: term()
```

The value when it passes, or raises `FeaturevisorSchemas.ValidationError` with the issues.

# `with_input`

```elixir
@spec with_input(t(), term(), keyword()) :: t()
```

The same handle with an input, such as the values a form has so far: its
members describe the rules with every mutation whose conditions match that
input, and the `:context`, applied at every depth.

---

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