Skip to content

Per-row validation #1112

@sosherof

Description

@sosherof

I'm not sure if this is already available but something to consider for V6 is a per-row validation callback. What I'd like to do is get the row data, as an object with keys if header: true or indexes if not, and be able to return true if the row is good or an error reason if it's garbage. This allows the errors to be handled in one place (vs detecting errors returned by the parser and then having to iterate, remove bad rows, and handle that errors list separately).

I'm trying to decide if it would be better for this callback to happen before or after transforms. Either way works for my use but maybe that could be configurable.

{
    rowValidation: (rowData) => {
        if (rowData['column1'].trim().length != 10)
            return 'Column 1 incorrect length';

        return true;
    },
    rowValidationPostTransform: true
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions