formik icon indicating copy to clipboard operation
formik copied to clipboard

Improve TypeError exception message if validation schema is passed as plain object

Open ProteanCode opened this issue 5 years ago • 4 comments

🚀 Feature request

Current Behavior

Currently if we pass a simple object as validation object, ie.

{ name: Yup.string().required(), data: { age: Yup.number() } }

We get an error

formik.esm.js:1178 Uncaught TypeError: schema[(intermediate value)(intermediate value)(intermediate value)] is not a function at validateYupSchema (formik.esm.js:1178)

Desired Behavior

A more clear error like Passed validationSchema is not a valid Yup object

ProteanCode avatar Aug 11 '20 09:08 ProteanCode

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days

github-actions[bot] avatar Nov 20 '20 00:11 github-actions[bot]

Reopen this as it's still happening

Derewith avatar May 19 '21 11:05 Derewith

I'm also incurring in this issue

timgivois avatar Jul 02 '21 20:07 timgivois

Same for me: I lost half an hour searching why it was not validating my input

Lonolf avatar Jun 13 '22 13:06 Lonolf