Env-based settings loader for Exdantic schemas.
This module builds schema input from environment variables and explicit input, then delegates validation to the existing Exdantic validation pipeline.
v1 behavior:
- Field names derive env keys as
snake_case -> UPPER_SNAKE, joined byenv_nested_delimiter(default"__"), withenv_prefixprepended. - Field override
extra: %{"env" => "KEY"}is absolute; prefix is not applied. If both override and derived key exist, override wins. - Structured values (
array, maps/objects, nested schema refs) are JSON-only. - Union decoding is conservative: JSON is attempted only for JSON-like strings
(
{or[) when the union includes structured members; otherwise raw strings are passed to validation. - Exploded nested env keys do not address arrays in v1 (
APP_ITEMS__0is ignored).
Summary
Types
Functions
@spec from_system_env(module(), [load_option()]) :: {:ok, map() | struct()} | {:error, [Exdantic.Error.t()]}
@spec load(module(), [load_option()]) :: {:ok, map() | struct()} | {:error, [Exdantic.Error.t()]}
@spec load!(module(), [load_option()]) :: map() | struct()