a2ui-project / a2ui-project/a2ui

Add `catalogFromJsonSchema()` utility to convert JSON Schema catalogs to Zod

未關閉
#1,421 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
component: standard catalog specification P2 requires developer input type: feature/enhancement
主要語言
TypeScript
星號
16.4k
分支
1.3k
平均合併
2 天 13 小時
30 天內合併 PR
134

描述

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.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。