# tmux_schema

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** module
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_schema.erl#L1
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_schema/

Validate schema-defined observations and normalize scalar values.

Field names come from the generated registry, never record reflection or
payload-created atoms. Text is validated UTF-8; byte fields preserve arbitrary
binaries. Integer normalization uses the shared exact JSON integer range.
`m:tmux_model` validates rows and `m:tmux_filter` validates criteria through
this schema. The [field reference](fields.md) lists fields and relationships.

## Members

### Common operations

- [`error_detail/0`](/en/erlang/latest/reference/t-tmux_schema-error_detail-0/) (typealias): Structured boundary validation errors with a code and input path.

### Other members

- [`entity/0`](/en/erlang/latest/reference/t-tmux_schema-entity-0/) (typealias): The built-in tmux graph entities; window_link represents a session membership.
- [`field_metadata/0`](/en/erlang/latest/reference/t-tmux_schema-field_metadata-0/) (typealias): Generated field contract. stable is a versioned portable identity; wire is the JSON key. required controls construction and nullable permits known absence. format is present only for directly observed tmux fields; derived fields omit it. capture_codec identifies an admitted batched source encoding; its absence selects isolated reads for that entity. minimum tightens an integer field's lower bound. Field names themselves are the keys returned by `fields/1`, not this map's wire or stable values.
- [`field/2`](/en/erlang/latest/reference/tmux_schema-field-2/) (function): Look up one permitted field by its Erlang atom name. Unknown names return a tagged error; this does not turn input strings into atoms.
- [`fields/1`](/en/erlang/latest/reference/tmux_schema-fields-1/) (function): Return generated field metadata for a known entity, or a tagged unknown_entity error. Field names, wire names and stable IDs are allowlisted; this is not reflection over arbitrary record fields.
- [`normalize/2`](/en/erlang/latest/reference/tmux_schema-normalize-2/) (function): Validate a domain-field map and normalize its scalar observations, retaining not_loaded/unavailable distinctly and deriving schema-defined values. Performs no I/O; constructors and action boundaries still validate records.
- [`operator/0`](/en/erlang/latest/reference/t-tmux_schema-operator-0/) (typealias): Validated scalar operators. The field's type and nullability restrict this set.
- [`operators/1`](/en/erlang/latest/reference/tmux_schema-operators-1/) (function): Return the permitted scalar operators for this field type and nullability. The generated field reference uses this same validator. Performs no I/O.
- [`relation_metadata/0`](/en/erlang/latest/reference/t-tmux_schema-relation_metadata-0/) (typealias): Generated relationship contract: kind is one or many; target names the related entity. wire and stable have the same roles as in `t:field_metadata/0`. Completeness belongs to snapshot coverage, not this static schema.
- [`relations/1`](/en/erlang/latest/reference/tmux_schema-relations-1/) (function): Return generated relationship metadata, including target entities and one/many cardinality. Performs no I/O.
- [`value_type/0`](/en/erlang/latest/reference/t-tmux_schema-value_type-0/) (typealias): Scalar categories used by normalization and operator validation; IDs remain binaries.
- [`value/2`](/en/erlang/latest/reference/tmux_schema-value-2/) (function): Validate and normalize one value against generated field metadata. Integral JSON numbers obey the exact shared integer range and field bounds; text is validated UTF-8, while bytes remain arbitrary binaries. Performs no I/O.

## Guides

Pages that discuss `tmux_schema`.

- [Native API documentation](/en/erlang/latest/guides/api-documentation/)
