Turns the JSON arguments of a tool call into the typed attributes of a command or query.
Strings become dates, decimals, enum atoms and so on through DDD.Type. Nested entities and
value objects are built with their own new/1, so their rules run: a client can never hand
the application a nested struct that skipped validation. Atoms are never created from input.
Summary
Functions
Cast the string-keyed args for the parameters of module (a command or query).
Cast one value of a URI (always a string) to the field type: "5" for an integer field,
"2030-01-02" for a date.
Functions
@spec cast(module(), map()) :: {:ok, map()} | {:error, DDD.Error.t()}
Cast the string-keyed args for the parameters of module (a command or query).
Returns {:ok, attrs} or {:error, %DDD.Error{}} listing every argument that could not be
converted. A null argument counts as absent.
@spec from_string(DDD.Type.t(), String.t()) :: {:ok, term()} | :error
Cast one value of a URI (always a string) to the field type: "5" for an integer field,
"2030-01-02" for a date.