Skip to content

Comments

feat: complex schema support and built-in primitives#110

Merged
ssilvius merged 3 commits intomainfrom
feat/complex-schema-support
Feb 23, 2026
Merged

feat: complex schema support and built-in primitives#110
ssilvius merged 3 commits intomainfrom
feat/complex-schema-support

Conversation

@ssilvius
Copy link
Contributor

Summary

  • Composite type support: Nested objects, arrays, discriminated unions, tuples, records, and intersections now generate full recursive form components
  • Built-in primitives: Default output includes a primitives.tsx with pure HTML/React components matching the shadcn API -- users swap to real shadcn by passing --ui @/components/ui
  • Nullable/nullish support: z.nullable(), z.nullish() correctly unwrap with isNullable on field descriptors
  • Zod v4 transparency: Branded types, pipe/transform, .check()/.superRefine(), z.email()/z.url() format detection all handled

What changed

Layer Changes
Introspection 5 new composite FieldTypes, recursive FieldMetadata, intersection flattening, pipe/transform input extraction, literal type resolution
Mapping 3 new component types (Fieldset, FieldArray, UnionSwitch), 5 new rules, recursive resolver
Codegen Recursive JSX builders, Card-based grouping, dynamic array add/remove, union discriminator switch, record key-value pairs
Primitives New primitives.ts template generates shadcn-API-compatible components (Field, Button, Input, Select, RadioGroup, Checkbox, Slider, DatePicker, Card, etc.)
CLI --ui now optional; omitting it generates built-in primitives alongside the form

Stress tested

11 real-world schemas all pass: healthcare patient intake, e-commerce product listing, finance loan application, HR job application, real estate listing (intersection), education enrollment (tuple + record), logistics shipment booking, legal contract intake (branded + pipe), SaaS settings, insurance claims, government tax filing (superRefine + array of unions).

Test plan

  • 238/238 unit tests pass (no regressions)
  • 11/11 stress tests pass
  • TypeScript typecheck clean
  • Biome lint clean

Generated with Claude Code

ssilvius and others added 3 commits February 22, 2026 23:09
Extend the form generator from flat z.object() with 5 scalar types to
full recursive support for nested objects, arrays, discriminated unions,
tuples, records, and intersections. Generated forms now use shadcn-API-
compatible pure HTML/React primitives by default -- users swap to real
shadcn by passing --ui.

Introspection:
- Add object, array, union, tuple, record to FieldType
- Recursive FieldMetadata for composite types
- Intersection flattening (.and() chains merged into single object)
- Nullable/nullish unwrapping with isNullable on FieldDescriptor
- Pipe/transform transparency (uses input type)
- Literal type resolution, z.email()/z.url() format detection

Mapping:
- Add Fieldset, FieldArray, UnionSwitch component types
- 5 new mapping rules for composite types
- Recursive resolver attaches child configs via componentProps

Codegen:
- Recursive JSX builders for nested fields (Card-based grouping)
- Array rendering with dynamic add/remove (simple, objects, unions)
- Union switch with discriminator Select + conditional fields
- Record rendering with key-value pairs
- Built-in primitives template matching shadcn component API
- Default import from ./primitives when --ui is omitted

Stress tested against 11 real-world schemas covering healthcare,
e-commerce, finance, HR, real estate, education, logistics, legal,
SaaS, insurance, and government tax filing domains.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ssilvius ssilvius force-pushed the feat/complex-schema-support branch from b54382c to 5f557be Compare February 23, 2026 07:10
@ssilvius ssilvius merged commit 3a7ef40 into main Feb 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant