openmixer — generated API reference
    Preparing search index...

    Interface FieldCodec<V>

    A field decoder. examples is mandatory — the vectors are the row's own test fixtures, run by the conformance laws against every declaration that uses the codec.

    interface FieldCodec<V> {
        examples: { invalid: readonly unknown[]; valid: readonly unknown[] };
        limit?: ControlLimit;
        values?: readonly (string | number)[];
        decode(raw: unknown): Decoded<V>;
    }

    Type Parameters

    • V

    Hierarchy (View Summary)

    Index
    examples: { invalid: readonly unknown[]; valid: readonly unknown[] }
    limit?: ControlLimit

    The travel this codec ENFORCES, for a numeric field — the same bounds decode clamps or refuses against, published so OPTIONS can answer them.

    Declared here rather than beside each field because the codec is where the numbers already are: a row that repeated them would be a second spelling of one fact, free to drift from the clamp that actually applies. Absent on codecs with no numeric travel (a bool, a text, an enum) and on the ones whose legal span is per-instance — a device travel is the other cardinality and comes from the field's own limit.

    values?: readonly (string | number)[]

    The closed VOCABULARY this codec enforces, for a field whose legal values are a discrete set rather than a span — published so OPTIONS can answer them, exactly as limit is.

    A travel and a vocabulary are the same question asked of two shapes of field: what may this hold. A span answers with min/max/step; a set answers by listing. Both belong to the CODEC, because the codec is what refuses — a row that restated either would be a second spelling free to drift from the check that actually applies.

    Absent on codecs whose domain is not enumerable (a number, a free token, a bool — a bool's two values are its TYPE, not a desk decision). A client renders the menu it is given and never one it composed: an option the desk would refuse must be unofferable, and an option the desk added must appear without shipping a new client.