schemacop 2.4.4 → 2.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +12 -0
- data/VERSION +1 -1
- data/doc/Schemacop/ArrayValidator.html +1 -1
- data/doc/Schemacop/BooleanValidator.html +1 -1
- data/doc/Schemacop/Caster.html +1 -1
- data/doc/Schemacop/Collector.html +1 -1
- data/doc/Schemacop/Dupper.html +1 -1
- data/doc/Schemacop/Exceptions/InvalidSchemaError.html +1 -1
- data/doc/Schemacop/Exceptions/ValidationError.html +1 -1
- data/doc/Schemacop/Exceptions.html +1 -1
- data/doc/Schemacop/FieldNode.html +1 -1
- data/doc/Schemacop/FloatValidator.html +1 -1
- data/doc/Schemacop/HashValidator.html +1 -1
- data/doc/Schemacop/IntegerValidator.html +1 -1
- data/doc/Schemacop/NilValidator.html +1 -1
- data/doc/Schemacop/Node.html +1 -1
- data/doc/Schemacop/NodeResolver.html +1 -1
- data/doc/Schemacop/NodeSupportingField.html +1 -1
- data/doc/Schemacop/NodeSupportingType.html +1 -1
- data/doc/Schemacop/NodeWithBlock.html +1 -1
- data/doc/Schemacop/NumberValidator.html +1 -1
- data/doc/Schemacop/ObjectValidator.html +1 -1
- data/doc/Schemacop/RootNode.html +1 -1
- data/doc/Schemacop/Schema.html +1 -1
- data/doc/Schemacop/StringValidator.html +1 -1
- data/doc/Schemacop/SymbolValidator.html +1 -1
- data/doc/Schemacop.html +1 -1
- data/doc/ScopedEnv.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +13 -1
- data/doc/index.html +13 -1
- data/doc/top-level-namespace.html +1 -1
- data/lib/schemacop/field_node.rb +1 -0
- data/schemacop.gemspec +5 -5
- data/test/defaults_test.rb +22 -0
- data/test/empty_test.rb +14 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dfdf6387da274755f11337c9eef5796464319644fab1f2a8fe32470de96bf0b7
|
|
4
|
+
data.tar.gz: 0f6c49016149ab3828158ca78b57756e4383dadb428a2748541596b4db065e38
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd2a8f01688886428a0bb67420f1a8e943923a05e0f311b65d479b10a82270a6d50816b5f20aef3674085b8343b19dc6da9d5568d230be927dd36990a3fb0e8b
|
|
7
|
+
data.tar.gz: 89fb45cd8890947b0e429cd3e02cbb16d3cb8a8fc0f8859025a60f1d7694b13f6bbb7bf5157f32a7a01c63634804380a83a24af93e161a7ef7a8d6e2498174eb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -627,6 +627,18 @@ Schema.new do
|
|
|
627
627
|
req :foo
|
|
628
628
|
end
|
|
629
629
|
end
|
|
630
|
+
|
|
631
|
+
# You can also specify blocks (without params) as defaults that will be
|
|
632
|
+
# evaluated at time of validation.
|
|
633
|
+
Schema.new do
|
|
634
|
+
opt :year, :integer, default: ->() { Time.now.year }
|
|
635
|
+
end
|
|
636
|
+
|
|
637
|
+
# If, for some very specific reason, you *need* the default to be an actual
|
|
638
|
+
# proc, wrap it inside another proc.
|
|
639
|
+
Schema.new do
|
|
640
|
+
opt :myproc, Proc, default: ->() { ->() { 42 } }
|
|
641
|
+
end
|
|
630
642
|
```
|
|
631
643
|
|
|
632
644
|
### Required data points
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.4.
|
|
1
|
+
2.4.5
|
|
@@ -319,7 +319,7 @@
|
|
|
319
319
|
</div>
|
|
320
320
|
|
|
321
321
|
<div id="footer">
|
|
322
|
-
Generated on
|
|
322
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
323
323
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
324
324
|
0.9.20 (ruby-2.6.2).
|
|
325
325
|
</div>
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
</div>
|
|
136
136
|
|
|
137
137
|
<div id="footer">
|
|
138
|
-
Generated on
|
|
138
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
139
139
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
140
140
|
0.9.20 (ruby-2.6.2).
|
|
141
141
|
</div>
|
data/doc/Schemacop/Caster.html
CHANGED
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
</div>
|
|
370
370
|
|
|
371
371
|
<div id="footer">
|
|
372
|
-
Generated on
|
|
372
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
373
373
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
374
374
|
0.9.20 (ruby-2.6.2).
|
|
375
375
|
</div>
|
|
@@ -777,7 +777,7 @@ called.</p>
|
|
|
777
777
|
</div>
|
|
778
778
|
|
|
779
779
|
<div id="footer">
|
|
780
|
-
Generated on
|
|
780
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
781
781
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
782
782
|
0.9.20 (ruby-2.6.2).
|
|
783
783
|
</div>
|
data/doc/Schemacop/Dupper.html
CHANGED
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
</div>
|
|
205
205
|
|
|
206
206
|
<div id="footer">
|
|
207
|
-
Generated on
|
|
207
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
208
208
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
209
209
|
0.9.20 (ruby-2.6.2).
|
|
210
210
|
</div>
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
</div>
|
|
115
115
|
|
|
116
116
|
<div id="footer">
|
|
117
|
-
Generated on
|
|
117
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
118
118
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
119
119
|
0.9.20 (ruby-2.6.2).
|
|
120
120
|
</div>
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
</div>
|
|
115
115
|
|
|
116
116
|
<div id="footer">
|
|
117
|
-
Generated on
|
|
117
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
118
118
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
119
119
|
0.9.20 (ruby-2.6.2).
|
|
120
120
|
</div>
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
</div>
|
|
106
106
|
|
|
107
107
|
<div id="footer">
|
|
108
|
-
Generated on
|
|
108
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
109
109
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
110
110
|
0.9.20 (ruby-2.6.2).
|
|
111
111
|
</div>
|
|
@@ -411,7 +411,7 @@
|
|
|
411
411
|
</div>
|
|
412
412
|
|
|
413
413
|
<div id="footer">
|
|
414
|
-
Generated on
|
|
414
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
415
415
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
416
416
|
0.9.20 (ruby-2.6.2).
|
|
417
417
|
</div>
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
<div id="footer">
|
|
151
|
-
Generated on
|
|
151
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
152
152
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
153
153
|
0.9.20 (ruby-2.6.2).
|
|
154
154
|
</div>
|
|
@@ -283,7 +283,7 @@
|
|
|
283
283
|
</div>
|
|
284
284
|
|
|
285
285
|
<div id="footer">
|
|
286
|
-
Generated on
|
|
286
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
287
287
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
288
288
|
0.9.20 (ruby-2.6.2).
|
|
289
289
|
</div>
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
<div id="footer">
|
|
151
|
-
Generated on
|
|
151
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
152
152
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
153
153
|
0.9.20 (ruby-2.6.2).
|
|
154
154
|
</div>
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
</div>
|
|
136
136
|
|
|
137
137
|
<div id="footer">
|
|
138
|
-
Generated on
|
|
138
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
139
139
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
140
140
|
0.9.20 (ruby-2.6.2).
|
|
141
141
|
</div>
|
data/doc/Schemacop/Node.html
CHANGED
|
@@ -1428,7 +1428,7 @@
|
|
|
1428
1428
|
</div>
|
|
1429
1429
|
|
|
1430
1430
|
<div id="footer">
|
|
1431
|
-
Generated on
|
|
1431
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
1432
1432
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1433
1433
|
0.9.20 (ruby-2.6.2).
|
|
1434
1434
|
</div>
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
</div>
|
|
249
249
|
|
|
250
250
|
<div id="footer">
|
|
251
|
-
Generated on
|
|
251
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
252
252
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
253
253
|
0.9.20 (ruby-2.6.2).
|
|
254
254
|
</div>
|
|
@@ -580,7 +580,7 @@
|
|
|
580
580
|
</div>
|
|
581
581
|
|
|
582
582
|
<div id="footer">
|
|
583
|
-
Generated on
|
|
583
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
584
584
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
585
585
|
0.9.20 (ruby-2.6.2).
|
|
586
586
|
</div>
|
|
@@ -602,7 +602,7 @@ as it formerly was the case in the constructor.</p>
|
|
|
602
602
|
</div>
|
|
603
603
|
|
|
604
604
|
<div id="footer">
|
|
605
|
-
Generated on
|
|
605
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
606
606
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
607
607
|
0.9.20 (ruby-2.6.2).
|
|
608
608
|
</div>
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
</div>
|
|
280
280
|
|
|
281
281
|
<div id="footer">
|
|
282
|
-
Generated on
|
|
282
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
283
283
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
284
284
|
0.9.20 (ruby-2.6.2).
|
|
285
285
|
</div>
|
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
</div>
|
|
223
223
|
|
|
224
224
|
<div id="footer">
|
|
225
|
-
Generated on
|
|
225
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
226
226
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
227
227
|
0.9.20 (ruby-2.6.2).
|
|
228
228
|
</div>
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
</div>
|
|
289
289
|
|
|
290
290
|
<div id="footer">
|
|
291
|
-
Generated on
|
|
291
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
292
292
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
293
293
|
0.9.20 (ruby-2.6.2).
|
|
294
294
|
</div>
|
data/doc/Schemacop/RootNode.html
CHANGED
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
</div>
|
|
162
162
|
|
|
163
163
|
<div id="footer">
|
|
164
|
-
Generated on
|
|
164
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
165
165
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
166
166
|
0.9.20 (ruby-2.6.2).
|
|
167
167
|
</div>
|
data/doc/Schemacop/Schema.html
CHANGED
|
@@ -689,7 +689,7 @@ this exception is thrown.</p>
|
|
|
689
689
|
</div>
|
|
690
690
|
|
|
691
691
|
<div id="footer">
|
|
692
|
-
Generated on
|
|
692
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
693
693
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
694
694
|
0.9.20 (ruby-2.6.2).
|
|
695
695
|
</div>
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
</div>
|
|
286
286
|
|
|
287
287
|
<div id="footer">
|
|
288
|
-
Generated on
|
|
288
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
289
289
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
290
290
|
0.9.20 (ruby-2.6.2).
|
|
291
291
|
</div>
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
</div>
|
|
136
136
|
|
|
137
137
|
<div id="footer">
|
|
138
|
-
Generated on
|
|
138
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
139
139
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
140
140
|
0.9.20 (ruby-2.6.2).
|
|
141
141
|
</div>
|
data/doc/Schemacop.html
CHANGED
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
</div>
|
|
137
137
|
|
|
138
138
|
<div id="footer">
|
|
139
|
-
Generated on
|
|
139
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
140
140
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
141
141
|
0.9.20 (ruby-2.6.2).
|
|
142
142
|
</div>
|
data/doc/ScopedEnv.html
CHANGED
|
@@ -341,7 +341,7 @@
|
|
|
341
341
|
</div>
|
|
342
342
|
|
|
343
343
|
<div id="footer">
|
|
344
|
-
Generated on
|
|
344
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
345
345
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
346
346
|
0.9.20 (ruby-2.6.2).
|
|
347
347
|
</div>
|
data/doc/_index.html
CHANGED
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
</div>
|
|
370
370
|
|
|
371
371
|
<div id="footer">
|
|
372
|
-
Generated on
|
|
372
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
373
373
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
374
374
|
0.9.20 (ruby-2.6.2).
|
|
375
375
|
</div>
|
data/doc/file.README.html
CHANGED
|
@@ -670,6 +670,18 @@ Make sure your default values always match the underlying schema.</p>
|
|
|
670
670
|
<span class='id identifier rubyid_req'>req</span> <span class='symbol'>:foo</span>
|
|
671
671
|
<span class='kw'>end</span>
|
|
672
672
|
<span class='kw'>end</span>
|
|
673
|
+
|
|
674
|
+
<span class='comment'># You can also specify blocks (without params) as defaults that will be
|
|
675
|
+
</span><span class='comment'># evaluated at time of validation.
|
|
676
|
+
</span><span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
|
677
|
+
<span class='id identifier rubyid_opt'>opt</span> <span class='symbol'>:year</span><span class='comma'>,</span> <span class='symbol'>:integer</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span> <span class='rbrace'>}</span>
|
|
678
|
+
<span class='kw'>end</span>
|
|
679
|
+
|
|
680
|
+
<span class='comment'># If, for some very specific reason, you *need* the default to be an actual
|
|
681
|
+
</span><span class='comment'># proc, wrap it inside another proc.
|
|
682
|
+
</span><span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
|
683
|
+
<span class='id identifier rubyid_opt'>opt</span> <span class='symbol'>:myproc</span><span class='comma'>,</span> <span class='const'>Proc</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='int'>42</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
|
684
|
+
<span class='kw'>end</span>
|
|
673
685
|
</code></pre>
|
|
674
686
|
|
|
675
687
|
<h3>Required data points</h3>
|
|
@@ -811,7 +823,7 @@ file</p></li>
|
|
|
811
823
|
</div></div>
|
|
812
824
|
|
|
813
825
|
<div id="footer">
|
|
814
|
-
Generated on
|
|
826
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
815
827
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
816
828
|
0.9.20 (ruby-2.6.2).
|
|
817
829
|
</div>
|
data/doc/index.html
CHANGED
|
@@ -670,6 +670,18 @@ Make sure your default values always match the underlying schema.</p>
|
|
|
670
670
|
<span class='id identifier rubyid_req'>req</span> <span class='symbol'>:foo</span>
|
|
671
671
|
<span class='kw'>end</span>
|
|
672
672
|
<span class='kw'>end</span>
|
|
673
|
+
|
|
674
|
+
<span class='comment'># You can also specify blocks (without params) as defaults that will be
|
|
675
|
+
</span><span class='comment'># evaluated at time of validation.
|
|
676
|
+
</span><span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
|
677
|
+
<span class='id identifier rubyid_opt'>opt</span> <span class='symbol'>:year</span><span class='comma'>,</span> <span class='symbol'>:integer</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span> <span class='rbrace'>}</span>
|
|
678
|
+
<span class='kw'>end</span>
|
|
679
|
+
|
|
680
|
+
<span class='comment'># If, for some very specific reason, you *need* the default to be an actual
|
|
681
|
+
</span><span class='comment'># proc, wrap it inside another proc.
|
|
682
|
+
</span><span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
|
683
|
+
<span class='id identifier rubyid_opt'>opt</span> <span class='symbol'>:myproc</span><span class='comma'>,</span> <span class='const'>Proc</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='int'>42</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
|
684
|
+
<span class='kw'>end</span>
|
|
673
685
|
</code></pre>
|
|
674
686
|
|
|
675
687
|
<h3>Required data points</h3>
|
|
@@ -811,7 +823,7 @@ file</p></li>
|
|
|
811
823
|
</div></div>
|
|
812
824
|
|
|
813
825
|
<div id="footer">
|
|
814
|
-
Generated on
|
|
826
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
815
827
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
816
828
|
0.9.20 (ruby-2.6.2).
|
|
817
829
|
</div>
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
</div>
|
|
103
103
|
|
|
104
104
|
<div id="footer">
|
|
105
|
-
Generated on
|
|
105
|
+
Generated on Wed May 13 10:52:04 2020 by
|
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
107
107
|
0.9.20 (ruby-2.6.2).
|
|
108
108
|
</div>
|
data/lib/schemacop/field_node.rb
CHANGED
data/schemacop.gemspec
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: schemacop 2.4.
|
|
2
|
+
# stub: schemacop 2.4.5 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "schemacop".freeze
|
|
6
|
-
s.version = "2.4.
|
|
6
|
+
s.version = "2.4.5"
|
|
7
7
|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
9
|
s.require_paths = ["lib".freeze]
|
|
10
10
|
s.authors = ["Sitrox".freeze]
|
|
11
|
-
s.date = "2020-
|
|
12
|
-
s.files = [".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, ".travis.yml".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "RUBY_VERSION".freeze, "Rakefile".freeze, "VERSION".freeze, "doc/Schemacop.html".freeze, "doc/Schemacop/ArrayValidator.html".freeze, "doc/Schemacop/BooleanValidator.html".freeze, "doc/Schemacop/Caster.html".freeze, "doc/Schemacop/Collector.html".freeze, "doc/Schemacop/Dupper.html".freeze, "doc/Schemacop/Exceptions.html".freeze, "doc/Schemacop/Exceptions/InvalidSchemaError.html".freeze, "doc/Schemacop/Exceptions/ValidationError.html".freeze, "doc/Schemacop/FieldNode.html".freeze, "doc/Schemacop/FloatValidator.html".freeze, "doc/Schemacop/HashValidator.html".freeze, "doc/Schemacop/IntegerValidator.html".freeze, "doc/Schemacop/NilValidator.html".freeze, "doc/Schemacop/Node.html".freeze, "doc/Schemacop/NodeResolver.html".freeze, "doc/Schemacop/NodeSupportingField.html".freeze, "doc/Schemacop/NodeSupportingType.html".freeze, "doc/Schemacop/NodeWithBlock.html".freeze, "doc/Schemacop/NumberValidator.html".freeze, "doc/Schemacop/ObjectValidator.html".freeze, "doc/Schemacop/RootNode.html".freeze, "doc/Schemacop/Schema.html".freeze, "doc/Schemacop/StringValidator.html".freeze, "doc/Schemacop/SymbolValidator.html".freeze, "doc/ScopedEnv.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/index.html".freeze, "doc/inheritance.graphml".freeze, "doc/inheritance.pdf".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/top-level-namespace.html".freeze, "lib/schemacop.rb".freeze, "lib/schemacop/caster.rb".freeze, "lib/schemacop/collector.rb".freeze, "lib/schemacop/dupper.rb".freeze, "lib/schemacop/exceptions.rb".freeze, "lib/schemacop/field_node.rb".freeze, "lib/schemacop/node.rb".freeze, "lib/schemacop/node_resolver.rb".freeze, "lib/schemacop/node_supporting_field.rb".freeze, "lib/schemacop/node_supporting_type.rb".freeze, "lib/schemacop/node_with_block.rb".freeze, "lib/schemacop/root_node.rb".freeze, "lib/schemacop/schema.rb".freeze, "lib/schemacop/scoped_env.rb".freeze, "lib/schemacop/validator/array_validator.rb".freeze, "lib/schemacop/validator/boolean_validator.rb".freeze, "lib/schemacop/validator/float_validator.rb".freeze, "lib/schemacop/validator/hash_validator.rb".freeze, "lib/schemacop/validator/integer_validator.rb".freeze, "lib/schemacop/validator/nil_validator.rb".freeze, "lib/schemacop/validator/number_validator.rb".freeze, "lib/schemacop/validator/object_validator.rb".freeze, "lib/schemacop/validator/string_validator.rb".freeze, "lib/schemacop/validator/symbol_validator.rb".freeze, "schemacop.gemspec".freeze, "test/casting_test.rb".freeze, "test/collector_test.rb".freeze, "test/custom_check_test.rb".freeze, "test/custom_if_test.rb".freeze, "test/defaults_test.rb".freeze, "test/nil_dis_allow_test.rb".freeze, "test/node_resolver_test.rb".freeze, "test/short_forms_test.rb".freeze, "test/test_helper.rb".freeze, "test/types_test.rb".freeze, "test/validator_array_test.rb".freeze, "test/validator_boolean_test.rb".freeze, "test/validator_float_test.rb".freeze, "test/validator_hash_test.rb".freeze, "test/validator_integer_test.rb".freeze, "test/validator_nil_test.rb".freeze, "test/validator_number_test.rb".freeze, "test/validator_object_test.rb".freeze, "test/validator_string_test.rb".freeze, "test/validator_symbol_test.rb".freeze]
|
|
11
|
+
s.date = "2020-05-13"
|
|
12
|
+
s.files = [".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, ".travis.yml".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "RUBY_VERSION".freeze, "Rakefile".freeze, "VERSION".freeze, "doc/Schemacop.html".freeze, "doc/Schemacop/ArrayValidator.html".freeze, "doc/Schemacop/BooleanValidator.html".freeze, "doc/Schemacop/Caster.html".freeze, "doc/Schemacop/Collector.html".freeze, "doc/Schemacop/Dupper.html".freeze, "doc/Schemacop/Exceptions.html".freeze, "doc/Schemacop/Exceptions/InvalidSchemaError.html".freeze, "doc/Schemacop/Exceptions/ValidationError.html".freeze, "doc/Schemacop/FieldNode.html".freeze, "doc/Schemacop/FloatValidator.html".freeze, "doc/Schemacop/HashValidator.html".freeze, "doc/Schemacop/IntegerValidator.html".freeze, "doc/Schemacop/NilValidator.html".freeze, "doc/Schemacop/Node.html".freeze, "doc/Schemacop/NodeResolver.html".freeze, "doc/Schemacop/NodeSupportingField.html".freeze, "doc/Schemacop/NodeSupportingType.html".freeze, "doc/Schemacop/NodeWithBlock.html".freeze, "doc/Schemacop/NumberValidator.html".freeze, "doc/Schemacop/ObjectValidator.html".freeze, "doc/Schemacop/RootNode.html".freeze, "doc/Schemacop/Schema.html".freeze, "doc/Schemacop/StringValidator.html".freeze, "doc/Schemacop/SymbolValidator.html".freeze, "doc/ScopedEnv.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/index.html".freeze, "doc/inheritance.graphml".freeze, "doc/inheritance.pdf".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/top-level-namespace.html".freeze, "lib/schemacop.rb".freeze, "lib/schemacop/caster.rb".freeze, "lib/schemacop/collector.rb".freeze, "lib/schemacop/dupper.rb".freeze, "lib/schemacop/exceptions.rb".freeze, "lib/schemacop/field_node.rb".freeze, "lib/schemacop/node.rb".freeze, "lib/schemacop/node_resolver.rb".freeze, "lib/schemacop/node_supporting_field.rb".freeze, "lib/schemacop/node_supporting_type.rb".freeze, "lib/schemacop/node_with_block.rb".freeze, "lib/schemacop/root_node.rb".freeze, "lib/schemacop/schema.rb".freeze, "lib/schemacop/scoped_env.rb".freeze, "lib/schemacop/validator/array_validator.rb".freeze, "lib/schemacop/validator/boolean_validator.rb".freeze, "lib/schemacop/validator/float_validator.rb".freeze, "lib/schemacop/validator/hash_validator.rb".freeze, "lib/schemacop/validator/integer_validator.rb".freeze, "lib/schemacop/validator/nil_validator.rb".freeze, "lib/schemacop/validator/number_validator.rb".freeze, "lib/schemacop/validator/object_validator.rb".freeze, "lib/schemacop/validator/string_validator.rb".freeze, "lib/schemacop/validator/symbol_validator.rb".freeze, "schemacop.gemspec".freeze, "test/casting_test.rb".freeze, "test/collector_test.rb".freeze, "test/custom_check_test.rb".freeze, "test/custom_if_test.rb".freeze, "test/defaults_test.rb".freeze, "test/empty_test.rb".freeze, "test/nil_dis_allow_test.rb".freeze, "test/node_resolver_test.rb".freeze, "test/short_forms_test.rb".freeze, "test/test_helper.rb".freeze, "test/types_test.rb".freeze, "test/validator_array_test.rb".freeze, "test/validator_boolean_test.rb".freeze, "test/validator_float_test.rb".freeze, "test/validator_hash_test.rb".freeze, "test/validator_integer_test.rb".freeze, "test/validator_nil_test.rb".freeze, "test/validator_number_test.rb".freeze, "test/validator_object_test.rb".freeze, "test/validator_string_test.rb".freeze, "test/validator_symbol_test.rb".freeze]
|
|
13
13
|
s.homepage = "https://github.com/sitrox/schemacop".freeze
|
|
14
14
|
s.licenses = ["MIT".freeze]
|
|
15
15
|
s.rubygems_version = "3.0.3".freeze
|
|
16
16
|
s.summary = "Schemacop validates ruby structures consisting of nested hashes and arrays against simple schema definitions.".freeze
|
|
17
|
-
s.test_files = ["test/casting_test.rb".freeze, "test/collector_test.rb".freeze, "test/custom_check_test.rb".freeze, "test/custom_if_test.rb".freeze, "test/defaults_test.rb".freeze, "test/nil_dis_allow_test.rb".freeze, "test/node_resolver_test.rb".freeze, "test/short_forms_test.rb".freeze, "test/test_helper.rb".freeze, "test/types_test.rb".freeze, "test/validator_array_test.rb".freeze, "test/validator_boolean_test.rb".freeze, "test/validator_float_test.rb".freeze, "test/validator_hash_test.rb".freeze, "test/validator_integer_test.rb".freeze, "test/validator_nil_test.rb".freeze, "test/validator_number_test.rb".freeze, "test/validator_object_test.rb".freeze, "test/validator_string_test.rb".freeze, "test/validator_symbol_test.rb".freeze]
|
|
17
|
+
s.test_files = ["test/casting_test.rb".freeze, "test/collector_test.rb".freeze, "test/custom_check_test.rb".freeze, "test/custom_if_test.rb".freeze, "test/defaults_test.rb".freeze, "test/empty_test.rb".freeze, "test/nil_dis_allow_test.rb".freeze, "test/node_resolver_test.rb".freeze, "test/short_forms_test.rb".freeze, "test/test_helper.rb".freeze, "test/types_test.rb".freeze, "test/validator_array_test.rb".freeze, "test/validator_boolean_test.rb".freeze, "test/validator_float_test.rb".freeze, "test/validator_hash_test.rb".freeze, "test/validator_integer_test.rb".freeze, "test/validator_nil_test.rb".freeze, "test/validator_number_test.rb".freeze, "test/validator_object_test.rb".freeze, "test/validator_string_test.rb".freeze, "test/validator_symbol_test.rb".freeze]
|
|
18
18
|
|
|
19
19
|
if s.respond_to? :specification_version then
|
|
20
20
|
s.specification_version = 4
|
data/test/defaults_test.rb
CHANGED
|
@@ -58,6 +58,28 @@ module Schemacop
|
|
|
58
58
|
assert_equal({ foo: [{ bar: 42 }] }, output)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
def test_proc
|
|
62
|
+
s = Schema.new do
|
|
63
|
+
opt :year, :integer, default: ->() { Time.now.year }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
input = {}
|
|
67
|
+
output = s.validate!(input)
|
|
68
|
+
assert_equal({ year: Time.now.year }, output)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def test_nested_proc
|
|
72
|
+
myproc = proc { 42 }
|
|
73
|
+
|
|
74
|
+
s = Schema.new do
|
|
75
|
+
opt :myproc, Proc, default: ->() { myproc }
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
input = {}
|
|
79
|
+
output = s.validate!(input)
|
|
80
|
+
assert_equal({ myproc: myproc }, output)
|
|
81
|
+
end
|
|
82
|
+
|
|
61
83
|
def test_invalid_default
|
|
62
84
|
s = Schema.new :integer, default: '42'
|
|
63
85
|
|
data/test/empty_test.rb
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
module Schemacop
|
|
4
|
+
class EmptyTest < Minitest::Test
|
|
5
|
+
def test_empty_hash
|
|
6
|
+
schema = Schema.new do
|
|
7
|
+
type Hash
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
assert_nothing_raised { schema.validate!({}) }
|
|
11
|
+
assert_verr { schema.validate!(foo: :bar) }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: schemacop
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.4.
|
|
4
|
+
version: 2.4.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sitrox
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-05-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -254,6 +254,7 @@ files:
|
|
|
254
254
|
- test/custom_check_test.rb
|
|
255
255
|
- test/custom_if_test.rb
|
|
256
256
|
- test/defaults_test.rb
|
|
257
|
+
- test/empty_test.rb
|
|
257
258
|
- test/nil_dis_allow_test.rb
|
|
258
259
|
- test/node_resolver_test.rb
|
|
259
260
|
- test/short_forms_test.rb
|
|
@@ -299,6 +300,7 @@ test_files:
|
|
|
299
300
|
- test/custom_check_test.rb
|
|
300
301
|
- test/custom_if_test.rb
|
|
301
302
|
- test/defaults_test.rb
|
|
303
|
+
- test/empty_test.rb
|
|
302
304
|
- test/nil_dis_allow_test.rb
|
|
303
305
|
- test/node_resolver_test.rb
|
|
304
306
|
- test/short_forms_test.rb
|