jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
33.98k stars 2.79k forks source link

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

Open ProteanCode opened 4 years ago

ProteanCode commented 4 years ago

🚀 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

github-actions[bot] commented 3 years ago

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

Derewith commented 3 years ago

Reopen this as it's still happening

timgivois commented 3 years ago

I'm also incurring in this issue

Lonolf commented 2 years ago

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