csvlint 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +139 -3
- data/Gemfile +1 -1
- data/lib/csvlint/schema.rb +1 -2
- data/lib/csvlint/validate.rb +0 -1
- data/lib/csvlint/version.rb +1 -1
- data/spec/schema_spec.rb +33 -31
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTcwMjkzODNkNWM4ZDg1ZjU2MjQzZjdhYzJhNDE0OGFlZWZmMjQ0ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2I0YWJjYzgzM2UxZDk1ODdkY2M0ZTRmNGU2ZDI3ZGNhMTgxNGFiMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDM5MmU5MDEwNjQyOWFlMGUwNWFmNGNjNTc0YTU4NmE0ZWY2YjMyMDRkODY2
|
10
|
+
NmIyODJhMzEyOGIyYjlkMTQwM2FhYjJmNzU3NGVjY2E3OTgyMjg0NWRkZGEx
|
11
|
+
YzU1MjAyYjJhYzUxNGFmZTc2YmVkYjQ0MjI3ZjdkZmNlYzJkZjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzVjNWU4MDFjYWEyNWNhNWY0OGM3NTUxNmU4MzAxZTYwMGYyZTBiOTdmYzhl
|
14
|
+
MmJiNWM0OTQ0YWRlZWY3MDAyN2RjN2RmMWIyNTk5NWJlODgwZDVkODUwN2E0
|
15
|
+
NTJlYjMxNTg5Y2I4ZDcyNzUyN2EzNjNkNmRiOTRiMzlkOTdhZjg=
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,15 @@
|
|
2
2
|
|
3
3
|
## [Unreleased](https://github.com/theodi/csvlint.rb/tree/HEAD)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.1.
|
5
|
+
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.1.3...HEAD)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- change made to the constraint parameter in order that it is more cons… [\#140](https://github.com/theodi/csvlint.rb/pull/140) ([quadrophobiac](https://github.com/quadrophobiac))
|
10
|
+
|
11
|
+
## [0.1.3](https://github.com/theodi/csvlint.rb/tree/0.1.3) (2015-07-24)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.1.2...0.1.3)
|
6
14
|
|
7
15
|
**Merged pull requests:**
|
8
16
|
|
@@ -64,8 +72,6 @@
|
|
64
72
|
|
65
73
|
- fix coveralls stats [\#109](https://github.com/theodi/csvlint.rb/pull/109) ([Floppy](https://github.com/Floppy))
|
66
74
|
|
67
|
-
- Speed up \#build\_formats \(changes its API\) [\#103](https://github.com/theodi/csvlint.rb/pull/103) ([jpmckinney](https://github.com/jpmckinney))
|
68
|
-
|
69
75
|
- Limit lines [\#101](https://github.com/theodi/csvlint.rb/pull/101) ([Hoedic](https://github.com/Hoedic))
|
70
76
|
|
71
77
|
## [0.1.0](https://github.com/theodi/csvlint.rb/tree/0.1.0) (2014-11-27)
|
@@ -130,8 +136,138 @@
|
|
130
136
|
|
131
137
|
**Merged pull requests:**
|
132
138
|
|
139
|
+
- Speed up \#build\_formats \(changes its API\) [\#103](https://github.com/theodi/csvlint.rb/pull/103) ([jpmckinney](https://github.com/jpmckinney))
|
140
|
+
|
133
141
|
- Continuously deploy gem [\#102](https://github.com/theodi/csvlint.rb/pull/102) ([pezholio](https://github.com/pezholio))
|
134
142
|
|
143
|
+
- Make csvlint way faster [\#99](https://github.com/theodi/csvlint.rb/pull/99) ([jpmckinney](https://github.com/jpmckinney))
|
144
|
+
|
145
|
+
- Update README.md [\#98](https://github.com/theodi/csvlint.rb/pull/98) ([rmalecky](https://github.com/rmalecky))
|
146
|
+
|
147
|
+
- Undeclared header error [\#95](https://github.com/theodi/csvlint.rb/pull/95) ([Floppy](https://github.com/Floppy))
|
148
|
+
|
149
|
+
- Blank values shouldn't count as inconsistencies [\#91](https://github.com/theodi/csvlint.rb/pull/91) ([pezholio](https://github.com/pezholio))
|
150
|
+
|
151
|
+
- Use `reject` instead of `delete\_if` [\#89](https://github.com/theodi/csvlint.rb/pull/89) ([pezholio](https://github.com/pezholio))
|
152
|
+
|
153
|
+
- Raise a warning if a title row is found [\#88](https://github.com/theodi/csvlint.rb/pull/88) ([pezholio](https://github.com/pezholio))
|
154
|
+
|
155
|
+
- Improve executable [\#86](https://github.com/theodi/csvlint.rb/pull/86) ([pezholio](https://github.com/pezholio))
|
156
|
+
|
157
|
+
- Feature undeclared header [\#83](https://github.com/theodi/csvlint.rb/pull/83) ([ldodds](https://github.com/ldodds))
|
158
|
+
|
159
|
+
- Support xsd:integer [\#82](https://github.com/theodi/csvlint.rb/pull/82) ([ldodds](https://github.com/ldodds))
|
160
|
+
|
161
|
+
- Downgrade header errors [\#81](https://github.com/theodi/csvlint.rb/pull/81) ([ldodds](https://github.com/ldodds))
|
162
|
+
|
163
|
+
- Go home, pry [\#78](https://github.com/theodi/csvlint.rb/pull/78) ([pikesley](https://github.com/pikesley))
|
164
|
+
|
165
|
+
- Use type validations to check consistency [\#77](https://github.com/theodi/csvlint.rb/pull/77) ([pezholio](https://github.com/pezholio))
|
166
|
+
|
167
|
+
- Add data accessor [\#76](https://github.com/theodi/csvlint.rb/pull/76) ([Floppy](https://github.com/Floppy))
|
168
|
+
|
169
|
+
- Add failed constraints to schema errors [\#75](https://github.com/theodi/csvlint.rb/pull/75) ([ldodds](https://github.com/ldodds))
|
170
|
+
|
171
|
+
- Only perform ragged row check if there's no schema [\#74](https://github.com/theodi/csvlint.rb/pull/74) ([ldodds](https://github.com/ldodds))
|
172
|
+
|
173
|
+
- Handle tempfiles [\#73](https://github.com/theodi/csvlint.rb/pull/73) ([pezholio](https://github.com/pezholio))
|
174
|
+
|
175
|
+
- Catch errors if regex doesn't match [\#72](https://github.com/theodi/csvlint.rb/pull/72) ([pezholio](https://github.com/pezholio))
|
176
|
+
|
177
|
+
- Inconsistent column base [\#70](https://github.com/theodi/csvlint.rb/pull/70) ([ldodds](https://github.com/ldodds))
|
178
|
+
|
179
|
+
- include column name in :header\_name message [\#68](https://github.com/theodi/csvlint.rb/pull/68) ([Floppy](https://github.com/Floppy))
|
180
|
+
|
181
|
+
- Record default dialect [\#67](https://github.com/theodi/csvlint.rb/pull/67) ([pezholio](https://github.com/pezholio))
|
182
|
+
|
183
|
+
- Schema validation message improvements [\#65](https://github.com/theodi/csvlint.rb/pull/65) ([Floppy](https://github.com/Floppy))
|
184
|
+
|
185
|
+
- Fix ignore empty fields [\#62](https://github.com/theodi/csvlint.rb/pull/62) ([ldodds](https://github.com/ldodds))
|
186
|
+
|
187
|
+
- Create stub schema from existing CSV file [\#61](https://github.com/theodi/csvlint.rb/pull/61) ([ldodds](https://github.com/ldodds))
|
188
|
+
|
189
|
+
- Validate dates [\#59](https://github.com/theodi/csvlint.rb/pull/59) ([ldodds](https://github.com/ldodds))
|
190
|
+
|
191
|
+
- add schema access from validator [\#58](https://github.com/theodi/csvlint.rb/pull/58) ([Floppy](https://github.com/Floppy))
|
192
|
+
|
193
|
+
- Allow schema and fields to have title and description [\#57](https://github.com/theodi/csvlint.rb/pull/57) ([ldodds](https://github.com/ldodds))
|
194
|
+
|
195
|
+
- Feature min max ranges [\#56](https://github.com/theodi/csvlint.rb/pull/56) ([ldodds](https://github.com/ldodds))
|
196
|
+
|
197
|
+
- Check header without schema [\#54](https://github.com/theodi/csvlint.rb/pull/54) ([ldodds](https://github.com/ldodds))
|
198
|
+
|
199
|
+
- Validate types [\#53](https://github.com/theodi/csvlint.rb/pull/53) ([pikesley](https://github.com/pikesley))
|
200
|
+
|
201
|
+
- Added open\_uri\_redirections to allow HTTP/HTTPS transfers [\#52](https://github.com/theodi/csvlint.rb/pull/52) ([ldodds](https://github.com/ldodds))
|
202
|
+
|
203
|
+
- Added docs on CSV options and header error/warning messages [\#51](https://github.com/theodi/csvlint.rb/pull/51) ([ldodds](https://github.com/ldodds))
|
204
|
+
|
205
|
+
- Feature header validation [\#50](https://github.com/theodi/csvlint.rb/pull/50) ([ldodds](https://github.com/ldodds))
|
206
|
+
|
207
|
+
- Handle unique columns [\#49](https://github.com/theodi/csvlint.rb/pull/49) ([pikesley](https://github.com/pikesley))
|
208
|
+
|
209
|
+
- Validate all the fields [\#47](https://github.com/theodi/csvlint.rb/pull/47) ([ldodds](https://github.com/ldodds))
|
210
|
+
|
211
|
+
- Tolerate incomplete schemas [\#46](https://github.com/theodi/csvlint.rb/pull/46) ([ldodds](https://github.com/ldodds))
|
212
|
+
|
213
|
+
- Add accessor for line breaks [\#45](https://github.com/theodi/csvlint.rb/pull/45) ([Floppy](https://github.com/Floppy))
|
214
|
+
|
215
|
+
- update README for info messages and new error types [\#44](https://github.com/theodi/csvlint.rb/pull/44) ([Floppy](https://github.com/Floppy))
|
216
|
+
|
217
|
+
- Info messages for line breaks [\#43](https://github.com/theodi/csvlint.rb/pull/43) ([Floppy](https://github.com/Floppy))
|
218
|
+
|
219
|
+
- Add category to messages [\#40](https://github.com/theodi/csvlint.rb/pull/40) ([ldodds](https://github.com/ldodds))
|
220
|
+
|
221
|
+
- Badges [\#39](https://github.com/theodi/csvlint.rb/pull/39) ([pikesley](https://github.com/pikesley))
|
222
|
+
|
223
|
+
- Generic field validation using JSON Table Schema [\#38](https://github.com/theodi/csvlint.rb/pull/38) ([ldodds](https://github.com/ldodds))
|
224
|
+
|
225
|
+
- Feature validate strings and files [\#37](https://github.com/theodi/csvlint.rb/pull/37) ([ldodds](https://github.com/ldodds))
|
226
|
+
|
227
|
+
- Support reporting of column number in errors [\#36](https://github.com/theodi/csvlint.rb/pull/36) ([ldodds](https://github.com/ldodds))
|
228
|
+
|
229
|
+
- Fix up casing of keys in CSV DDF options [\#35](https://github.com/theodi/csvlint.rb/pull/35) ([ldodds](https://github.com/ldodds))
|
230
|
+
|
231
|
+
- Add errors for incorrect newlines [\#34](https://github.com/theodi/csvlint.rb/pull/34) ([pezholio](https://github.com/pezholio))
|
232
|
+
|
233
|
+
- Change from parsing CSV line by line to using CSV.new and trapping errors [\#33](https://github.com/theodi/csvlint.rb/pull/33) ([ldodds](https://github.com/ldodds))
|
234
|
+
|
235
|
+
- Improved the README, tweaked LICENSE [\#28](https://github.com/theodi/csvlint.rb/pull/28) ([ldodds](https://github.com/ldodds))
|
236
|
+
|
237
|
+
- Handle 404s [\#26](https://github.com/theodi/csvlint.rb/pull/26) ([pezholio](https://github.com/pezholio))
|
238
|
+
|
239
|
+
- Create more fine-grained errors and warnings for content type issues [\#25](https://github.com/theodi/csvlint.rb/pull/25) ([ldodds](https://github.com/ldodds))
|
240
|
+
|
241
|
+
- Report trailing empty rows as an error. Previously threw exception [\#24](https://github.com/theodi/csvlint.rb/pull/24) ([ldodds](https://github.com/ldodds))
|
242
|
+
|
243
|
+
- Simplify the guessing of column types [\#22](https://github.com/theodi/csvlint.rb/pull/22) ([ldodds](https://github.com/ldodds))
|
244
|
+
|
245
|
+
- Class-ify error messages [\#21](https://github.com/theodi/csvlint.rb/pull/21) ([pezholio](https://github.com/pezholio))
|
246
|
+
|
247
|
+
- Error extracts [\#20](https://github.com/theodi/csvlint.rb/pull/20) ([Floppy](https://github.com/Floppy))
|
248
|
+
|
249
|
+
- Return headers [\#19](https://github.com/theodi/csvlint.rb/pull/19) ([pezholio](https://github.com/pezholio))
|
250
|
+
|
251
|
+
- Return a warning if no character set specified [\#18](https://github.com/theodi/csvlint.rb/pull/18) ([pezholio](https://github.com/pezholio))
|
252
|
+
|
253
|
+
- Ignore query params [\#17](https://github.com/theodi/csvlint.rb/pull/17) ([Floppy](https://github.com/Floppy))
|
254
|
+
|
255
|
+
- Add invalid\_encoding error for invalid byte sequences [\#16](https://github.com/theodi/csvlint.rb/pull/16) ([ldodds](https://github.com/ldodds))
|
256
|
+
|
257
|
+
- Check inconsistent values [\#13](https://github.com/theodi/csvlint.rb/pull/13) ([pezholio](https://github.com/pezholio))
|
258
|
+
|
259
|
+
- Add CSV dialect options [\#11](https://github.com/theodi/csvlint.rb/pull/11) ([pezholio](https://github.com/pezholio))
|
260
|
+
|
261
|
+
- Return warning if extension doesn't match content type [\#10](https://github.com/theodi/csvlint.rb/pull/10) ([pezholio](https://github.com/pezholio))
|
262
|
+
|
263
|
+
- Return warnings for file extension [\#8](https://github.com/theodi/csvlint.rb/pull/8) ([pezholio](https://github.com/pezholio))
|
264
|
+
|
265
|
+
- Detect blank rows [\#7](https://github.com/theodi/csvlint.rb/pull/7) ([pezholio](https://github.com/pezholio))
|
266
|
+
|
267
|
+
- Detect bad content type [\#3](https://github.com/theodi/csvlint.rb/pull/3) ([pezholio](https://github.com/pezholio))
|
268
|
+
|
269
|
+
- Return information about CSV [\#1](https://github.com/theodi/csvlint.rb/pull/1) ([pezholio](https://github.com/pezholio))
|
270
|
+
|
135
271
|
|
136
272
|
|
137
273
|
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile
CHANGED
data/lib/csvlint/schema.rb
CHANGED
@@ -20,9 +20,8 @@ module Csvlint
|
|
20
20
|
found_header = header.to_csv(:row_sep => '')
|
21
21
|
expected_header = @fields.map{ |f| f.name }.to_csv(:row_sep => '')
|
22
22
|
if found_header != expected_header
|
23
|
-
build_warnings(:malformed_header, :schema, 1, nil, found_header, expected_header)
|
23
|
+
build_warnings(:malformed_header, :schema, 1, nil, found_header, "expectedHeader" => expected_header)
|
24
24
|
end
|
25
|
-
|
26
25
|
return valid?
|
27
26
|
end
|
28
27
|
|
data/lib/csvlint/validate.rb
CHANGED
data/lib/csvlint/version.rb
CHANGED
data/spec/schema_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Csvlint::Schema do
|
4
|
-
|
4
|
+
|
5
5
|
it "should tolerate missing fields" do
|
6
6
|
schema = Csvlint::Schema.from_json_table("http://example.org", {})
|
7
7
|
expect( schema ).to_not be(nil)
|
@@ -16,28 +16,28 @@ describe Csvlint::Schema do
|
|
16
16
|
expect( schema.fields[0].name ).to eql("test")
|
17
17
|
expect( schema.fields[0].constraints ).to eql({})
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
it "should validate against the schema" do
|
21
21
|
field = Csvlint::Field.new("test", { "required" => true } )
|
22
22
|
field2 = Csvlint::Field.new("test", { "minLength" => 3 } )
|
23
23
|
schema = Csvlint::Schema.new("http://example.org", [field, field2] )
|
24
|
-
|
24
|
+
|
25
25
|
expect( schema.validate_row( ["", "x"] ) ).to eql(false)
|
26
26
|
expect( schema.errors.size ).to eql(2)
|
27
27
|
expect( schema.errors.first.type).to eql(:missing_value)
|
28
28
|
expect( schema.errors.first.category).to eql(:schema)
|
29
29
|
expect( schema.errors.first.column).to eql(1)
|
30
30
|
expect( schema.validate_row( ["abc", "1234"] ) ).to eql(true)
|
31
|
-
|
31
|
+
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
it "should include validations for missing columns" do
|
35
35
|
minimum = Csvlint::Field.new("test", { "minLength" => 3 } )
|
36
36
|
required = Csvlint::Field.new("test2", { "required" => true } )
|
37
37
|
schema = Csvlint::Schema.new("http://example.org", [minimum, required] )
|
38
|
-
|
38
|
+
|
39
39
|
expect( schema.validate_row( ["abc", "x"] ) ).to eql(true)
|
40
|
-
|
40
|
+
|
41
41
|
expect( schema.validate_row( ["abc"] ) ).to eql(false)
|
42
42
|
expect( schema.errors.size ).to eql(1)
|
43
43
|
expect( schema.errors.first.type).to eql(:missing_value)
|
@@ -45,9 +45,9 @@ describe Csvlint::Schema do
|
|
45
45
|
schema = Csvlint::Schema.new("http://example.org", [required, minimum] )
|
46
46
|
expect( schema.validate_row( ["abc"] ) ).to eql(false)
|
47
47
|
expect( schema.errors.size ).to eql(1)
|
48
|
-
expect( schema.errors.first.type).to eql(:min_length)
|
48
|
+
expect( schema.errors.first.type).to eql(:min_length)
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
it "should warn if the data has fewer columns" do
|
52
52
|
minimum = Csvlint::Field.new("test", { "minLength" => 3 } )
|
53
53
|
required = Csvlint::Field.new("test2", { "maxLength" => 5 } )
|
@@ -60,10 +60,10 @@ describe Csvlint::Schema do
|
|
60
60
|
expect( schema.warnings.first.row).to eql(1)
|
61
61
|
expect( schema.warnings.first.column).to eql(2)
|
62
62
|
|
63
|
-
#no ragged row error
|
63
|
+
#no ragged row error
|
64
64
|
expect( schema.errors.size ).to eql(0)
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
it "should warn if the data has additional columns" do
|
68
68
|
minimum = Csvlint::Field.new("test", { "minLength" => 3 } )
|
69
69
|
required = Csvlint::Field.new("test2", { "required" => true } )
|
@@ -79,19 +79,19 @@ describe Csvlint::Schema do
|
|
79
79
|
expect( schema.warnings[1].type).to eql(:extra_column)
|
80
80
|
expect( schema.warnings[1].column).to eql(4)
|
81
81
|
|
82
|
-
#no ragged row error
|
83
|
-
expect( schema.errors.size ).to eql(0)
|
84
|
-
end
|
82
|
+
#no ragged row error
|
83
|
+
expect( schema.errors.size ).to eql(0)
|
84
|
+
end
|
85
85
|
|
86
86
|
context "when validating header" do
|
87
87
|
it "should warn if column names are different to field names" do
|
88
88
|
minimum = Csvlint::Field.new("minimum", { "minLength" => 3 } )
|
89
89
|
required = Csvlint::Field.new("required", { "required" => true } )
|
90
90
|
schema = Csvlint::Schema.new("http://example.org", [minimum, required] )
|
91
|
-
|
91
|
+
|
92
92
|
expect( schema.validate_header(["minimum", "required"]) ).to eql(true)
|
93
93
|
expect( schema.warnings.size ).to eql(0)
|
94
|
-
|
94
|
+
|
95
95
|
expect( schema.validate_header(["wrong", "required"]) ).to eql(true)
|
96
96
|
expect( schema.warnings.size ).to eql(1)
|
97
97
|
expect( schema.warnings.first.row ).to eql(1)
|
@@ -99,8 +99,8 @@ describe Csvlint::Schema do
|
|
99
99
|
expect( schema.warnings.first.content ).to eql('wrong,required')
|
100
100
|
expect( schema.warnings.first.column ).to eql(nil)
|
101
101
|
expect( schema.warnings.first.category ).to eql(:schema)
|
102
|
-
expect
|
103
|
-
|
102
|
+
expect schema.warnings.first.constraints.has_value?('minimum,required')
|
103
|
+
# expect( schema.warnings.first.constraints.values ).to eql(['minimum,required'])
|
104
104
|
expect( schema.validate_header(["minimum", "Required"]) ).to eql(true)
|
105
105
|
expect( schema.warnings.size ).to eql(1)
|
106
106
|
|
@@ -118,7 +118,8 @@ describe Csvlint::Schema do
|
|
118
118
|
expect( schema.warnings.first.content ).to eql("minimum")
|
119
119
|
expect( schema.warnings.first.column ).to eql(nil)
|
120
120
|
expect( schema.warnings.first.category ).to eql(:schema)
|
121
|
-
expect
|
121
|
+
expect schema.warnings.first.constraints.has_value?('minimum,required')
|
122
|
+
# expect( schema.warnings.first.constraints.values ).to eql(['minimum,required'])
|
122
123
|
|
123
124
|
end
|
124
125
|
|
@@ -133,19 +134,20 @@ describe Csvlint::Schema do
|
|
133
134
|
expect( schema.warnings.first.content ).to eql("wrong,required")
|
134
135
|
expect( schema.warnings.first.column ).to eql(nil)
|
135
136
|
expect( schema.warnings.first.category ).to eql(:schema)
|
136
|
-
expect( schema.warnings.first.constraints ).to eql('minimum')
|
137
|
+
# expect( schema.warnings.first.constraints.values ).to eql('minimum')
|
138
|
+
expect( schema.warnings.first.constraints.has_value?('minimum'))
|
137
139
|
|
138
140
|
end
|
139
141
|
|
140
142
|
end
|
141
|
-
|
143
|
+
|
142
144
|
context "when parsing JSON Tables" do
|
143
|
-
|
144
|
-
before(:each) do
|
145
|
+
|
146
|
+
before(:each) do
|
145
147
|
@example=<<-EOL
|
146
148
|
{
|
147
149
|
"title": "Schema title",
|
148
|
-
"description": "schema",
|
150
|
+
"description": "schema",
|
149
151
|
"fields": [
|
150
152
|
{ "name": "ID", "constraints": { "required": true }, "title": "id", "description": "house identifier" },
|
151
153
|
{ "name": "Price", "constraints": { "required": true, "minLength": 1 } },
|
@@ -155,11 +157,11 @@ describe Csvlint::Schema do
|
|
155
157
|
EOL
|
156
158
|
stub_request(:get, "http://example.com/example.json").to_return(:status => 200, :body => @example)
|
157
159
|
end
|
158
|
-
|
160
|
+
|
159
161
|
it "should create a schema from a pre-parsed JSON table" do
|
160
162
|
json = JSON.parse( @example )
|
161
163
|
schema = Csvlint::Schema.from_json_table("http://example.org", json)
|
162
|
-
|
164
|
+
|
163
165
|
expect( schema.uri ).to eql("http://example.org")
|
164
166
|
expect( schema.title ).to eql("Schema title")
|
165
167
|
expect( schema.description ).to eql("schema")
|
@@ -169,15 +171,15 @@ describe Csvlint::Schema do
|
|
169
171
|
expect( schema.fields[0].title ).to eql("id")
|
170
172
|
expect( schema.fields[0].description ).to eql("house identifier")
|
171
173
|
end
|
172
|
-
|
174
|
+
|
173
175
|
it "should create a schema from a JSON Table URL" do
|
174
176
|
schema = Csvlint::Schema.load_from_json_table("http://example.com/example.json")
|
175
177
|
expect( schema.uri ).to eql("http://example.com/example.json")
|
176
178
|
expect( schema.fields.length ).to eql(3)
|
177
179
|
expect( schema.fields[0].name ).to eql("ID")
|
178
180
|
expect( schema.fields[0].constraints["required"] ).to eql(true)
|
179
|
-
|
181
|
+
|
180
182
|
end
|
181
|
-
end
|
182
|
-
|
183
|
-
end
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csvlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pezholio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|