The typed-payload boundary for Hourglass workflow/activity I/O.
A type is either a module implementing this behaviour (typically via
use Hourglass.Schema) or one of the built-in scalar atoms:
:string, :integer, :float, :boolean, :map, :any.
cast/2 turns a JSON-decoded term (string-keyed maps, primitives) into a
validated value; dump/2 turns a value into a JSON-encodable term. These
are the functions the workflow/activity entry wrappers call at the wire
boundary.
Summary
Callbacks
Cast a JSON-decoded term into a validated value, or an error.
Serialize a value to a JSON-encodable term.
Types
Callbacks
@callback cast(term()) :: {:ok, term()} | {:error, Ecto.Changeset.t()}
Cast a JSON-decoded term into a validated value, or an error.
Serialize a value to a JSON-encodable term.
Functions
Cast a JSON-decoded raw term against type.
Like cast/2 but returns the value or raises on error.
Dump value to a JSON-encodable term according to type.