-
-
Notifications
You must be signed in to change notification settings - Fork 150
Missing columns from header line (compare to CsvSchema
) not detected when reordering columns (add CsvParser.Feature.FAIL_ON_MISSING_HEADER_COLUMNS
)
#285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The same thing is true of the strict headers feature. I really don't care about the order of the columns, or any additional ones, I just care that the ones I want are present. This should be a common requirement it is a shame it cannot be enforced |
There is also no way to have an error if a column name is repeated in the header when reordering is in use. It silently chooses one. |
I have hoped to look into this for a while now but for past 3 months my paying job has taken over almost all of my coding time, since I do not get paid to work on Jackson (not part of my daytime job). So, @mamos-helloself PRs would obviously be welcome. I may be able to at least add the failing test soon now tho. |
Hmmh. Looking at this now I wonder if the reason is due to "use header" -- header really only has 1 column and if that is to be considered authoritative, there is nothing missing? I'll have to look into this more and will first add a failing test just to reproduce what is seen here. |
The one column example was probably to simple.
doesn't throw a |
Sorry I misunderstood your last comment, but the example is valid. |
My daily use case has 3 requirements
Is there a real chance that this issue will be fixed? |
Yes, if and when someone has time to look into it. I have been hoping to address it but I am hopelessly swamped at work and helping others with PRs with Jackson, releases all that stuff. It is likely that for this to move in near future, a PR would be needed. On plus side, as per my earlier comment, a failing test is now included in repo (has to be run via IDE, excluded from default test run). |
Hmmm. I suspect that the issue is with the actual header line only having one column, and thereby "extra" columns of
I think I'll proceed with (2), although I wonder if some configurability might be needed anyway, to alter behavior. And yes, I am finally circling back here, hoping to resolve this for 2.14(.0). EDIT: re-reading full discussion, it does sound like (1) is what is wanted actually. |
Ok: changed the behavior to optionally throw an exception if column headers are missing (compared to registered CsvParser.Feature.FAIL_ON_MISSING_HEADER_COLUMNS which defaults to Will be in 2.14.0 release |
CsvSchema
) not detected when reordering columns (add CsvParser.Feature.FAIL_ON_MISSING_HEADER_COLUMNS
)
Perhaps I'm misunderstanding something, but I'm not seeing anywhere in which the new |
I.e., should there be something like this?
|
When reading given CSV with jackson-dataformat-csv 2.11.4
using following snippet
doesn't throw a
CsvMappingException
althoughage
column is missing in CSV.The text was updated successfully, but these errors were encountered: