a2ui-project / a2ui-project/a2ui
Add `catalogFromJsonSchema()` utility to convert JSON Schema catalogs to Zod
- Lingua principale
- TypeScript
- Stelle
- 16.4k
- Fork
- 1.3k
- Merge medio
- 2g 13h
- PR unite (30g)
- 134
Descrizione
JSON Schema catalog definitions (`basic_catalog.json`) and the Zod component schemas in `basic_components.ts` are currently maintained independently by hand. This has already caused drift — see #1384.
It would be useful to have a utility in `@a2ui/web_core/v0_9` that converts a JSON Schema catalog into a `Catalog` instance with proper Zod schemas, mapping `$ref`s (e.g. `common_types.json#/$defs/DynamicString`) to the real common-type Zod schemas so `GenericBinder` classifies props correctly.
This would:
- Let catalog authors work in JSON Schema (the canonical A2UI format) while renderers get Zod automatically
- Enable catalog parity tests extending the `verify-schema.test.ts` pattern to catch drift like #1384
- Benefit all downstream renderers (React, Angular, Lit) facing the same duplication
Given that Zod v3 will remain in use for some time (see #1263 re: CSP constraints blocking v4 adoption), this would work with the current Zod v3 codebase and wouldn't depend on the v4 migration timeline.
Happy to contribute a PR.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.