Picnic.Schema behaviour (Picnic v0.1.0)

Copy Markdown View Source

Behaviour for the optional, deliberately loose domain structs under Picnic.Schema.*.

A schema declares its expected fields and their rough JSON types via fields/0; Picnic.Decode uses that to cast payloads leniently. Schemas carry no validation logic on purpose — they are a convenience layer over plain maps, and every struct keeps the untouched original payload in its :raw field.

Summary

Types

Rough JSON type used for drift detection — not validation.

Types

field_type()

@type field_type() :: :any | :string | :integer | :number | :boolean | :list | :map

Rough JSON type used for drift detection — not validation.

Callbacks

fields()

@callback fields() :: %{required(atom()) => field_type()}