You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like code does not currently check that the column names included in the header line are unique; meaning that one name may be occur more than once, and in that case the last one is used.
This should not be allowed: column names in header line should not have duplicates.
The text was updated successfully, but these errors were encountered:
It worked fine. Pay attention to the aliases, because there are several possible variations.
And one day, their schema changed, adding another column "ID".
The csv files could be like this:
ID,Name,ID
1,"Bob","UA2940"
2,"David","IM3592"
Although there are now two columns named "ID", we can tell the difference.
We know exactly what the new column means.
Now we want the schema to be like this:
This will cause exceptions. "ID" will always map to "IdNumber", but the new column is not int type.
Because there are two duplicated columns, now the order of the headers matters.
We have given the order, hoping it would take effect, but it didn't.
The schema of the headers is out of our control. We can only adapt to it.
Now we could only preprocess the header in advance, renaming those conflict column names.
Is there any better solution to this situation?
As jackson csv is a library for general purposes, I don't think the order of the headers should be totally ignored.
There should be some elegant way to support this.
BTW, we are using jackson-dataformat-csv-2.10.3, which is not the latest version.
I'm going to catch up with new changes and see.
Sorry, we met this issue because we incorrectly used mapper.schemaWithHeader(). After changing it to mapper.schemaFor(xxx), our class with annotation worked fine for the case I described.
(note: offshoot of a comment in #285)
It looks like code does not currently check that the column names included in the header line are unique; meaning that one name may be occur more than once, and in that case the last one is used.
This should not be allowed: column names in header line should not have duplicates.
The text was updated successfully, but these errors were encountered: