Skip to content

Latest commit

 

History

History
150 lines (86 loc) · 5.08 KB

File metadata and controls

150 lines (86 loc) · 5.08 KB

zod-openapi

6.0.1

Patch Changes

  • Fix type extension when importing from 'zod'; (#590)

6.0.0

Major Changes

  • Add OpenAPI 3.2.0 support (#585)

    Breaking changes:

    • createDocument now returns oas32.OpenAPIObject instead of oas31.OpenAPIObject.

    New features:

    • Added encoding, prefixEncoding, and itemEncoding support to ZodOpenApiMediaTypeObject via the new ZodOpenApiEncodingObject and ZodOpenApiEncodingPropertyObject types.
    • Added query, additionalOperations, and parameters support to ZodOpenApiPathItemObject.
  • Drop Zod 3 support and Node 20 support. (#587)

    The minimum supported Zod version is now 4.0.0. The minimum supported Node version is now 22.14.0.

5.4.6

Patch Changes

  • #568 a89830a Thanks @samchungy! - Address Zod 4.3+ "cannot be represented in OpenAPI" compatibility issues

5.4.5

Patch Changes

5.4.4

Patch Changes

  • #556 2f8db8a Thanks @samchungy! - Fix crash when generating discriminated union schemas with Zod 4.1.13+

5.4.3

Patch Changes

5.4.2

Patch Changes

5.4.1

Patch Changes

5.4.0

Minor Changes

5.3.1

Patch Changes

5.3.0

Minor Changes

  • c43d544 Thanks @samchungy! - Remove zodSchemas from meta override

    This should result in faster type inference when using .meta().

    zodSchemas is still available in the CreateDocumentOptions override function.

    The mis-scoped Override type is now exported as ZodOpenApiOverride and ZodOpenApiOverrideMeta

Patch Changes

5.2.0

Minor Changes

  • #480 5c3f98a Thanks @samchungy! - Change ZodUndefined behaviour

    This restores how z.undefined() is rendered to pre Zod v3.25.75.

    It is now rendered as:

    {
      "not": {}
    }

    If you want to override this behaviour you can customise this with the override function passed into the createDocument function.

    eg.

    import { createDocument } from 'zod-openapi';
    
    createDocument(
      z.object({
        name: z.undefined().optional(),
      }),
      {
        override: (ctx) => {
          if (ctx.zodSchema._zod.def.type === 'undefined') {
            // This will change the behaviour back to throwing an error
            delete ctx.jsonSchema.not;
          }
        },
      },
    );

5.1.1

Patch Changes

  • 779d22b: Fix ZodAny and ZodUnknown optionals

5.1.0

Minor Changes

  • bfc5754: Allow peer versions of zod: ^4.0.0

  • bfc5754: Expose path in override hook

    This provides context of where the override is being applied, which can be useful when throwing errors

5.0.1

Patch Changes

  • d71fe72: Preserve non Zod schemas