Commit c5d28e9
feat: add library-based ts-to-zod schema generation
Replace CLI-based ts-to-zod usage with library-based generation that:
1. **@description injection during fetch**: The fetch-spec-types.ts script
now automatically extracts the first paragraph of each JSDoc comment
and adds it as a @description tag. This enables ts-to-zod to generate
.describe() calls in the Zod schemas.
2. **Library-based generation**: New generate-schemas.ts script uses
ts-to-zod as a library with configuration options:
- keepComments: true - preserves JSDoc comments
- skipParseJSDoc: false - parses @description tags
- getSchemaName: camelCase naming for backwards compatibility
3. **Post-processing**: Robust brace-counting algorithm to replace
z.record().and(z.object()) with z.looseObject() for index signatures.
4. **Integration tests**: Auto-generated tests verify that Zod schemas
match their corresponding TypeScript types at compile time.
Generated 145 Zod schemas with full descriptions in src/generated/.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 67d79d4 commit c5d28e9
File tree
7 files changed
+5662
-16
lines changed- scripts
- src
- generated
7 files changed
+5662
-16
lines changed
0 commit comments