# `Snodo.Schema.Validator`
[🔗](https://github.com/joshrotenberg/snodo/blob/v0.4.1/lib/snodo/schema/validator.ex#L1)

Pluggable JSON Schema validation boundary.

Validators receive the untouched schema map registered by the application.
Returning `{:error, reason}` marks an instance invalid; validators must not
mutate either the instance or schema.

`Snodo.Schema.Validator.Basic` is the dependency-free common-subset
implementation. `Snodo.Schema.Validator.Passthrough` remains the runtime
default so selecting validation is an explicit application policy.

Validators may implement `compile/1` and `validate_compiled/2`. A server
runtime prepares its registered tool schemas once and retains the compiled
results for that runtime's lifetime. Build errors are returned at validation
time as server errors, as they are for a validator that only implements
`validate/2`. The error reason may be any term and is kept in the server's
internal error cause, not sent to the client.

# `compile`
*optional* 

```elixir
@callback compile(schema :: map()) :: {:ok, term()} | {:error, term()}
```

# `validate`

```elixir
@callback validate(instance :: term(), schema :: map()) :: :ok | {:error, term()}
```

# `validate_compiled`
*optional* 

```elixir
@callback validate_compiled(instance :: term(), compiled :: term()) ::
  :ok | {:error, term()}
```

---

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