Skip to content

refactor(web_core): extract shared Zod schema introspection and metadata utilities #2443

Description

@josemontespg

Overview

GenericBinder (renderers/web_core/src/v0_9/rendering/generic-binder.ts) and NodeResolver (renderers/web_core/src/v0_9/nodes/ref-fields.ts) both independently inspect Zod schemas:

  1. Accessing private _def internals (typeName, innerType, description, options, shape()).
  2. Duplicating unwrapping loops for ZodOptional, ZodNullable, ZodDefault, and ZodEffects.
  3. Defining duplicate schema reference strings (REF:common_types.json#/$defs/...).

Goals

  • Centralize Schema Constants: Export canonical reference constants (CHILD_LIST_REF, COMPONENT_ID_REF, ACTION_REF, DATA_BINDING_REF) from a central location (renderers/web_core/src/v0_9/schema/constants.ts or common-types.ts).
  • Shared Schema Introspection Utility: Consolidate unwrapping logic into a dedicated helper module (renderers/web_core/src/v0_9/schema/schema-reflection.ts) so callers avoid accessing _def directly.
  • Extend Schema Metadata: Broaden the a2uiChildRef metadata pattern introduced in PR feat(react): render A2uiSurface through the node layer #2393 (markChildRef / childRefKindOf) to Action and Dynamic* schemas (a2uiKind: 'action' | 'dynamic' | 'child-list' | 'component-id').

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Good request. This is not currently planned, but may become a priority.type: feature/enhancement

    Type

    No type

    Projects

    • Status
      Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions