You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I am wondering if there is a way to only run the async validations at mixed.test() only after all other validations are successful.
Scenario
I have a schema that for the email path, has .email(), .required() and .test() validations. I want the .test() validation to run only if the other two validations are correct. On that way, I won't send an empty or invalid email to my asynchronous validation function.
Schema
constschema=yup.object().shape({firstName: yup.string().required(),lastName: yup.string().required(),email: yup.string().email().required().test('is-incorrect','${path} should be hi@kevinwolf.me',asyncvalue=>{console.log('running async validations')awaitsleep(1)returnvalue==='hi@kevinwolf.me'}),})
This is not currently possible because all validations are run at the same time to maintain performance. There have been a number of other requests for this as well. For example, this is a similar request: #256.
I am in favor of there being some way to handle some or all validations in some order/sequence.
The problem
Hello. I am wondering if there is a way to only run the async validations at
mixed.test()
only after all other validations are successful.Scenario
I have a schema that for the
email
path, has.email()
,.required()
and.test()
validations. I want the.test()
validation to run only if the other two validations are correct. On that way, I won't send an empty or invalid email to my asynchronous validation function.Schema
Validations
This shouldn't log anything to the console
This should
The text was updated successfully, but these errors were encountered: