SelectoComponents.Form.ChoiceSourceMetadata (selecto_components v0.4.8)

Projects query-contract choice-source links into form-friendly field metadata.

Query contracts expose raw fields, field_choice_bindings, and choice_sources. This module stitches those pieces together so form and UI code can ask for annotated fields instead of hand-walking the contract.

Link to this section Summary

Functions

Returns only fields that are backed by choice sources.

Looks up one field from the annotated metadata projection.

Returns every query-contract field with choice-source metadata attached when present.

Link to this section Types

@type contract() :: map()
@type field_id() :: atom() | String.t()

Link to this section Functions

Link to this function

choice_source_fields(contract, opts \\ [])

@spec choice_source_fields(
  contract(),
  keyword()
) :: [map()]

Returns only fields that are backed by choice sources.

Link to this function

field(contract, field_id, opts \\ [])

@spec field(contract(), field_id(), keyword()) :: {:ok, map()} | {:error, map()}

Looks up one field from the annotated metadata projection.

Link to this function

fields(contract, opts \\ [])

@spec fields(
  contract(),
  keyword()
) :: [map()]

Returns every query-contract field with choice-source metadata attached when present.

Bound fields keep their original "choice_source" scalar and receive a sibling "choice_source_metadata" map.