I have this weird construction where I have an array of many arrays with a single object of some certain shape inside, and I am not able to validate it, it allows for the empty first array no matter what, please have a look a this construct and tell me what I am doing wrong
yup.array().of(
yup
.array()
.length(1)
.of(
yup.object().shape({
from: yup.string(),
to: yup.string(),
duration: yup.object().shape({
h: yup.number().nullable(),
m: yup.number().nullable()
}),
dates: yup.array().of(yup.string()),
weekDaysWithTime: yup.array().of(
yup.object().shape({
day: yup.string(),
time: yup.object().shape({
h: yup.number().nullable(),
m: yup.number().nullable()
})
})
)
})
)
)
the shape I need to validate is basically
[
[{}],[{}],[{}]
]
and it allows for just one outer empty array [] to be validated.
Many thanks