frictionlessdata / tableschema-js

A JavaScript library for working with Table Schema.
http://frictionlessdata.io/
MIT License
82 stars 27 forks source link

Update headers check to identify missing fields from the schema #187

Closed paulboony closed 2 years ago

paulboony commented 2 years ago

Overview

When you get this error 'The column header names do not match the field names in the schema', it can be difficult to identify which columns are not matched with the schema, especially if you have a schema/csv with many columns.

Thus, I have updated the header validation to identify missing fields. The TableSchemaError errors are added as nested errors under existing 'The column header names do not match the field names in the schema' error, so existing behaviour is maintained, and you get additional information if needed.


Please preserve this line to notify @roll (lead of this repository)

roll commented 2 years ago

Thanks, @paulboony! @aivuk can you please take a look?

aivuk commented 2 years ago

I think we need to have the option to compare the fields between the schema and the table case sensitive or not, like we did with https://github.com/frictionlessdata/tableschema-js/pull/186. What do you think?

paulboony commented 2 years ago

I think we need to have the option to compare the fields between the schema and the table case sensitive or not, like we did with #186. What do you think?

Yes, I assume https://github.com/frictionlessdata/tableschema-js/pull/186 would get merged first and this PR will join after, keeping caseSensitive option.

codecov[bot] commented 2 years ago

Codecov Report

Merging #187 (ba9f940) into main (37f0224) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #187      +/-   ##
==========================================
+ Coverage   93.14%   93.16%   +0.02%     
==========================================
  Files          35       35              
  Lines         904      907       +3     
==========================================
+ Hits          842      845       +3     
  Misses         62       62              
Impacted Files Coverage Δ
src/table.js 94.73% <100.00%> (+0.08%) :arrow_up:

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more