Support validation against unknown columns
Brought to you by:
aruckerjones,
sconway
I am using header name annotations.
Would it be possible to only allow known headers? i.e. headers annotated in bean class as either required or optional
From prod observations, unknown headers are user input errors, and ideally opencsv can validate against that input.
If thats not supported, can you provide guidance on where to inject custom validation?
FWIW, I ended up adding a custom mapping strategy
Gordon I am sorry it took so long to respond but life has been busy.
The functionality you want is in the HeaderColumnNameTranslateMappingStrategy.
If you look at the test code (either by downloading it or going to https://opencsv.sourceforge.net/xref-test/index.html) look at HeaderColumnNameTranslateMappingStrategyTest at the onlyConvertWhatIsInTheMap test.
Hope that helps!
Scott :)