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

276
Views
Sí, validación de que solo se requiere un elemento del esquema del objeto

Teniendo el siguiente esquema:

 const schema = yup.object().shape({ val1: yup.string(), val2: yup.string(), val3: yup.string(), val4: yup.string(), val5: yup.string(), val6: yup.string(), val7: yup.string() });

Es una forma de hacer requerido al menos un elemento de esos, ¿no importa cuál?

Hay una solución con un conjunto condicional, pero no parece funcionar para varios elementos, se intentó así:

 const schema = yup.object().shape( { val1: yup.string().when('val2', 'val3', 'val4', 'val5', 'val6', { is: '', then: yup.string(), otherwise: yup.string() }), val2: yup.string().when('val1', 'val3', 'val4', 'val5', 'val6', { is: '', then: yup.string(), otherwise: yup.string() }) ... }, [['val1', 'val2', 'val3', 'val4', 'val5', 'val6']] );
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!