Skip to content
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

Ability to require specified CSV columns #518

Closed
clamothe opened this issue May 27, 2018 · 2 comments
Closed

Ability to require specified CSV columns #518

clamothe opened this issue May 27, 2018 · 2 comments
Milestone

Comments

@clamothe
Copy link

It would be nice to be able to validate that all expected columns are present in the CSV.

ignorePropertyNotFound fulfills my desire to allow the CSV to contain additional unspecified columns. However, there is no MapperBuilderErrorHandler method called if a defined column is actually missing from the CSV.

I've tried adding all required headers using CsvMapperFactory.addKeys.

@arnaudroger
Copy link
Owner

keys are there for join, the mapper does not require anything to be present at the minute.
it should be might be possible to had a flag on the property to say it's mandatory and fail to build the mapper if that the case. that would look like that.
but the problem is that column name don't have to match exactly the prop name
anyway i'll looked into it.
prob something like

CsvMapperFactory.newInstance().addColumnProperty("foo", MandatoryProperty.INSTANCE);

@clamothe
Copy link
Author

Thanks for your reply. It's worth noting that I have solved this by adding @NotNull annotations to each of my fields, then running Hibernate Validator.

@arnaudroger arnaudroger added this to the 4.0.0 milestone Jun 13, 2018
arnaudroger added a commit that referenced this issue Jun 15, 2018
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

No branches or pull requests

2 participants