# `LlmCore.Structured.Validator`
[🔗](https://github.com/fosferon/llm_core/blob/v0.3.0/lib/llm_core/structured/validator.ex#L1)

Normalizes schema declarations and validates decoded structured data.

The validator intentionally supports a small but extensible surface:

  * Function schemas – a single-arity validator function
  * Module schemas – modules that export `validate/1`, `cast/1`, `from_map/1`,
    or `changeset/2`
  * Map schemas – `%{required: [...], optional: [...]}` helpers or maps that
    enumerate fields
  * List schemas – treated as a list of required keys

When no schema is provided, the decoded value is returned verbatim.

# `result`

```elixir
@type result() :: {:ok, term()} | {:error, term()}
```

# `schema`

```elixir
@type schema() :: module() | map() | [atom() | String.t()] | (map() -&gt; result()) | nil
```

# `validate`

```elixir
@spec validate(term(), schema(), keyword()) :: result()
```

Validates the decoded payload against the supplied schema.

---

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