Security & correctness patch
Recommended upgrade for all users.
What's new
-
Fixed: Python codegen bugs
- Schemas with control characters (
\n,\t,\r, etc.) no longer generate invalid Python syntax. - Top-level
z.union()andz.discriminatedUnion()now emit valid Pydantic output (previously generated references to undefined classes).
- Schemas with control characters (
-
Hardened: schema loading
loadZodSchema()andscanFolderForSchemas()now requiretrustedInput: truesince they execute module code via dynamicimport().- The CLI handles this automatically — no change needed for CLI users.
-
Slimmed down:
npm install- Removed
vitepress-plugin-group-iconsandzodfrom production dependencies.zodis now peer-only. - Install size is significantly smaller and the core package has zero audit vulnerabilities.
- Removed
-
Hardened: docs playground
- The
/api/convertendpoint now uses AST-based input validation, rate limiting, timeouts, and a production opt-in guard.
- The
Upgrading
- CLI users: No changes needed.
- Library users: Add
trustedInput: trueto anyloadZodSchema()orscanFolderForSchemas()calls:
// Before
const { schema } = await loadZodSchema({ file, exportName });
// After
const { schema } = await loadZodSchema({ file, exportName, trustedInput: true });