Skip to content

Incorrect detection of missed columns in header line if columns reordering is enabled #579

@lodik

Description

@lodik

In addition to #285.
I'm expecting CsvMappingException when reading csv file

name,agee
Roger,18

using code

var mapper = new CsvMapper();
var schema = CsvSchema.builder()
  .setUseHeader(true).setReorderColumns(true)
  .with(CsvReadFeature.FAIL_ON_MISSING_HEADER_COLUMNS) //enabled by default
  .addColumn("name").addColumn("age")
  .build();

MappingIterator<Map<String, Object>> it = mapper
  .readerFor(Map.class)
  .with(schema)
  .readValues("""
    name,agee
    Roger,18""");
it.nextValue();

Hovewer, it doesn't throw it, even though the wanted 'age' column is missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions