vibe.handlers.structured

Handler for Structured Data Types.

Implements the DataTypeHandler interface for the structured type. Handles widget rendering, form data processing, and runtime validation for structured data defined by definition references. Uses dot notation for form field names to avoid namespace collisions and processes nested dictionaries according to definition specifications.

StructuredHandler

Handler for structured types that reference definition specifications.

__init__

__init__(definition: dict[str, Any], template_data: Optional[TemplateData] = None) -> None

Initialize with definition reference for field specifications.

set_template_data

set_template_data(template_data: Optional[TemplateData]) -> None

Set template data for definition resolution.

render_widget

render_widget(name: str, current_value: dict[str, Any] | None, error_message: dict[str, str] | str | None = None, **kwargs: object) -> str

Render widget for structured type with dot notation field names.

process_form_data

process_form_data(name: str, form_data: MultiDictLike) -> dict[str, Any]

Process form data with dot notation field names back to structured dict.

validate_input

validate_input(value: dict[str, Any] | None, check_required: bool = True) -> dict[str, str] | None

Validate the structured input by validating each field according to definition.

get_probe_placeholder

get_probe_placeholder() -> dict[str, Any]

Return dict with probe placeholder values for structured fields.

get_preview_placeholder_value

get_preview_placeholder_value() -> dict[str, Any]

Return dict with placeholder values for preview when structured data is needed.

create_validated_value

create_validated_value(value_for_analysis: object, reporter: ValidationReporter) -> ValidatedStruct

Create ValidatedStruct for static template checking.

supports_structured_access

supports_structured_access() -> bool

Allow dot-notation access to all fields defined in the referenced definition.