Skip to content

refactor(web_core): read the JSON Schema of catalog schemas, not Zod internals - #25

Closed
louis-bompart wants to merge 5 commits into
claude/zod-scope/entry-api-a2ui-schemafrom
claude/zod-scope/json-schema-shaper
Closed

louis-bompart wants to merge 5 commits into
claude/zod-scope/entry-api-a2ui-schemafrom
claude/zod-scope/json-schema-shaper

Conversation

@louis-bompart

@louis-bompart louis-bompart commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This PR makes web_core read a catalog schema's JSON Schema view instead of walking Zod 3 internals. Components built with Standard JSON Schema libraries such as Zod 4, Valibot, and ArkType can bind, serialize, and report child references without the core depending on their implementation details.

a2uiJsonSchemaOf(schema) provides that view. It preserves Zod 3 REF: markers, child references, exclusive unions, and nested spec() keywords; the validation-schema generator and catalog serializer now share it. GenericBinder and the component reference map still inspect code entries through the catalog's own toJson() document, preserving the published-catalog behavior.

SpecShaper itself remains a separate later migration layer. This PR does not switch the Basic Catalog generator to Zod 4.

Part of a2ui-project#2160.

Pre-launch Checklist

One time:

For this PR:

  • I have updated the relevant CHANGELOG.md file.
  • I updated/added relevant documentation.
  • My code changes have tests.
  • If my branch is on a fork, I have verified that scripts/e2e_test.sh passes.

Tests

  • @a2ui/web_core: build; full test and conformance run (1267 passing, 0 failing, 21 existing todos); lint with no errors; and format checks.
  • Adds document-routing regressions for Checkable binder behavior and ChildList component-reference discovery.
  • Adds reload parity for nested spec() keywords in generated function validation schemas.

louis-bompart and others added 3 commits October 27, 2026 17:39
…internals

GenericBinder, scrapeSchemaBehavior, extractRefFields, getKnownSchemaKeys,
the component reference map, the legacy inline catalog and the serializer
of a code entry without specification annotations read a schema's JSON
Schema view instead of Zod 3 internals.

A new a2uiJsonSchemaOf() returns that view: a schema implementing Standard
JSON Schema (such as a Zod 4 schema) is converted with normalizeSchema; a
Zod 3 schema is converted with zod-to-json-schema, its REF: markers and
markChildRef marks becoming $refs and an exclusiveUnion a oneOf. The
keywords a spec() annotation adds to a Zod 3 schema are written with it.
Components built with other libraries now bind, serialize and report
their child references, and data-context no longer imports Zod.

The specification shaper (SpecShaper), which computes the published
document of a spec()-annotated built-in catalog, still reads Zod 3 and is
migrated separately.

Part of a2ui-project#2160.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@louis-bompart

Copy link
Copy Markdown
Collaborator Author

Superseded by the regrouped stack on upstream main: this change is now part of #49 (series #45 to #54). The branch is kept for reference.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant