Skip to content

⬆️ Update dependency @asteasolutions/zod-to-openapi to v8 #470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jul 15, 2025

This PR contains the following updates:

Package Change Age Confidence
@asteasolutions/zod-to-openapi 7.3.4 -> 8.0.0 age confidence

Release Notes

asteasolutions/zod-to-openapi (@​asteasolutions/zod-to-openapi)

v8.0.0

Compare Source

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: asteasolutions/zod-to-openapi@v7.3.4...v8.0.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the dependencies Pull requests that update a dependency file label Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants