YUP Validation for string and Array
purposeTypes: Yup.lazy(() => {
if (this.state.isMLPurposeTypes) {
return Yup.string().notRequired();
}
return Yup.array().min(1, 'Select Asset Type');
}),
decisionFlowValidationSchema = Yup.object().shape({
flowDescription: Yup.string().required('Flow Description can not be blank'),
appType: Yup.string().required('Select App Type'),
isSinglePaymentLoan: Yup.string().required('Select Single Payment Loan'),
calculateBasedOn: Yup.lazy(() => {
if (this.state.isCalculateBasedOnHidden) {
return Yup.string().notRequired();
}
return Yup.string().required('Select Calculate Based On');
}),
assetTypes: Yup.lazy(() => {
if (this.state.isHEVLAssetType) {
return Yup.array().min(1, 'Select Asset Type');
}
return Yup.array().notRequired();
}),
purposeTypes: Yup.lazy(() => {
if (this.state.isMLPurposeTypes) {
return Yup.array().notRequired();
}
return Yup.array().min(1, 'Select Asset Type');
}),
});
Comments
Post a Comment