unstale

npm / @asteasolutions/zod-to-openapi

@asteasolutions/zod-to-openapi

What changed in @asteasolutions/zod-to-openapi 7 to 9, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

5 breaking22 new APIs and options4 behavior and defaults8 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

@asteasolutions/zod-to-openapi 918 changes

Breaking changes 1

  • ResponseConfig.description is now optional; code assuming it is always present may need a guard or non-null assertion.

    9.0.0release notes

New APIs and options 14

  • Adds string format support for z.base64url().

    9.1.0release notes

  • Adds string format support for z.cidrv4().

    9.1.0release notes

  • Adds string format support for z.cidrv6().

    9.1.0release notes

  • Adds string format support for z.guid().

    9.1.0release notes

  • Adds string format support for z.iso.duration().

    9.1.0release notes

  • Adds string format support for z.iso.time().

    9.1.0release notes

  • Supports the OpenAPI 3.2 media-type field itemEncoding, including for streaming media types.

    9.0.0release notes

  • Supports the OpenAPI 3.2 media-type field itemSchema, including for streaming media types.

    9.0.0release notes

  • Adds a generator for OpenAPI 3.2.0 documents, using the same JSON Schema dialect as 3.1.

    9.0.0release notes

  • Supports the OpenAPI 3.2 media-type field prefixEncoding, including for streaming media types.

    9.0.0release notes

  • Routes can use the query HTTP method.

    9.0.0release notes

  • Allows mediaTypes to be registered as a reusable component type.

    9.0.0release notes

  • Responses can now include an optional summary.

    9.0.0release notes

  • Allows $ref entries directly in ZodContentObject.

    9.0.0release notes

Behavior and default changes 1

  • ZodMediaTypeObject.schema is now optional to support itemSchema-only media types.

    9.0.0release notes

Fixes and other changes 2

  • Corrects the regex used for bigint OpenAPI, fixing generated OpenAPI output.

    9.1.0release notes

  • Corrects discriminator mapping for nested discriminated unions.

    9.1.0release notes

@asteasolutions/zod-to-openapi 816 changes

Breaking changes 1

  • Using z.date now generates date-time instead of date.

    8.3.3release notes

New APIs and options 7

  • Exported OpenApiOptions to resolve a problem when extending an object schema.

    8.4.0release notes

  • Added support for z.json schemas.

    8.4.0release notes

  • Added support for template literals.

    8.4.0release notes

  • Support was added for z.lazy and recursive schemas with getters.

    8.3.0release notes

  • Adds support for the Zod v4 prefault type when generating OpenAPI schemas.

    8.2.0release notes

  • Exposes the getRefId function.

    8.0.0release notes

  • Adds support for Zod v4, including metadata from .meta calls.

    8.0.0release notes

Behavior and default changes 2

  • In simpler scenarios, schemas can be generated using .meta for additional metadata and schema names without calling extendZodWithOpenApi.

    8.0.0release notes

  • Metadata from .meta calls is supported like metadata passed into .openapi, including schema names using the id property.

    8.0.0release notes

Fixes and other changes 6

  • Nested discriminated unions are now allowed, matching support in Zod v4.

    8.5.0release notes

  • Fixed a memory leak when using request parameters with generateDocument().

    8.4.1release notes

  • Fixed a bug in some nested structures when using isAnyZodType with null or undefined.

    8.4.0release notes

  • Adds a null option for nullable enums.

    8.3.3release notes

  • Adds support for conditional oneOf instead of anyOf for unions.

    8.0.0release notes

  • Adds support for the required modifier.

    8.0.0release notes

@asteasolutions/zod-to-openapi 75 changes

Breaking changes 3

  • Support for minimum and maximum values has been removed for BigInt.

    7.0.0release notes

  • Zod tuples use the OpenAPI v3.1.0 prefixItems representation.

    7.0.0release notes

  • BigInt is represented as a string with a digits-only pattern instead of an integer type.

    7.0.0release notes

New APIs and options 1

  • An ESM modules export is available alongside the existing CJS export.

    7.0.0release notes

Behavior and default changes 1

  • ZodObjects using .refine() and .transform are supported in request query, params, headers, and cookies.

    7.0.0release notes