Skip to content

Conversation

@tilo
Copy link
Owner

@tilo tilo commented Dec 16, 2023

  1. Refactoring of Code and Tests

  2. Performance Improvements

  3. Previous versions of SmarterCSV applied some header transformations when user_provided_headers were provided.

This legacy behavior does not make much sense, because when user_provided_headers are given, we can assume they are correct, and should be used as-is.

For the unlikely scenario that incorrect user_provided_headers were given, the legacy code attempted to disambiguate them, by applying a suffix.

  1. Previously strings_as_keys transformations were applied to user_provided_headers

This legacy behavior does not make much sense, because when user_provided_headers are given, we can assume they are correct, and should be used as-is.

BREAKING CHANGES:

  • when user_provided_headers are provided:

    • if they are not unique, an exception will now be raised
    • they are taken "as is", no header transformations can be applied
    • when they are given as strings or as symbols, it is assumed that this is the desired format
    • the value of the strings_as_keys options will be ignored
  • option duplicate_header_suffix now defaults to '' instead of nil.

    • this allows automatic disambiguation when processing of CSV files with duplicate headers, by appending a number
    • explicitly set this option to nil to get the behavior from previous versions.

@tilo tilo merged commit 90f3dc1 into main Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants