# `Macaw.Frame.Document.Schema.Spec`
[🔗](https://github.com/dcoai/macaw_frame/blob/v0.1.0/lib/macaw/frame/document/schema/spec.ex#L1)

The key spec builder the schema's tables are written with (spec/02 §1.2–§1.5).

`Macaw.Frame.Document.Schema.Design`, `.Frame` and `.Layer` write their tables with
`spec/4`; `Macaw.Frame.Document.Schema` reads them once, at compile time, so none of
them may depend on the schema module itself. A key spec is a map: the key, its type
(§1.4), its facet (§1.3), its default, whether it is required, and its merge rule (§1.5).

    iex> Macaw.Frame.Document.Schema.Spec.spec(:gap, :number, :geometry, default: 0)
    %{key: :gap, type: :number, facet: :geometry, default: 0, required: false, merge: :override, range: nil}

# `t`

```elixir
@type t() :: %{
  key: atom() | String.t(),
  type: atom() | tuple(),
  facet: :binding | :channel | :geometry | :style | :content,
  default: term(),
  required: boolean(),
  merge: :concat | :union | :deep | :override | {:type, :style},
  range: {number(), number(), number()} | nil
}
```

One key of a node kind.

# `enum_members`

```elixir
@spec enum_members(atom() | tuple()) :: [atom()]
```

Every member of every enumeration inside a type, nested types included.

# `spec`

```elixir
@spec spec(atom() | String.t(), atom() | tuple(), atom(), keyword()) :: t()
```

A key spec; `default:`, `required:` and `merge:` (`:override` when not given).

# `style_entry`

```elixir
@spec style_entry() :: tuple()
```

The type a `styles` entry takes (§2.6): a style node, a reference to another style, or a
list of references and nodes stacked left to right. A field or generator entry is a
site's alone.

# `style_stack`

```elixir
@spec style_stack() :: tuple()
```

The type a style site takes (§3.6): a reference, an inline node, a field binding whose
value per datum names a style, a generator call whose result is a style, or a list of
those, laid left to right.

    iex> {:one_of, alternatives} = Macaw.Frame.Document.Schema.Spec.style_stack()
    iex> {:ref, :style} in alternatives
    true

---

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