Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
Rename yup error key based on other value

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!