When CSVW schema contains "datatype": "number" in column definition, the values should be validated as numbers
Current Behaviour (for problems)
csvlint crashes with:
NOTE: Csvlint::Schema.load_from_json is deprecated; use load_from_uri instead. It will be removed on or after 2018-01-01.
Csvlint::Schema.load_from_json called from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/cli.rb:59.
./var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/csvw/number_format.rb:178:in `parse': undefined method `gsub!' for 1.0:Float (NoMethodError)
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/csvw/column.rb:265:in `block in <class:Column>'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/csvw/column.rb:105:in `block in validate'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/csvw/column.rb:103:in `each'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/csvw/column.rb:103:in `validate'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/csvw/table.rb:64:in `block in validate_row'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/csvw/table.rb:64:in `map'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/csvw/table.rb:64:in `validate_row'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/csvw/table_group.rb:38:in `validate_row'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/validate.rb:200:in `parse_contents'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/validate.rb:166:in `validate_line'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/validate.rb:146:in `parse_line'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/validate.rb:110:in `block in validate_stream'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/validate.rb:108:in `each_line'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/validate.rb:108:in `validate_stream'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/validate.rb:101:in `validate'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/validate.rb:86:in `initialize'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/cli.rb:141:in `new'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/cli.rb:141:in `validate_csv'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/cli.rb:86:in `block in fetch_schema_tables'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/cli.rb:79:in `each'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/cli.rb:79:in `fetch_schema_tables'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/lib/csvlint/cli.rb:22:in `validate'
from /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
from /var/lib/gems/2.3.0/gems/csvlint-0.4.0/bin/csvlint:9:in `<top (required)>'
from /usr/local/bin/csvlint:23:in `load'
from /usr/local/bin/csvlint:23:in `<main>'
VOLKRAJ,KSTRANA,PORCISLO,JMENO,PRIJMENI,TITULPRED,TITULZA,VEK,POVOLANI,BYDLISTEN,BYDLISTEK,PSTRANA,NSTRANA,PLATNOST,POCHLASU,POCPROC,POCPROCVSE,MANDAT,PORADIMAND,PORADINAHR
1,1,1,"Jana","Černochová","Mgr.","",43,"starostka MČ Praha 2","Praha",1,53,53,"A",,,,"",,
Download above to test.json and test.csv
Run csvlint -s test.json
Your Environment
Bash on Ubuntu on Windows, csvlint installed using gem install csvlint
Expected Behaviour
When CSVW schema contains
"datatype": "number"
in column definition, the values should be validated as numbersCurrent Behaviour (for problems)
csvlint crashes with:
Steps to Reproduce (for problems)
CSVW schema:
CSV:
test.json
andtest.csv
csvlint -s test.json
Your Environment
Bash on Ubuntu on Windows, csvlint installed using
gem install csvlint