# `A2UICore.Validation.Config`
[🔗](https://github.com/a2ui-elixir/a2ui/blob/v0.1.1/umbrella/apps/a2ui_core/lib/a2ui_core/validation/config.ex#L1)

Options controlling how strictly a component graph and its payloads
are validated — the reference `ValidationConfig`.

`strict/0` (the default) requires a `root` component, forbids
dangling references and unreachable components, and rejects unknown
elements. `relaxed/0` allows all of those, for streaming or partially
delivered surfaces.

  * `:root_id` — the entry component, `"root"` by default.
  * `:allow_orphan_components` — components not reachable from the
    root are not an error.
  * `:allow_dangling_references` — references to ids that do not exist
    are not an error.
  * `:allow_missing_root` — a surface without its root component is
    not an error (every component is then a traversal start).
  * `:allow_unknown_elements` — unknown component properties are
    tolerated by schema validation.
  * `:allowed_messages` — when set, only these message action keys are
    accepted.
  * `:max_depth` — logical component-tree depth limit; `nil` means the
    global limit (50).

# `t`
*since 0.1.0* 

```elixir
@type t() :: %A2UICore.Validation.Config{
  allow_dangling_references: boolean(),
  allow_missing_root: boolean(),
  allow_orphan_components: boolean(),
  allow_unknown_elements: boolean(),
  allowed_messages: [String.t()] | nil,
  max_depth: pos_integer() | nil,
  root_id: String.t()
}
```

# `new`
*since 0.1.0* 

```elixir
@spec new(keyword()) :: t()
```

Builds a config from `options`, starting from the strict preset.

    iex> A2UICore.Validation.Config.new(root_id: "main").root_id
    "main"

# `relaxed`
*since 0.1.0* 

```elixir
@spec relaxed() :: t()
```

The relaxed preset (orphans, dangling references, a missing root and
unknown elements are all tolerated).

    iex> A2UICore.Validation.Config.relaxed().allow_missing_root
    true

# `strict`
*since 0.1.0* 

```elixir
@spec strict() :: t()
```

The strict preset (every check on).

    iex> A2UICore.Validation.Config.strict().allow_orphan_components
    false

---

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