I have an array of objects which contain the same values including locale.
Locale is a language: en, de
I have this schema:
descriptions: yup.object().shape({
data: yup.array().of(
yup.object().shape({
name: yup.string().required('required'),
locale: yup.string().oneOf(['de', 'en']),
})
),
})
I want to get errors returned like this:
{ descriptions: { data: [{ name_en:"required"}, ...] } }
I tried to do it with .label() but, it returns the same key or I'm doing it wrong.
Also I tried with transformKeys like this:
.transformKeys(key => `${key}_something`)
Even if this works, I still need access to the locale value