7.0.0 (2026-05-26)
Features
BREAKING CHANGES
- peer dependency on zod is now ^4. Drop zod 3 support.
- Bump peer
zodto ^4 and dep@asteasolutions/zod-to-openapito ^8.5.0 - Replace
z.SafeParseReturnTypewithz.ZodSafeParseResult(renamed in zod 4) - Validated middleware now casts to
z.output<T>soreq.params/body/query
infer correctly under zod 4's stricter input/output split - Replace removed
ZodEffectsref-resolution branch withgetRefId()from
zod-to-openapi v8 — pipes/transforms on registered schemas still resolve
back to their$ref - Update test assertions for zod 4's new "Invalid input: expected X, received Y"
default error format - Pin packageManager to yarn@1.22.22 to match the existing v1 lockfile
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
- fix: infer req body/query/params types correctly under zod 4
Three follow-up fixes after the initial zod 4 bump:
- Replace
TBody extends ZodTypeAny(which collapses tounknownunder
zod 4's stricter variance) with bareTBody/TQuery/etc. generics and a
conditionalInferOutput<T>helper that readsT["_zod"]["output"]. This
restores proper inference forreq.body,req.query, andreq.params
insideopenAPIRoute(...)handlers. InferOutput<T>falls back toanywhen no schema is declared, matching
the previous behavior so routes without explicit schemas don't suddenly
break.- Re-export
extendZodWithOpenApiandZodOpenAPIMetadatafrom the
package root so the.openapi()augmentation is more discoverable for
consumers; undermodule: "nodenext"callers may still need to import
@asteasolutions/zod-to-openapithemselves to fully activate it.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com