A lightweight adapter that enables bidirectional conversion between Gemini AI schemas and Zod schemas, allowing developers to use Zod's runtime validation with Google's Gemini AI. Version 0.1.2 is current; the library supports common data types (string, number, boolean, array, object) and handles optional fields and nullable types. It is designed for TypeScript environments and ships with type definitions. The package is newer with infrequent releases, differentiating by providing a straightforward mapping without additional dependencies beyond Zod.
npm install gemini-zodNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates bidirectional conversion between Zod and Gemini AI schemas using toGeminiSchema and toZodSchema.
Pin exact version and test after upgrades.
Verify schema output; use z.optional() when converting from Gemini nullable.
Check return type or manually handle unsupported schemas.
Convert to import or use dynamic import: const { toGeminiSchema } = await import('gemini-zod');Use proper named import: import { toGeminiSchema } from 'gemini-zod';Convert manually or avoid using enum in input Gemini schemas.