Expand description
v2 Spec types: flat element map with ID-keyed references.
A Spec is a top-level JSON-UI document consisting of a $schema version tag,
a root element ID, and an elements map of type-erased Element values.
Each Element carries a type_name: String, a props: serde_json::Value payload,
a children: Vec<String> list of child IDs (not nested structures), and optional
action / visible fields.
Spec::from_json and SpecBuilder::build both run the same parse-time structural
validation: duplicate IDs, ID format, root existence, dangling refs, cycles, depth
≤ MAX_NESTING_DEPTH. Malformed specs surface as typed SpecError variants;
from_json never panics on arbitrary input.
Structs§
- DataRef
{"$data": "/path"}shape — references a JSON pointer inspec.data. Mirrors the$datakey recognised by expression resolution (seeexpression.rs:EXPR_DATA_KEY).- Each
Directive - Iteration directive on an
Element: instantiate one element per row of a JSON array resolved fromSpec::data. - Element
- A single type-erased UI element.
- Element
Builder - Fluent builder for
Element. - Nested
Element - Nested-tree element form for the ergonomic
SpecBuilder::element_nestedAPI. - Spec
- Top-level v2 JSON-UI document.
- Spec
Builder - Fluent builder for
Spec.
Enums§
- Spec
Error - Errors returned by
Spec::from_jsonandSpecBuilder::build. - Title
Binding - Bindable string value — either a literal or a runtime
$datareference.
Constants§
- MAX_
NESTING_ DEPTH - Maximum allowed nesting depth from the root element.
- SCHEMA_
VERSION - Schema version string embedded in every v2
Specunder the$schemaJSON key.