Closed jsprzybylski closed 5 years ago
I'm not sure I understand the bug. Here's example of nested schema validation.
Can you also please fill out the bug report issue template with current / expected behavior? Thanks!
In your example, the error is always empty, even when submitting empty but required values..
This is an issue @jaredpalmer
I have this same issue the errors objects has all the error messages including the outer fields and fields of the nested object. While every other errors error renders successfully, errors for the nested field does not render to the UI, though generated
Nested validation with validation schema seems broken. It's definetly not an issue with yup as the example I've made works fine: https://repl.it/repls/PiercingSevereInformation
After executing Formik's
runValidationSchema
method withyup returns errors, as it should:
runValidations
resolves, and state is set withcombinedErrors
having proper values.this.state.errors
are then passed torender
and it's children get re-rendered, but with no errors for nested fields.Simplyfied implementation of my form:
As you can see I'm using MaterialUI with Formik Material UI.
Snippet from my
package.json
:Another thing is that I've been debugging Formik a little and one thing that I noticed was that Formik's
validateYupSchema
method did not clear values of nested objects (thefor
loop is not recursive). Passingto
validateYupSchema
resulted in generatingthough it didn't seem to have any impact. Maybe it would if nested validation worked properly so it's hard to say. This was mentioned in https://github.com/jaredpalmer/formik/issues/805#issuecomment-415262545
Could someone please provide an example of nested validation?