# `Exdantic.Validator`
[🔗](https://github.com/nshkrdotcom/exdantic/blob/v0.1.0/lib/exdantic/validator.ex#L1)

Validates values against type definitions and schemas.

This module provides the core validation logic for Exdantic schemas,
handling field validation, constraints, and error reporting.

# `validation_path`

```elixir
@type validation_path() :: [atom() | String.t() | integer()]
```

# `validation_result`

```elixir
@type validation_result() ::
  {:ok, term()} | {:error, Exdantic.Error.t() | [Exdantic.Error.t()]}
```

# `validate`

```elixir
@spec validate(Exdantic.Types.type_definition() | module(), term()) ::
  validation_result()
```

# `validate`

```elixir
@spec validate(Exdantic.Types.type_definition() | module(), term(), validation_path()) ::
  validation_result()
```

Validates a value against a type definition.

## Parameters
  * `type` - The type definition or schema module to validate against
  * `value` - The value to validate
  * `path` - Current validation path for error messages (defaults to `[]`)

## Returns
  * `{:ok, validated_value}` on success
  * `{:error, errors}` on validation failures

## Examples

    iex> Exdantic.Validator.validate({:type, :string, []}, "hello")
    {:ok, "hello"}

    iex> Exdantic.Validator.validate({:type, :integer, []}, "not a number")
    {:error, %Exdantic.Error{...}}

# `validate_schema`

```elixir
@spec validate_schema(module(), map(), validation_path()) :: validation_result()
```

Validates data against a schema module, checking for required fields,
field-level validations, and strict mode constraints if enabled.

## Parameters
  * `schema` - Schema module to validate against
  * `data` - Data to validate (map)
  * `path` - Current validation path for error messages (defaults to `[]`)

## Returns
  * `{:ok, validated_data}` on success
  * `{:error, errors}` on validation failures

## Examples

    iex> defmodule TestSchema do
    ...>   use Exdantic
    ...>   schema do
    ...>     field :name, :string
    ...>   end
    ...> end
    iex> Exdantic.Validator.validate_schema(TestSchema, %{name: "John"})
    {:ok, %{name: "John"}}

---

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