frictionlessdata / tableschema-js

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

Add caseSensitive to Table constructor to schema field names validation #186

Closed aivuk closed 2 years ago

aivuk commented 2 years ago

Base on the bug reported by @paulboony at https://github.com/frictionlessdata/tableschema-js/issues/185 I implemented the option to load a table passing an argument caseSensitive, that will make the check between the table data header names and the field names on the schema case sensitive. For now I left the default as case sensitive, because this is the current tableschema-js behavior.

You can now load a schema for a table not case sensitively as:

const table = await Table.load('data.csv', { schema: 'schema.json', caseSensitive: false })

codecov[bot] commented 2 years ago

Codecov Report

Merging #186 (48170d8) into main (fff9770) will increase coverage by 0.04%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #186      +/-   ##
==========================================
+ Coverage   93.16%   93.20%   +0.04%     
==========================================
  Files          35       35              
  Lines         907      913       +6     
==========================================
+ Hits          845      851       +6     
  Misses         62       62              
Impacted Files Coverage Δ
src/table.js 94.89% <100.00%> (+0.16%) :arrow_up:

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

paulboony commented 2 years ago

Thanks, @aivuk. Can you also add this new caseSensitive option to index.d.ts for typescript support, please? https://github.com/frictionlessdata/tableschema-js/blob/37f02247e0ce35f382ad815121bd64877e9718af/index.d.ts#L16

paulboony commented 2 years ago

@aivuk Who can review this PR to move this along?

aivuk commented 2 years ago

@aivuk Who can review this PR to move this along?

@roll is the one, but this week can be a bit complicate for him to do it.