-
Notifications
You must be signed in to change notification settings - Fork 996
Open
Labels
Description
Proposal: Strict Type Coercion in DataContext
Reason
The A2UI protocol defines standard coercion rules (e.g., null resolving to "" for strings). Without central enforcement, component authors must manually handle these edge cases, leading to bugs like [object Object] appearing in text labels.
Design
- Coercion Utils: Implement the coercion table from the
renderer_guide.mdin a shared utility. - Context Integration: Update
DataContext.resolveDynamicValueandresolveSignalto apply these rules. - Primitive Safety:
- String targets: Convert any non-string to localized string; map
null/undefinedto"". - Number targets: Parse strings; map
null/undefinedto0. - Boolean targets: Map
"true"(case-insensitive) and non-zero numbers totrue.
- String targets: Convert any non-string to localized string; map
- GenericBinder Alignment: Ensure the
GenericBinderuses these coerced values when populatingResolvedProps.
Key Files
renderers/web_core/src/v0_9/rendering/data-context.tsrenderers/web_core/src/v0_9/rendering/generic-binder.ts
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In Progress