yera.runtime.blocks.form

Emit typed form requests and their transcript echoes.

A form request converts a Pydantic model or Yera struct into a field schema and carries current values, validation errors, and optional cancellation. Its block identity correlates the submitted object with the waiting app. A separate form echo records whether a submission was accepted or rejected for renderers that show the interaction in the transcript.

Symbols

def request_input_form — Request one typed form submission for a model's fields.

request_input_form

request_input_form(
    model_type: type[BaseModel],
    label: str | None = None,
    cancel_label: str | None = None,
    values: dict[str, JsonValue] | None = None,
    errors: dict[str, list[str]] | None = None,
) → str

Request one typed form submission for a model's fields.

Parameters

model_type
type: type[BaseModel]

Model or struct class whose fields the form presents.

label
type: str | None = None

Optional question shown above the form.

values
type: dict[str, JsonValue] | None = None

JSON values pre-filling the form, keyed by field name.

errors
type: dict[str, list[str]] | None = None

Validation messages from a rejected submission, keyed by dotted field path.

cancel_label
type: str | None = None

Optional label for an action that cancels the form.

Returns

type: str

Block ID identifying the input request.