zod
zod copied to clipboard
FEATURE REQUEST: verboseErrors to log out the object when parsing fails
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
How you see expected and received I only see https://github.com/colinhacks/zod/issues/3402.
z.verboseErrors() isn't needed there can be new property like ZodError.data with object given to .parse or .safeParse.