Small Zoi helpers for Jidoka's data-first structs.
This module is intentionally narrow. It keeps repeated constructor mechanics in one place while each domain module owns its actual Zoi schema.
Summary
Functions
Returns a schema that accepts atoms or matching atom-name strings.
Fetches a map value by atom key, falling back to the equivalent string key.
Gets a map value by atom or string key with a default.
Returns a coercing non-empty string schema.
Normalizes structs and keyword lists into map-like attributes for schema parsing.
Parses keyword or map attributes through a Zoi schema.
Parses attributes through a Zoi schema or raises with a labeled error.
Puts a default value when neither atom nor string key is already present.
Types
@type parse_result(t) :: {:ok, t} | {:error, term()}
Functions
@spec atom_enum([atom()]) :: Zoi.schema()
Returns a schema that accepts atoms or matching atom-name strings.
Fetches a map value by atom key, falling back to the equivalent string key.
Gets a map value by atom or string key with a default.
@spec non_empty_string() :: Zoi.schema()
Returns a coercing non-empty string schema.
Normalizes structs and keyword lists into map-like attributes for schema parsing.
@spec parse(Zoi.schema(), keyword() | map()) :: parse_result(struct())
Parses keyword or map attributes through a Zoi schema.
@spec parse!(Zoi.schema(), keyword() | map(), String.t()) :: struct()
Parses attributes through a Zoi schema or raises with a labeled error.
Puts a default value when neither atom nor string key is already present.