Skip to content
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

FEATURE REQUEST: verboseErrors to log out the object when parsing fails #3399

Open
capaj opened this issue Apr 15, 2024 · 2 comments
Open

FEATURE REQUEST: verboseErrors to log out the object when parsing fails #3399

capaj opened this issue Apr 15, 2024 · 2 comments

Comments

@capaj
Copy link

capaj commented Apr 15, 2024

please give me an ability to globally enable to console error the whole object which failed validation. Currently it logs out only the validation error like this:

  {
    "expected": "'equals' | 'contains' | 'icontains' | 'javascript' | 'LLM'",
    "received": "undefined",
    "code": "invalid_type",
    "path": [
      "type"
    ],
    "message": "Required"
  }
]

every time I am debugging this I typically need to go in and log it out this myself.
Ideal API would be something like

z.verboseErrors()

this would apply to both regular and safeParse ideally

@cdtut
Copy link

cdtut commented Apr 16, 2024

How you see expected and received I only see #3402.

@cdtut
Copy link

cdtut commented Apr 17, 2024

z.verboseErrors() isn't needed there can be new property like ZodError.data with object given to .parse or .safeParse.

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

No branches or pull requests

2 participants