-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
Is your feature request related to a problem? Please describe.
I want to assert the CSV file header content when I working with NamedCsvRecord.
There is no solution today to assert the header line of the csv file without checking all records.
Describe the solution you'd like
final var handler = NamedCsvRecordHandler.builder()
.expectedHeader("header A", "header B") // proposal
.build();
try (CsvReader<NamedCsvRecord> csvReader = CsvReader.builder()
.build(handler, file.getInputStream())) {
return csvReader.stream()
.map(this.csvRecordMapper::map)
.collect(Collectors.toCollection(LinkedHashSet::new));
}
So add an expectedHeaders List in NamedCsvRecordHandler and use it to validate headers.
Goal alignment
Seems to be aligned : simplify headers verifications without check on all lines without impact performances.
I can do a PR if your are aligned @osiegmar.
Metadata
Metadata
Assignees
Labels
No labels