a2ui-project / a2ui-project/a2ui

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

オープン
#1,421 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
component: standard catalog specification P2 requires developer input type: feature/enhancement
主要言語
TypeScript
スター
16.4k
フォーク
1.3k
平均マージ
2日 13時間
マージ済み PR(30日)
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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Look at the existing JSON Schema catalog file (`basic_catalog.json`) and the corresponding Zod component schemas in `basic_components.ts`. Study the `verify-schema.test.ts` pattern to understand how schema parity is currently checked. The utility should be added to `@a2ui/web_core/v0_9`, mapping `$ref`s to the real common-type Zod schemas. Start by examining how `GenericBinder` classifies props to understand the required output format. 'Done' means the utility successfully converts a JSON Schema catalog to a `Catalog` instance with proper Zod schemas, enabling automated parity tests.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
json, typescript
領域
backend-api-design, tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。