# `ToonEx.Btoon.Decode.Options`
[🔗](https://github.com/ohhi-vn/toon_ex/blob/v1.6.0/lib/toon_ex/btoon/decode/options.ex#L1)

Validation and normalization of BTOON decoding options.

## Options

  * `:dictionary` - a `Btoon.Dictionary` session dictionary shared with the
    encoder. `StringRef` ids are resolved against the session entries first,
    then the per-message string table carried in the envelope.
  * `:schema` - a `Btoon.Schema` used to decode a tagless schema body when
    the envelope does not carry the schema flag (schema negotiated out of
    band). When the schema flag is set, the embedded schema always wins.
  * `:keys` - how object keys are returned: `:strings` (default),
    `:atoms` (uses `String.to_atom/1`) or `:atoms!` (uses
    `String.to_existing_atom/1`).
  * `:typed_arrays` - `:lists` (default) materializes `TypedArray` and
    `ObjectTable` payloads as lists; `:views` returns the wrapper structs
    holding zero-copy sub-binary slices.
  * `:max_depth` - maximum nesting depth for tagged values (default `100`).
  * `:max_string_size` - maximum inline string size in bytes (default `1_048_576`).
  * `:max_binary_size` - maximum binary size in bytes (default `16_777_216`).
  * `:max_container_count` - maximum array/object/table count (default `1_000_000`).

# `validated`

```elixir
@type validated() :: %{
  dictionary: ToonEx.Btoon.Dictionary.t() | nil,
  schema: ToonEx.Btoon.Schema.t() | nil,
  keys: :strings | :atoms | :atoms!,
  typed_arrays: :lists | :views,
  max_depth: pos_integer(),
  max_string_size: pos_integer(),
  max_binary_size: pos_integer(),
  max_container_count: pos_integer()
}
```

Validated decoding options.

# `decode_validated`

```elixir
@spec decode_validated(binary(), validated()) ::
  {:ok, term()} | {:error, ToonEx.Btoon.DecodeError.t()}
```

Decodes a BTOON binary using pre-validated options.

This avoids re-validating options on each call, improving performance for
repeated decoding with the same options.

# `decode_validated!`

```elixir
@spec decode_validated!(binary(), validated()) :: term()
```

Decodes a BTOON binary using pre-validated options, raising on error.

This avoids re-validating options on each call, improving performance for
repeated decoding with the same options.

# `defaults`

```elixir
@spec defaults() :: validated()
```

Returns the default validated options.

# `validate`

```elixir
@spec validate(keyword()) :: {:ok, validated()} | {:error, String.t()}
```

Validates decoding options.

Returns `{:ok, validated}` or `{:error, message}`.

# `validate!`

```elixir
@spec validate!(keyword()) :: validated()
```

Validates decoding options, raising `ArgumentError` on error.

---

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