Repository navigation
feat(a2ui-renderer)!: depend on zod 4 and type catalog props as web_core's zod 3 schemas - #8337
AlemTuzlak wants to merge 3 commits into
Conversation
…ore's zod 3 schemas a2ui-renderer was the last package on zod 3. It now depends on zod ^4.2.0, which satisfies the zod peer of zod-to-json-schema (it reads zod 3 schemas through zod/v3). The lockfile drops the zod 3 variants of langgraph, langchain and openai that the zod 3 dependency pulled in. createCatalog still takes zod 3 schemas: @a2ui/web_core 0.15.0 binds props by reading zod 3 internals (_def.typeName) and builds its own schemas with zod 3, and z.toJSONSchema cannot read zod 3 schemas. Props are now typed by web_core's ComponentApi["schema"] (CatalogPropsSchema), like createAngularCatalog, and CatalogDefinitions no longer uses any, so a zod 4 schema is a type error instead of a broken render. JSON Schema output for the whole basic catalog is byte-identical. Tests use a zod-v3 alias; zod 4's zod/v3 types mixed with web_core's schemas run tsc out of memory. Docs and the v2 migration skill now show the zod-v3 alias for catalog definitions. BREAKING CHANGE: the type parameter of CatalogComponentDefinition is now the props schema, not its shape. Write CatalogComponentDefinition<typeof props>. createCatalog rejects zod 4 schemas at compile time. In an app on zod 4, install zod-v3@npm:zod@^3.25.76 and import z from "zod-v3" in catalog definitions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the
|
Production Digest-Pinning AuditAll 44 services digest-pinned. Run 2026-11-11 02:09:53 PST — 0 finding(s). |
|
Size Change: +363 B (+0.01%) Total Size: 2.51 MB 📦 View Changed
ℹ️ View Unchanged
|
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/markdown
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/runtime
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
…cription Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Closing: #8348 removed |
@copilotkit/a2ui-renderernow depends onzod ^4.2.0, like every other CopilotKit package, so it no longer adds its own zod 3 to an app.createCatalogstill takes Zod 3 schemas:@a2ui/web_core0.15.0 (the latest release) binds props by reading Zod 3 internals. The docs and the migration skill now tell users to put Zod 3 under azod-v3alias for catalog definitions only, and not to use Zod 4'szod/v3.What does this PR do?
Why the catalog cannot take Zod 4 or Standard Schema (this PR first tried it):
GenericBinderandspec_shapein@a2ui/web_coreread_def.typeName(ZodObject,ZodUnion, ...). Zod 4 schemas do not have it. With Zod 4 props, the test surface showsInvalid element at key "label": expected a Zod schema, and bindings, setters and actions stop working.DynamicStringSchema,CommonSchemasand the basic catalog with its own zod 3. It also depends onzod-to-json-schemaitself.z.toJSONSchemafrom Zod 4 throws on a Zod 3 schema (Cannot read properties of undefined (reading 'def')). Sozod-to-json-schemastays: it is the only converter for these schemas.Changes
zod^3.25.76→^4.2.0. It satisfies thezodpeer ofzod-to-json-schema, which reads Zod 3 schemas throughzod/v3. The lockfile drops the zod 3 variants of@langchain/langgraph,langchain,openaiand more that this dependency pulled in.createCatalogtypes: a new exportedCatalogPropsSchema(= web_core'sComponentApi["schema"], the same typecreateAngularCataloguses).CatalogDefinitionsno longer usesany, so a Zod 4 schema is now a type error instead of a broken render.zod-v3dev alias, as@copilotkit/angulardoes. Zod 4'szod/v3is a separate copy of the Zod 3 types: mixed with web_core's schemas,tscran out of memory at 4 GB.migrate/v2,from-a2ui,fixed-schema,dynamic-schemaand the Antigravity cookbook show thezod-v3alias. The cookbook installed[email protected]as the app zod, which breaks 2.0 tool schemas.@a2ui/web_coreout of a zod override.BREAKING CHANGE: the type parameter of
CatalogComponentDefinitionis now the props schema, not its shape. WriteCatalogComponentDefinition<typeof props>, notCatalogComponentDefinition<{ title: ZodString }>.createCatalogrejects Zod 4 schemas at compile time. Zod 4 schemas never rendered correctly. In an app on Zod 4, runnpm install zod-v3@npm:zod@^3.25.76and importzfromzod-v3in catalog definitions.Related PRs and Issues
Checklist
!(for examplefeat(react-core)!: ...) and the description has aBREAKING CHANGE:line with migration steps. See VERSIONING.mdTesting
Commands run
nx run-many -t test,check-types -p @copilotkit/a2ui-renderer: 15 files, 104 tests pass. Type check passes.nx run-many -t build,check-types,typecheck,testfor react-core, vue, angular, react-native, intelligence-langgraph, the a2ui-markdown example and v2-migration: pass. The first parallel run failedvue:build,angular:buildandmarkdown:check-typeson half-writtendistfiles. A clean serial rerun (--parallel=1 --skip-nx-cache) passes.b533dca4).pnpm kiira checkon the 5 changed docs pages: pass, except the Vue tab offrom-a2ui.mdx(@copilotkit/vue/v2/generative-uidoes not resolve). That error is on2.0.0too.oxlintandoxfmton the changed files: pass.nx affectedrun. The lockfile change marks about 80 projects as affected.Manual test
pnpm nx run a2ui-renderer:test. All tests pass.create-catalog-props.test.tsx, changezin theDimmercatalog toz4(Zod 4).expected a Zod schema, andcheck-typesreports the props type error.How this PR makes testing easy
create-catalog-props.test.tsx: a@ts-expect-errorpin that a Zod 4 schema is rejected. It fails ifCatalogPropsSchemaaccepts anything.catalog-description.test.ts: serializes web_core's ownDividerschema and compares it with a literal.Risk / rollback
CatalogComponentDefinition<Shape>stops compiling. The fix is one line (seeBREAKING CHANGE).createCatalognow gets a type error. Those catalogs already failed at render time.Public API change
Before
After
🤖 Generated with Claude Code