-
Notifications
You must be signed in to change notification settings - Fork 42
Description
This is the csv I uploaded:
template (6).csv
In row 5 there's a mismatch in the fields since it only has 3 data. but the inValidData
returned this:
It says that the rowIndex 4 has the fields mismatch but actually it should be row 5.
It also happened in row 10 and 12 the field mismatch error should be in in row 10 and 12 not 9 and 11.
Here is my config:
const config: ValidatorConfig = {
headers: [
{
name: "First Name",
inputName: "first_name",
required: true,
validate(field) {
return first_name_schema.safeParse(field).success;
},
},
{
name: "Last Name",
inputName: "last_name",
validate(field) {
return last_name_schema.safeParse(field).success;
},
},
{
name: "Phone Number",
inputName: "phone_number",
validate(field) {
return phone_number_schema.safeParse(field).success;
},
dependentValidate(field, row: string[]) {
if (!field && !row[THREE]) {
return false;
}
return true;
},
},
{
name: "Email Address",
inputName: "email_address",
validate(field) {
return email_address_schema.safeParse(field).success;
},
dependentValidate(field, row: string[]) {
if (!field && !row[TWO]) {
return false;
}
return true;
},
},
],
};
`