fast-csv icon indicating copy to clipboard operation
fast-csv copied to clipboard

Make row number available in validator

Open adamreisnz opened this issue 3 years ago • 0 comments

Parsing or Formatting?

  • [ ] Formatting
  • [x] Parsing

Is your feature request related to a problem? Please describe. We'd like to have the row number available in the validate callback, as it would be useful to generate meaningful error messages for the user.

Moreover, it would allow us to construct non-fatal errors with reference to the row number, without failing the entire row.

Describe the solution you'd like Make the row number available as a parameter in the validate callback.

Describe alternatives you've considered I am aware that the row number is available in the data-invalid event, but then there is no way to discriminate whether we want to append it to an error message or not. This logic lives in the validate callback, and for some validation errors we want to append the row number, because there is no other way to identify an item (for example if the name column is empty), whereas in others we don't need the row number.

adamreisnz avatar Jan 17 '22 23:01 adamreisnz