Repository navigation
feat(web_core)!: write the common types and the v0.8 and v0.9 basic catalogs in Zod 4 - #53
Draft
louis-bompart wants to merge 4 commits into
Draft
louis-bompart wants to merge 4 commits into
louis-bompart wants to merge 4 commits into
Conversation
The v0.9 basic catalog's components, functions and definition models are
generated in Zod 4, on the Zod 4 v0.9 common types, like the v1.0 catalog.
specMeta() takes a mixin model, named with specMeta({defName}), and A2UI
finds it through the schema's meta(), so a component reused in another
catalog still writes its CatalogComponentCommon mixin. A mixin name can also
name one of the catalog's defModels. Zod 4 converts a schema named with
.meta({$ref}) to its reference and metadata, which also lets it convert the
v0.9 DynamicValue/FunctionCall cycle. The Zod 4 v0.9 common types reuse the
exported recursive types so inferred types can be named.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The v0.8 catalog generator writes strict Zod 4 objects annotated with specMeta() instead of Zod 3 objects annotated with spec(). The catalog's document, validation schema and accepted payloads are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The superset, v0.9 and v1.0 common types are generated in Zod 4 into the
files the packages export, which replace the internal zod4/ copies. The
v0.9, v1.0 and superset authoring helpers, IndexApi and the payload
validator's envelope checks move to Zod 4 too; the helpers now write the
description they are given.
With expandReferences, a Zod 4 schema named by .meta({$ref}) keeps its
contents unless it names an opaque definition. The generator recognizes
the common types' own descriptions through their metadata.
VegaChart, callMcpTool, the explorer components and the tests that compose
the common types move to Zod 4; tests of Zod 3 support use Zod 3 stand-ins.
With the common types in Zod 4, the ValidationResult coercion reads every schema through its JSON Schema view, and callMcpTool writes its function-call arguments as a strict object rather than z.custom, which has no JSON Schema.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The catalog generator drops its Zod 3 mode. compileDefToZod names a
definition with .meta({$ref}) itself, through a ref option, and the v0.9,
v1.0 and superset generators write Zod 4 templates, so toZod4Code is gone.
Every generated file is unchanged, except that two superset common types
lose stray backslashes in their descriptions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR moves the rest of the public schemas to Zod 4: the exported common types and helpers, and the v0.9 and v0.8 basic catalogs. The generators write Zod 4 directly. Accepted payloads and every catalog's
toJson()are unchanged; validation messages use Zod 4's wording.@a2ui/web_core/v0_9and@a2ui/web_core/v1_0export are Zod 4, and each names its definition with.meta({$ref})instead of aREF:description.specMeta()takes a mixin model as well as a common type's name, such asCatalogComponentCommonSchema, and a Zod 4 schema on a cycle is read through its$ref.ValidationResultcoercion reads every function schema through its JSON Schema view.ResolveA2uiPropkeeps aRecord<string, unknown>property as it is: under Zod 4 such a record matched the binding and call types and resolved toundefined.CallMcpToolApiandMcpAppApiare Zod 4. The function call that returns the wholeargumentsobject is a strict object ofcall,argsandreturnTypeinstead ofz.custom, which has no JSON Schema. vegachart:VegaChartApiandVegaChartV1Apiare Zod 4.Validation
yarn buildintypescript/core/web_core, thennode --test "dist/**/*.test.js": 1541 tests, 0 failing.node tests/conformance/conformance_test.mjs: every vector passes.yarn lintintypescript/core/web_core: 0 errors.yarn buildandyarn testintypescript/catalogs/mcp,typescript/catalogs/vegachart,typescript/renderers/markdown-it,typescript/renderers/lit,typescript/renderers/reactandtypescript/agents/a2ui_agent: all pass.yarn buildintypescript/renderers/angular,tools/composer,tools/editorandtools/inspector. The Angular tests were not run: the local Java is too old for the Closure Compiler step.Regroups #37, #38, #39 and #43.
Part of a2ui-project#2160.
🤖 Generated with Claude Code