Skip to content

feat(web_core)!: remove Zod 3 support - #54

Draft
louis-bompart wants to merge 3 commits into
claude/zod4/09-zod4-public-typesfrom
claude/zod4/10-remove-zod3
Draft

louis-bompart wants to merge 3 commits into
claude/zod4/09-zod4-public-typesfrom
claude/zod4/10-remove-zod3

Conversation

@louis-bompart

Copy link
Copy Markdown
Collaborator

Description

With every built-in schema in Zod 4, this PR removes Zod 3 support from @a2ui/web_core. Schemas are written with Zod 4 (import {z} from 'zod/v4'), another Standard JSON Schema library, or as JSON Schema objects.

  1. EntrySchema is an A2uiSchema. The @a2ui/web_core/zod3 entry point, spec(), specDef(), exclusiveUnion, markChildRef, childRefKindOf and ChildRefKind are removed: annotate with .meta(specMeta(...)), name a model with .meta(specMeta({defName})), write an exclusive union with z.xor(), and refer to ComponentId or ChildList with .meta({$ref}).
  2. Catalog.toJson() writes an exclusive union of a specification-shaped model as oneOf, and a oneOf loaded with Catalog.fromJson compiles to z.xor.
  3. BasicCatalogThemeSchema is Zod 4, and the core validates a theme with the catalog's own theme schema whenever that schema is a validator.
  4. getKnownSchemaKeys reads additionalProperties: {}, as Zod 4 writes a loose object, as allowing any key.
  5. The package no longer depends on zod-to-json-schema, and the remaining zod/v3 imports in the repo, including upstream's newer files, move to zod/v4.
  6. Each package's changelog drops the entries this PR cancels (the zod3 entry point) and describes the zod@^4.6.7 dependency as Zod 4.

Validation

  1. yarn build in typescript/core/web_core, then node --test "dist/**/*.test.js": 1534 tests, 0 failing.
  2. node tests/conformance/conformance_test.mjs: every vector passes.
  3. yarn lint in typescript/core/web_core: 0 errors.
  4. yarn build and yarn test in typescript/catalogs/mcp, typescript/catalogs/vegachart, typescript/renderers/markdown-it, typescript/renderers/lit, typescript/renderers/react and typescript/agents/a2ui_agent: all pass.
  5. yarn build in typescript/renderers/angular, tools/composer, tools/editor and tools/inspector. The Angular tests were not run: the local Java is too old for the Closure Compiler step.

Regroups #40, #41 and #42.

Part of a2ui-project#2160.

🤖 Generated with Claude Code

louis-bompart and others added 3 commits October 29, 2026 12:43
spec(), specDef() and exclusiveUnion are deprecated in favor of specMeta()
and z.xor(). SpecShaper keeps an authored oneOf, so a z.xor union is written
as oneOf; the loader compiles oneOf to z.xor, and formatZodIssue reports
z.xor's "more than one option matched" issue. The README documents the
Zod 4 authoring API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BasicCatalogThemeSchema moves to Zod 4 and keeps accepting any CSS color.
themeSchemaOf returns a catalog's own theme schema whenever it is a
validator, so a Zod 4 theme is validated as a Zod 3 one was, instead of
against the document's stricter hexadecimal theme, or not at all when the
document writes none. Angular's catalogs take their theme schema as an
EntrySchema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EntrySchema no longer accepts a Zod 3 schema, and the zod3 entry point,
fromZod3, spec(), specDef(), exclusiveUnion, markChildRef and
childRefKindOf are removed, with their Zod 4 replacements in place. The
JSON Schema view, serializer, generator, entry schemas and issue formatter
lose their Zod 3 paths, and web_core drops zod-to-json-schema.

getKnownSchemaKeys reads Zod 4's additionalProperties: {} as open. Tests,
renderers, the agent SDK, the composer and the docs import zod/v4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 29, 2026
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