npm / nestjs-zod
nestjs-zod
What changed in nestjs-zod 3 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.
9 breaking4 deprecations12 new APIs and options27 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initnestjs-zod 549 changes
Breaking changes 7
Adds a check to ensure @Res() is not used without passthrough: true.
OpenAPI 3.0 schemas no longer include
id.Uses deepObject style by default for object query params.
Replaces patchNestJsSwagger.
Now returns unknown.
Removes patchNestJsSwagger and replaces it with cleanupOpenApiDoc.
No longer receives special handling in OpenAPI generation.
Deprecations 4
Deprecated.
Deprecated.
Deprecates zodToOpenAPI and renames it to zodV3ToOpenAPI.
Renames zodToOpenAPI to zodV3ToOpenAPI.
New APIs and options 11
Adds the createZodSerializerInterceptor function.
Adds the strictSchemaDeclaration option to createZodValidationPipe.
Allows passing reportInput to parse params.
Adds support for title metadata.
Adds support for zod codecs.
Adds support for differentiating input and output schemas.
Adds support for OpenAPI 3.0 and 3.1, specifically regarding null handling.
Adds support for recursive schemas.
Adds support for reusable and external schemas.
nestjs-zod v5 adds support for Zod v4.
Adds the ZodResponse decorator.
Fixes and other changes 27
Replaced deepmerge with internal helpers in response to CVE-2026-93753.
Fixed a bug involving duplicate schemas.
Fixed unions generating incorrect OpenAPI documentation with the latest Zod.
Fixes a bug with named schemas when using zod ≥ 4.4.
Cleans up parent-metadata and parent-additional-properties from query params.
Nullable enums include null in the enum array when generating OpenAPI 3.0.
Converts exclusiveMaximum for OpenAPI 3.0.
Converts exclusiveMinimum for OpenAPI 3.0.
Converts propertyNames for OpenAPI 3.0.
Optional object properties are removed from the required array when using @nestjs/swagger v7.
Removes the prefix from parameter schemas for strict objects.
Fixes broken deep imports, so developers can use deep import paths reliably.
Fixes handling of defs refs inside propertyNames.
Copies all root schema metadata.
OpenAPI 3.0 const conversion now handles falsy literals, including 0, false, and the empty string.
Fixes id handling for array schemas.
Fixes cases where nullable was not converted correctly.
Nullable $ref values are now handled validly for OpenAPI 3.0 by using allOf.
Fixes title handling for array schemas.
Restores the /dto entry point for importing DTO functionality.
Adds an ESM entry point to resolve the globalRegistry mismatch.
Fixes errors with nested named schemas.
Uses enum instead of const for OpenAPI 3.0.
Fixes handling of optional nested query params.
Fixes serialization being skipped when a primitive is returned.
Fixes missing OpenAPI documentation when a DTO is used for query params.
Fixes unexpected array behavior.
nestjs-zod 41 changes
Breaking changes 1
Extended Zod was split into the separate @nest-zod/z package.
nestjs-zod 32 changes
Breaking changes 1
ZodSerializerInterceptor now returns a 500 error status instead of 400.
New APIs and options 1
Support was added for Zod native string date-time.