Skip to content

Releases: asteasolutions/zod-to-openapi

v8.2.0

05 Dec 15:20

Choose a tag to compare

What's Changed

  • (#327 ) feat: support zodv4 prefault new type

Full Changelog: v8.1.0...v8.2.0

v8.1.0

01 Aug 13:06

Choose a tag to compare

What's Changed

  • Improve Zod v4 type compatibility in module augmentation (fixes #321 ) thanks to @YeeP79
  • Add option to sort schemas and parameters (fixes: #312) See more details on how to use it here

Full Changelog: v8.0.0...v8.1.0

v8.0.0

15 Jul 20:37

Choose a tag to compare

Added Zod v4 support 🚀

Support for properties from .meta

With zod's new option for generating JSON schemas and maintaining registries we've added a pretty much seamless support for all metadata information coming from .meta calls as if that was metadata passed into .openapi.

So the following 2 schemas produce exactly the same results:

const schema = z
  .string()
  .openapi('Schema', { description: 'Name of the user', example: 'Test' });

const schema2 = z
  .string()
  .meta({ id: 'Schema2', description: 'Name of the user', example: 'Test' });

Removing extendZodWithOpenApi

This also means that unless you are using some of our more complicated scenarios you could even generate a schema without using extendZodWithOpenApi in your codebase and only rely on .meta to provide additional metadata information and schema names (using the id property).

Where would you still need to use extendZodWithOpenApi and .openapi

  1. When extending registered schemas that are both registered and want the extended one to use anyOf i.e:
const schema = z.object({ name: z.string() }).openapi('Schema');

const schema2 = schema.extend({ age: z.number() }).openapi('Schema2'); // this one would have anyOf and a reference to the first one
  1. Defining parameter metadata. So for example when doing:
registry.registerPath({
  // ...
  request: {
    query: z.object({
      name: z.string().openapi({
        description: 'Schema level description',
        param: { description: 'Param level description' }, 
      }),
    }),
  },
});

the result would be:

  "parameters": [
      {
        "schema": {
          "type": "string",
          "description": "Schema level description" // comes directly from description
        },
        "required": true,
        "description": "Param level description", // comes from param.description
        "name": "name",
        "in": "query"
      }
  ],

What's Changed as well

  • Added support for required modifier (fixes #305)*
  • Added support for conditional oneOf instead of anyOf for unions (fixes #236 and #227). Read more about in the README
  • Exposed a getRefId function (fixes #319)

Full Changelog: v7.3.4...v8.0.0

v7.3.4

13 Jun 14:38

Choose a tag to compare

What's Changed

  • check for missing _internal when extending a non registered schema by @AGalabov in #309 (fixes #297 and #276 )
  • remove omit checks for null and leave only undefined by @AGalabov in #310 (fixes: #283)

Full Changelog: v7.3.3...v7.3.4

v7.3.3

06 Jun 14:41

Choose a tag to compare

Full Changelog: v7.3.2...v7.3.3

Updated README.md

Updated README.md to point users to the 8.0.0-beta version for compatibility with zod v4

v7.3.2 - blank

23 May 13:18

Choose a tag to compare

No changes, but need this to be the latest version since we accidentally published a 7.3.1-beta-zod-v4-2.

Making this release so that people don't end up using the accidentally published one.

v7.3.1-beta-zod-v4-2

23 May 13:04

Choose a tag to compare

v7.3.1-beta-zod-v4-2 Pre-release
Pre-release
Release 7.3.1-beta-zod-v4-2

v7.3.1-beta-zod-v4

23 May 13:01

Choose a tag to compare

v7.3.1-beta-zod-v4 Pre-release
Pre-release

Beta release with support for zod v4

v7.3.0

06 Dec 12:15

Choose a tag to compare

What's Changed

  • README changes
  • Add isDate to string transformer
  • Zod 3.23.8 upgrade
  • #274 allow refs to be passed to response configurations
  • #271 handle instance of and custom required fields

Full Changelog: v7.2.0...v7.3.0

v7.2.0

04 Oct 13:44

Choose a tag to compare

What's Changed

  • #256 added more string formats:
    • .emoji()
    • .cuid()
    • .cuid2()
    • .ulid()
    • .ip()

Full Changelog: v7.1.2...v7.2.0