# `OmniBuf.SchemaMeta`
[🔗](https://github.com/omnibuf/omnibuf-elixir/blob/v0.1.0/lib/omnibuf/schema_meta.ex#L1)

Field #0 (`Tag = 0x19`, `WireSubMsg = 12`) self-describing schema metadata.

Encodes optional `type_name`, `fields` (`map<uint32, string>`), and recursive
`children` (`map<uint32, SchemaMeta>`).

# `t`

```elixir
@type t() :: %OmniBuf.SchemaMeta{
  children: %{optional(non_neg_integer()) =&gt; t()},
  fields: %{optional(non_neg_integer()) =&gt; String.t()},
  type_name: String.t()
}
```

# `child_meta`

```elixir
@spec child_meta(t() | nil, non_neg_integer()) :: t() | nil
```

Returns the child `SchemaMeta` for `field_num`, or `nil`.

# `decode_body`

```elixir
@spec decode_body(binary(), non_neg_integer(), t()) ::
  {:ok, t()} | {:error, OmniBuf.Error.t()}
```

Decodes the inner field stream of a `SchemaMeta` message.

# `decode_field`

```elixir
@spec decode_field(binary(), non_neg_integer()) ::
  {:ok, t(), binary()} | {:error, OmniBuf.Error.t()}
```

Decodes a Field #0 `SchemaMeta` starting right after the `0x19` tag (i.e. at `ByteLen`).
Enforces container depth (+1 for the Field #0 `WireSubMsg`, +2 per `children` hop).

# `encode_body`

```elixir
@spec encode_body(t()) :: iodata()
```

Encodes the inner field stream of a `SchemaMeta` message (without outer tag or ByteLen).

# `encode_field`

```elixir
@spec encode_field(t()) :: iodata()
```

Encodes a `SchemaMeta` struct as a complete Field #0 `[0x19][ByteLen][body]` iodata fragment.

# `merge`

```elixir
@spec merge(t() | nil, t() | nil) :: t() | nil
```

Merges two `SchemaMeta` tables according to Spec Section 8.2:
- Later non-empty `type_name` wins.
- Later `fields` entries override per field number (an empty string `""` clears an inherited name).
- `children` maps merge recursively by field number.

# `resolve_field_name`

```elixir
@spec resolve_field_name(t() | nil, non_neg_integer()) :: String.t()
```

Resolves a field name from `meta`, falling back to `"field_<N>"` when absent or empty `""`.

---

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