Dextrin.Schema.Validated (Dextrin v0.1.0)

Copy Markdown View Source

Internal only — never appears in a value handed back to Dextrin.decode/2/decode_binary/2's caller.

Tracks which schema produced a materialized value, so an outer {:reference, name} check can verify identity even after materialization has replaced the value with a plain map or application struct that carries no name of its own — unlike an opaque Dextrin.Struct, which already carries its own name and never needed this. Dextrin.Schema.Validator.materialize/4 (decode) and wrap_and_check/2 (encode-time validation) both wrap every successfully-checked struct's result in one of these — one wrapper, shared by both directions; strip/1 removes every occurrence, recursively, once the value reaches somewhere that isn't itself another schema check — a field whose declared type isn't a reference, or the true top of decoding (Dextrin.decode/2/ decode_binary/2), for a struct that was never anyone's field to begin with.

Summary

Functions

Recursively removes every Validated wrapper from a decoded value tree.

Types

t()

@type t() :: %Dextrin.Schema.Validated{name: String.t(), value: term()}

Functions

strip(list)

@spec strip(term()) :: term()

Recursively removes every Validated wrapper from a decoded value tree.