a2ui-project / a2ui-project/a2ui

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

Abierto
#1,421 2 comentarios 0 reacciones 0 asignados Ver en GitHub
component: standard catalog specification P2 requires developer input type: feature/enhancement
Lenguaje dominante
TypeScript
Estrellas
16.4k
Forks
1.3k
Merge medio
2 d 13 h
PR fusionados (30 d)
134

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
json, typescript
Área
backend-api-design, tooling
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.