Skip to content

closes #4850: fix non informative error output for bad meta field when using z.prettifyError on parsed z.union schema#4870

Open
vladavoX wants to merge 1 commit into
shuding:mainfrom
vladavoX:fix-schema-z-prettifyError
Open

closes #4850: fix non informative error output for bad meta field when using z.prettifyError on parsed z.union schema#4870
vladavoX wants to merge 1 commit into
shuding:mainfrom
vladavoX:fix-schema-z-prettifyError

Conversation

@vladavoX

@vladavoX vladavoX commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Why:

Closes: #4850

What's being changed (if available, include any code snippets, screenshots, or gifs):

I've made the same safeParse checks, just for each type, one by one, thus the prettify can do its thing since parse response is not from union. This is how it looks with fix.

image

z.prettifyError doesn't work well with unions, because it is reporting ton of issues for each union it checks, here is a simple example, where it just pulls out the message: Invalid input at the end (same issue as here):

image

Check off the following:

  • I have reviewed my changes in staging, available via the View
    deployment
    link in this PR's timeline (this link will be available after
    opening the PR).

@changeset-bot

changeset-bot Bot commented Dec 9, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4ccd1ef

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
nextra Patch
nextra-theme-blog Patch
nextra-theme-docs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Dec 9, 2025

Copy link
Copy Markdown

@vladavoX is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Dec 9, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
nextra-v2 Ready Ready Preview Comment Dec 9, 2025 8:34pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cryptic error output when _meta.js doesn't conform to zod shape

1 participant