Dynamic ValidationSchema using 'Yup'. #3995
Unanswered
RajuKanaka
asked this question in
Q&A
Replies: 2 comments
-
Moved to discussions. Either use const schema = computed(() => {
if (someThing) {
return schema1;
}
return schema2;
});
// or
const schema = yup.lazy(() => someThing ? schema1 : schema2); If that is what you have been doing then I think this is the correct approach. If you mean "mutate" the schema or edit it directly then it is not possible since yup API is immutable. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Okay, @logaretm. Yes, I'm doing the same thing which you mentioned above. thank you for the Information :). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
now presently I'm using two validation schemas to do dynamic validation.
if there's any way to dynamically change the validation schema.
Describe the solution you'd like
Describe alternatives you've considered
Beta Was this translation helpful? Give feedback.
All reactions