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

247
Views
sí, la validación de prueba evita que se ejecuten otras reglas en el esquema

Tengo una prueba personalizada, pero cuando se implementa dentro de un esquema, detiene todo el esquema, incluso ya tengo abortEarly: true para el esquema en sí.

Definí la prueba así:

 const dateFormatRequired = () => yup .string() .test({ name: 'date-format-bd', message:'Date format should be MM/DD/YYY', test: (value, cotext) => { console.log(value) const dateInList = value.split('-'); const yearHasCorrectDigit = dateInList[0].length === 4; const monthAndDayHasCorrectDigit = dateInList[1].length == 2 && dateInList[2].length == 2; return yearHasCorrectDigit && monthAndDayHasCorrectDigit; }, params: { abortEarly: false } })

Esquema en sí mismo como este:

 const schema = yup.object().shape({ dateOfBirth: dateFormatRequired(), gender: isRequiredOnly, ); schema .validateSync({...some values match my data shape}, { abortEarly: false })

Cuando el dateFormatRequired falló, el error.inner de todo el esquema estará vacío.

¿Alguna sugerencia de cómo puedo depurar esto más o una solución?

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!