A library (v3.4.1) integrating Zod validation objects into NestJS GraphQL resolvers, reducing boilerplate by generating GraphQL types and schemas automatically from Zod schemas. Supports nested objects, enums, custom names, and custom scalar types. Peer dependencies include @nestjs/graphql >=10, @nestjs/core >=8, zod >=3.15, and class-transformer. Key differentiator: eliminates manual DTO/input type classes, with decorators like @QueryWithZod and @ZodArgs that mirror standard NestJS GraphQL decorators but accept Zod objects. Ships TypeScript types.
npm install nestjs-graphql-zodNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to define a Zod schema, use @QueryWithZod for output validation and @ZodArgs for input validation, and integrate into NestJS GraphQL module.
Update @nestjs/graphql to >=10.0.0 and use ApolloDriver or MercuriusDriver.
Use @ZodArgs and @InputTypeWithZod for input validation instead of manual parsing.
Always provide a description in the format `{ClassName}:{Description}` for nested objects to ensure predictable GraphQL type names.Implement a custom exception filter or use the `errorFormatter` option provided in some decorators to include Zod error details.
Ensure `"module": "ESNext"` or `"NodeNext"` and `"moduleResolution": "NodeNext"` in your tsconfig.json.
Install compatible peer dependencies: `npm install @nestjs/graphql@^10 @nestjs/common@^8 @nestjs/core@^8 zod@^3`.
Ensure the returned object from resolver matches the exact shape defined in the Zod schema, including required fields and types.