#Nested fields validation with yup?

2 messages · Page 1 of 1 (latest)

brisk dock
#

Hey, I know that this part of the documention exists, but there's nothing about yup there. I though that just having an array.of(myCustomObjectSchemaHere) and then using yupResolver on useForm would work, but no luck here, it just doesn't validate the form at all with that. It works fine when having something like this:

  validate: {
    user: {
      name: (value) => (value.length < 2 ? 'Name is too short' : null),
      occupation: (value) => (value.length < 2 ? 'Occupation is too short' : null),
    },
  },
brisk dock
#

This is how my errors object looks like:

{
  "users": {
    ".4.email": "This is required field"
  }
}```

I'm not sure what's wrong with this