StatifierBlocks.ViewModel.Field (StatifierBlocks v0.1.0)

Copy Markdown View Source

One config field, its schema and its current value (ADR-0005 decision 9).

key is the field's identity - the DOM id, the form param name, and what a {:config, id, key} finding anchors to. value_path is where the bytes live, and the two are the same place unless the block type said otherwise (ADR-0002 decision 7, amended 2026-08-27). nil means it did not; read it through value_path/1 rather than the struct field, and the two cases collapse into one path.

Summary

Functions

Where this field's value lives, defaulting to [key].

Types

t()

@type t() :: %StatifierBlocks.ViewModel.Field{
  default: StatifierBlocks.Block.json(),
  findings: [StatifierBlocks.Finding.t()],
  key: String.t(),
  label: String.t(),
  required?: boolean(),
  type: StatifierBlocks.BlockType.field_type(),
  value: StatifierBlocks.Block.json(),
  value_path: StatifierBlocks.BlockType.value_path() | nil
}

Functions

value_path(field)

@spec value_path(t()) :: StatifierBlocks.BlockType.value_path()

Where this field's value lives, defaulting to [key].