# `KiwiCodec.SchemaInterpreter`
[🔗](https://github.com/open-pencil/kiwi_codec/blob/v0.7.0/lib/kiwi_codec/schema_interpreter.ex#L1)

Interpreter for parsed Kiwi schemas without generated modules.

Prefer generated modules for application code. This interpreter is useful for
tooling, inspection, and compatibility tests where schemas are loaded at runtime.
For repeated calls, prepare the parsed schema once with `prepare/1` to replace
linear definition, message-field, and enum lookups with indexed lookups.

# `schema`

```elixir
@type schema() :: KiwiCodec.Schema.t() | KiwiCodec.SchemaInterpreter.Prepared.t()
```

# `decode`

```elixir
@spec decode(schema(), String.t(), binary()) :: map() | String.t() | integer()
```

# `encode`

```elixir
@spec encode(schema(), String.t(), map()) :: binary()
```

# `prepare`

```elixir
@spec prepare(KiwiCodec.Schema.t()) :: KiwiCodec.SchemaInterpreter.Prepared.t()
```

Builds reusable lookup indexes for repeated runtime interpretation.

# `skip_message_field`

```elixir
@spec skip_message_field(schema(), String.t(), non_neg_integer(), binary()) ::
  binary()
```

Skips the value of message field `field_id` of `definition_name` at the start
of `binary`, returning the bytes after it.

Used to step over fields a compiled decoder does not know, with the schema
the data was written with.

---

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