# `CommBus.Template.Validator`
[🔗](https://github.com/fosferon/comm_bus/blob/v0.1.0/{path}#L{line})

Validates prompt frontmatter and variable consistency.

# `error_list`
[🔗](https://github.com/fosferon/comm_bus/blob/v0.1.0/{path}#L{line})

```elixir
@type error_list() :: [CommBus.Template.ValidationError.t()]
```

# `validate_prompt`
[🔗](https://github.com/fosferon/comm_bus/blob/v0.1.0/{path}#L{line})

```elixir
@spec validate_prompt(map(), String.t(), String.t() | nil, keyword()) ::
  {:ok, :prompt} | {:error, error_list()}
```

Validates prompt frontmatter against the expected schema, checking required
fields, variable declarations, and optionally variable consistency between
declarations and template usage.

## Parameters

  - `frontmatter` — Parsed YAML frontmatter as a map.
  - `body` — The template body string.
  - `path` — Optional file path for error context.
  - `opts` — Keyword options:
    - `:schema` — Validation schema (`:devman`, `:human`, `:flex`).
    - `:validate_variables` — Whether to check declaration/usage consistency.

## Returns

`{:ok, :prompt}` if valid, or `{:error, [%ValidationError{}]}` with all errors.

# `validate_prompt_struct`
[🔗](https://github.com/fosferon/comm_bus/blob/v0.1.0/{path}#L{line})

```elixir
@spec validate_prompt_struct(CommBus.Template.Prompt.t(), map(), keyword()) ::
  {:ok, CommBus.Template.ValidationResult.t()}
  | {:error, CommBus.Template.RenderError.t()}
```

Validates a `%Prompt{}` struct by attempting a strict-mode render with the
provided variables, verifying that the template can be fully rendered.

## Parameters

  - `prompt` — A `%CommBus.Template.Prompt{}` struct.
  - `variables` — A map of variable bindings to test with.
  - `opts` — Keyword options forwarded to the template engine.

## Returns

`{:ok, %ValidationResult{}}` with required variables and partials, or
`{:error, %RenderError{}}` if the render fails.

---

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