dc-kwalify 0.7.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/contrib/kwalify +1 -1
  4. data/dc-kwalify.gemspec +27 -0
  5. data/lib/kwalify/main.rb +1 -1
  6. data/lib/kwalify/util/testcase-helper.rb +1 -1
  7. data/lib/kwalify/version.rb +5 -0
  8. data/lib/kwalify.rb +1 -7
  9. metadata +83 -203
  10. data/setup.rb +0 -1585
  11. data/test/Rookbook.yaml +0 -10
  12. data/test/data/users-guide/AddressBook.java.expected +0 -40
  13. data/test/data/users-guide/BABEL.data.yaml +0 -24
  14. data/test/data/users-guide/BABEL.schema.yaml +0 -30
  15. data/test/data/users-guide/ExampleAddressBook.java +0 -47
  16. data/test/data/users-guide/Group.java.expected +0 -24
  17. data/test/data/users-guide/Person.java.expected +0 -44
  18. data/test/data/users-guide/address_book.rb +0 -52
  19. data/test/data/users-guide/address_book.schema.yaml +0 -28
  20. data/test/data/users-guide/address_book.yaml +0 -27
  21. data/test/data/users-guide/answers-schema.yaml +0 -12
  22. data/test/data/users-guide/answers-validator.rb +0 -52
  23. data/test/data/users-guide/babel_genclass.result +0 -26
  24. data/test/data/users-guide/config.schema.yaml +0 -7
  25. data/test/data/users-guide/config.yaml +0 -4
  26. data/test/data/users-guide/document01a.yaml +0 -3
  27. data/test/data/users-guide/document01b.yaml +0 -3
  28. data/test/data/users-guide/document02a.yaml +0 -4
  29. data/test/data/users-guide/document02b.yaml +0 -4
  30. data/test/data/users-guide/document03a.yaml +0 -6
  31. data/test/data/users-guide/document03b.yaml +0 -6
  32. data/test/data/users-guide/document04a.yaml +0 -9
  33. data/test/data/users-guide/document04b.yaml +0 -9
  34. data/test/data/users-guide/document05a.yaml +0 -11
  35. data/test/data/users-guide/document05b.yaml +0 -12
  36. data/test/data/users-guide/document06a.yaml +0 -15
  37. data/test/data/users-guide/document06b.yaml +0 -16
  38. data/test/data/users-guide/document07a.yaml +0 -9
  39. data/test/data/users-guide/document07b.yaml +0 -7
  40. data/test/data/users-guide/document12a.json +0 -10
  41. data/test/data/users-guide/document12b.json +0 -6
  42. data/test/data/users-guide/document13a.yaml +0 -17
  43. data/test/data/users-guide/document14a.yaml +0 -3
  44. data/test/data/users-guide/document14b.yaml +0 -3
  45. data/test/data/users-guide/document15a.yaml +0 -6
  46. data/test/data/users-guide/document15b.yaml +0 -5
  47. data/test/data/users-guide/example_address_book.rb +0 -10
  48. data/test/data/users-guide/example_address_book_java.result +0 -32
  49. data/test/data/users-guide/example_address_book_ruby.result +0 -31
  50. data/test/data/users-guide/genclass_java.result +0 -4
  51. data/test/data/users-guide/howto-validation-with-parsing.rb +0 -28
  52. data/test/data/users-guide/howto-validation.rb +0 -25
  53. data/test/data/users-guide/howto3.rb +0 -6
  54. data/test/data/users-guide/howto3.result +0 -5
  55. data/test/data/users-guide/howto3.yaml +0 -8
  56. data/test/data/users-guide/howto5_databinding.result +0 -111
  57. data/test/data/users-guide/invalid01.result +0 -3
  58. data/test/data/users-guide/invalid02.result +0 -5
  59. data/test/data/users-guide/invalid03.result +0 -5
  60. data/test/data/users-guide/invalid04.result +0 -4
  61. data/test/data/users-guide/invalid05.result +0 -11
  62. data/test/data/users-guide/invalid06.result +0 -4
  63. data/test/data/users-guide/invalid07.result +0 -3
  64. data/test/data/users-guide/invalid08.result +0 -3
  65. data/test/data/users-guide/invalid12.json +0 -8
  66. data/test/data/users-guide/invalid14.result +0 -4
  67. data/test/data/users-guide/invalid15.result +0 -4
  68. data/test/data/users-guide/loadbabel.rb +0 -27
  69. data/test/data/users-guide/loadconfig.rb +0 -16
  70. data/test/data/users-guide/loadconfig.result +0 -6
  71. data/test/data/users-guide/models.rb +0 -22
  72. data/test/data/users-guide/option_ha.result +0 -6
  73. data/test/data/users-guide/option_ha_genclass_java.result +0 -7
  74. data/test/data/users-guide/schema01.yaml +0 -3
  75. data/test/data/users-guide/schema02.yaml +0 -12
  76. data/test/data/users-guide/schema03.yaml +0 -9
  77. data/test/data/users-guide/schema04.yaml +0 -20
  78. data/test/data/users-guide/schema05.yaml +0 -29
  79. data/test/data/users-guide/schema06.yaml +0 -11
  80. data/test/data/users-guide/schema12.json +0 -12
  81. data/test/data/users-guide/schema13.yaml +0 -13
  82. data/test/data/users-guide/schema14.yaml +0 -5
  83. data/test/data/users-guide/schema15.yaml +0 -21
  84. data/test/data/users-guide/valid01.result +0 -2
  85. data/test/data/users-guide/valid02.result +0 -2
  86. data/test/data/users-guide/valid03.result +0 -2
  87. data/test/data/users-guide/valid04.result +0 -2
  88. data/test/data/users-guide/valid05.result +0 -2
  89. data/test/data/users-guide/valid06.result +0 -2
  90. data/test/data/users-guide/valid07.result +0 -2
  91. data/test/data/users-guide/valid08.result +0 -2
  92. data/test/data/users-guide/valid12.result +0 -2
  93. data/test/data/users-guide/valid13.result +0 -2
  94. data/test/data/users-guide/valid14.result +0 -2
  95. data/test/data/users-guide/valid15.result +0 -2
  96. data/test/data/users-guide/validate08.rb +0 -37
  97. data/test/test-action.rb +0 -78
  98. data/test/test-action.yaml +0 -738
  99. data/test/test-databinding.rb +0 -83
  100. data/test/test-databinding.yaml +0 -339
  101. data/test/test-main.rb +0 -157
  102. data/test/test-main.yaml +0 -415
  103. data/test/test-metavalidator.rb +0 -80
  104. data/test/test-metavalidator.yaml +0 -1179
  105. data/test/test-parser-yaml.rb +0 -57
  106. data/test/test-parser-yaml.yaml +0 -1749
  107. data/test/test-rule.rb +0 -26
  108. data/test/test-rule.yaml +0 -317
  109. data/test/test-users-guide.rb +0 -75
  110. data/test/test-util.rb +0 -125
  111. data/test/test-validator.rb +0 -95
  112. data/test/test-validator.yaml +0 -986
  113. data/test/test-yaml-parser.rb +0 -47
  114. data/test/test-yaml-parser.yaml +0 -1226
  115. data/test/test.rb +0 -61
@@ -1,986 +0,0 @@
1
- ##
2
- ## $Rev$
3
- ## $Release: 0.7.2 $
4
- ## copyright(c) 2005-2010 kuwata-lab all rights reserved.
5
- ##
6
- ---
7
- name: sequence1
8
- desc: sequence test
9
- checked: yes
10
- #
11
- schema: |
12
- type: seq
13
- required: true
14
- sequence:
15
- - type: str
16
- required: true
17
- #
18
- valid: |
19
- - foo
20
- - bar
21
- - baz
22
- #
23
- invalid: |
24
- - foo
25
- - bar
26
- -
27
- - baz
28
- - 100
29
- #
30
- error: |
31
- :required_novalue : (line 3)[/2] value required but none.
32
- :type_unmatch : (line 5)[/4] '100': not a string.
33
- error2: |
34
- :required_novalue : 3:1:[/2] value required but none.
35
- :type_unmatch : 5:1:[/4] '100': not a string.
36
- ##
37
- ---
38
- name: mapping1
39
- desc: mapping test
40
- checked: yes
41
- #
42
- schema: |
43
- type: map
44
- required: true
45
- mapping:
46
- name:
47
- type: str
48
- required: true
49
- email:
50
- type: str
51
- pattern: /@/
52
- required: yes
53
- age:
54
- type: int
55
- blood:
56
- type: str
57
- enum:
58
- - A
59
- - B
60
- - O
61
- - AB
62
- birth:
63
- type: date
64
- #
65
- valid: |
66
- name: foo
67
- email: foo@mail.com
68
- age: 20
69
- blood: AB
70
- birth: 1985-01-01
71
- #
72
- invalid: |
73
- nam: foo
74
- email: foo(at)mail.com
75
- age: twenty
76
- blood: ab
77
- birth: Jul 01, 1985
78
- #
79
- error: |
80
- :required_nokey : (line 1)[/] key 'name:' is required.
81
- :key_undefined : (line 1)[/nam] key 'nam:' is undefined.
82
- :pattern_unmatch : (line 2)[/email] 'foo(at)mail.com': not matched to pattern /@/.
83
- :type_unmatch : (line 3)[/age] 'twenty': not a integer.
84
- :enum_notexist : (line 4)[/blood] 'ab': invalid blood value.
85
- :type_unmatch : (line 5)[/birth] 'Jul 01, 1985': not a date.
86
- error2: |
87
- :required_nokey : 1:1:[/] key 'name:' is required.
88
- :key_undefined : 1:1:[/nam] key 'nam:' is undefined.
89
- :pattern_unmatch : 2:1:[/email] 'foo(at)mail.com': not matched to pattern /@/.
90
- :type_unmatch : 3:1:[/age] 'twenty': not a integer.
91
- :enum_notexist : 4:1:[/blood] 'ab': invalid blood value.
92
- :type_unmatch : 5:1:[/birth] 'Jul 01, 1985': not a date.
93
- ##
94
- ---
95
- name: nested1
96
- desc: nest of seq and map
97
- checked: yes
98
- #
99
- schema: |
100
- type: map
101
- required: true
102
- mapping:
103
- address-book:
104
- type: seq
105
- required: true
106
- sequence:
107
- - type: map
108
- mapping:
109
- name:
110
- type: str
111
- required: yes
112
- email:
113
- type: str
114
- pattern: /@/
115
- required: yes
116
- age:
117
- type: int
118
- blood:
119
- type: str
120
- enum:
121
- - A
122
- - B
123
- - O
124
- - AB
125
- birth:
126
- type: date
127
- #
128
- valid: |
129
- address-book:
130
- - name: foo
131
- email: foo@mail.com
132
- age: 20
133
- blood: AB
134
- birth: 1985-01-01
135
- - name: bar
136
- email: foo@mail.com
137
- #
138
- invalid: |
139
- address-book:
140
- - name: foo
141
- mail: foo@mail.com
142
- age: twenty
143
- blood: ab
144
- birth: 1985/01/01
145
- - name: bar
146
- email: bar(at)mail.com
147
- #
148
- error: |
149
- :required_nokey : (line 2)[/address-book/0] key 'email:' is required.
150
- :key_undefined : (line 3)[/address-book/0/mail] key 'mail:' is undefined.
151
- :type_unmatch : (line 4)[/address-book/0/age] 'twenty': not a integer.
152
- :enum_notexist : (line 5)[/address-book/0/blood] 'ab': invalid blood value.
153
- :type_unmatch : (line 6)[/address-book/0/birth] '1985/01/01': not a date.
154
- :pattern_unmatch : (line 8)[/address-book/1/email] 'bar(at)mail.com': not matched to pattern /@/.
155
- error2: |
156
- :required_nokey : 2:5:[/address-book/0] key 'email:' is required.
157
- :key_undefined : 3:5:[/address-book/0/mail] key 'mail:' is undefined.
158
- :type_unmatch : 4:5:[/address-book/0/age] 'twenty': not a integer.
159
- :enum_notexist : 5:5:[/address-book/0/blood] 'ab': invalid blood value.
160
- :type_unmatch : 6:5:[/address-book/0/birth] '1985/01/01': not a date.
161
- :pattern_unmatch : 8:5:[/address-book/1/email] 'bar(at)mail.com': not matched to pattern /@/.
162
- ##
163
- ---
164
- name: anchor1
165
- desc: schema with anchor
166
- checked: yes
167
- #
168
- schema: |
169
- type: seq
170
- required: true
171
- sequence:
172
- - type: map
173
- required: true
174
- mapping:
175
- first-name: &name
176
- type: str
177
- required: yes
178
- family-name: *name
179
- #
180
- valid: |
181
- - first-name: foo
182
- family-name: Foo
183
- - first-name: bar
184
- family-name: Bar
185
- #
186
- invalid: |
187
- - first-name: foo
188
- last-name: Foo
189
- - first-name: bar
190
- family-name: 100
191
- #
192
- error: |
193
- :required_nokey : (line 1)[/0] key 'family-name:' is required.
194
- :key_undefined : (line 2)[/0/last-name] key 'last-name:' is undefined.
195
- :type_unmatch : (line 4)[/1/family-name] '100': not a string.
196
- error2: |
197
- :required_nokey : 1:3:[/0] key 'family-name:' is required.
198
- :key_undefined : 2:3:[/0/last-name] key 'last-name:' is undefined.
199
- :type_unmatch : 4:3:[/1/family-name] '100': not a string.
200
- ##
201
- ---
202
- name: anchor2
203
- desc: schema with anchor 2
204
- checked: yes
205
- #
206
- schema: |
207
- type: map
208
- required: true
209
- mapping:
210
- title: &name
211
- type: str
212
- required: true
213
- address-book:
214
- type: seq
215
- required: true
216
- sequence:
217
- - type: map
218
- mapping:
219
- name: *name
220
- email:
221
- type: str
222
- required: yes
223
- #
224
- valid: |
225
- title: my friends
226
- address-book:
227
- - name: foo
228
- email: foo@mail.com
229
- - name: bar
230
- email: bar@mail.com
231
- #
232
- invalid: |
233
- title: my friends
234
- address-book:
235
- - name: 100
236
- email: foo@mail.com
237
- - first-name: bar
238
- email: bar@mail.com
239
- #
240
- error: |
241
- :type_unmatch : (line 3)[/address-book/0/name] '100': not a string.
242
- :required_nokey : (line 5)[/address-book/1] key 'name:' is required.
243
- :key_undefined : (line 5)[/address-book/1/first-name] key 'first-name:' is undefined.
244
- error2: |
245
- :type_unmatch : 3:5:[/address-book/0/name] '100': not a string.
246
- :required_nokey : 5:5:[/address-book/1] key 'name:' is required.
247
- :key_undefined : 5:5:[/address-book/1/first-name] key 'first-name:' is undefined.
248
- ##
249
- ---
250
- name: anchor3
251
- desc: document with anchor
252
- checked: yes
253
- #
254
- schema: |
255
- type: seq
256
- sequence:
257
- - &employee
258
- type: map
259
- mapping:
260
- name:
261
- type: str
262
- post:
263
- type: str
264
- enum:
265
- - exective
266
- - manager
267
- - clerk
268
- supervisor: *employee
269
- #
270
- valid: |
271
- - &foo
272
- name: foo
273
- post: exective
274
- - &bar
275
- name: bar
276
- post: manager
277
- supervisor: *foo
278
- - &baz
279
- name: baz
280
- post: clerk
281
- supervisor: *bar
282
- - &zak
283
- name: zak
284
- post: clerk
285
- supervisor: *bar
286
- #
287
- invalid: |
288
- - &foo
289
- name: 100
290
- post: exective
291
- supervisor: *foo
292
- - &bar
293
- name: foo
294
- post: worker
295
- supervisor: *foo
296
- #
297
- error: |
298
- :type_unmatch : (line 2)[/0/name] '100': not a string.
299
- :enum_notexist : (line 7)[/1/post] 'worker': invalid post value.
300
- error2: |
301
- :type_unmatch : 2:3:[/0/name] '100': not a string.
302
- :enum_notexist : 7:3:[/1/post] 'worker': invalid post value.
303
- ##
304
- ---
305
- name: range1
306
- desc: range test && bug#?????
307
- checked: yes
308
- #
309
- schema: |
310
- type: map
311
- mapping:
312
- "max-only":
313
- type: seq
314
- sequence:
315
- - type: number
316
- required: yes
317
- range: { max: 100 }
318
- "min-only":
319
- type: seq
320
- sequence:
321
- - type: number
322
- required: yes
323
- range: { min: 10.0 }
324
- "max-and-min":
325
- type: seq
326
- sequence:
327
- - type: number
328
- required: yes
329
- range: { max: 100.0, min: 10.0 }
330
- #
331
- valid: |
332
- max-only:
333
- - 100
334
- - 100.0
335
- min-only:
336
- - 10
337
- - 10.0
338
- max-and-min:
339
- - 100
340
- - 10
341
- - 100.0
342
- - 10.0
343
- #
344
- invalid: |
345
- max-only:
346
- - 101
347
- - 100.1
348
- min-only:
349
- - 9
350
- - 9.99
351
- max-and-min:
352
- - 101
353
- - 100.1
354
- - 9
355
- - 9.99
356
- #
357
- error: |
358
- :range_toolarge : (line 2)[/max-only/0] '101': too large (> max 100).
359
- :range_toolarge : (line 3)[/max-only/1] '100.1': too large (> max 100).
360
- :range_toosmall : (line 5)[/min-only/0] '9': too small (< min 10.0).
361
- :range_toosmall : (line 6)[/min-only/1] '9.99': too small (< min 10.0).
362
- :range_toolarge : (line 8)[/max-and-min/0] '101': too large (> max 100.0).
363
- :range_toolarge : (line 9)[/max-and-min/1] '100.1': too large (> max 100.0).
364
- :range_toosmall : (line 10)[/max-and-min/2] '9': too small (< min 10.0).
365
- :range_toosmall : (line 11)[/max-and-min/3] '9.99': too small (< min 10.0).
366
- error2: |
367
- :range_toolarge : 2:3:[/max-only/0] '101': too large (> max 100).
368
- :range_toolarge : 3:3:[/max-only/1] '100.1': too large (> max 100).
369
- :range_toosmall : 5:3:[/min-only/0] '9': too small (< min 10.0).
370
- :range_toosmall : 6:3:[/min-only/1] '9.99': too small (< min 10.0).
371
- :range_toolarge : 8:3:[/max-and-min/0] '101': too large (> max 100.0).
372
- :range_toolarge : 9:3:[/max-and-min/1] '100.1': too large (> max 100.0).
373
- :range_toosmall : 10:3:[/max-and-min/2] '9': too small (< min 10.0).
374
- :range_toosmall : 11:3:[/max-and-min/3] '9.99': too small (< min 10.0).
375
- ##
376
- ---
377
- name: range2
378
- desc: range test (with max-ex and min-ex)
379
- #
380
- schema: |
381
- type: map
382
- mapping:
383
- "max-ex-only":
384
- type: seq
385
- sequence:
386
- - type: number
387
- required: yes
388
- range: { max-ex: 100 }
389
- "min-ex-only":
390
- type: seq
391
- sequence:
392
- - type: number
393
- required: yes
394
- range: { min-ex: 10.0 }
395
- "max-ex-and-min-ex":
396
- type: seq
397
- sequence:
398
- - type: number
399
- required: yes
400
- range: { max-ex: 100.0, min-ex: 10.0 }
401
- #
402
- valid: |
403
- max-ex-only:
404
- - 99
405
- - 99.99999
406
- min-ex-only:
407
- - 11
408
- - 10.00001
409
- max-ex-and-min-ex:
410
- - 99
411
- - 11
412
- - 99.99999
413
- - 10.00001
414
- #
415
- invalid: |
416
- max-ex-only:
417
- - 100
418
- - 100.0
419
- min-ex-only:
420
- - 10
421
- - 10.0
422
- max-ex-and-min-ex:
423
- - 100
424
- - 100.0
425
- - 10
426
- - 10.0
427
- #
428
- error: |
429
- :range_toolargeex : (line 2)[/max-ex-only/0] '100': too large (>= max 100).
430
- :range_toolargeex : (line 3)[/max-ex-only/1] '100.0': too large (>= max 100).
431
- :range_toosmallex : (line 5)[/min-ex-only/0] '10': too small (<= min 10.0).
432
- :range_toosmallex : (line 6)[/min-ex-only/1] '10.0': too small (<= min 10.0).
433
- :range_toolargeex : (line 8)[/max-ex-and-min-ex/0] '100': too large (>= max 100.0).
434
- :range_toolargeex : (line 9)[/max-ex-and-min-ex/1] '100.0': too large (>= max 100.0).
435
- :range_toosmallex : (line 10)[/max-ex-and-min-ex/2] '10': too small (<= min 10.0).
436
- :range_toosmallex : (line 11)[/max-ex-and-min-ex/3] '10.0': too small (<= min 10.0).
437
- error2: |
438
- :range_toolargeex : 2:3:[/max-ex-only/0] '100': too large (>= max 100).
439
- :range_toolargeex : 3:3:[/max-ex-only/1] '100.0': too large (>= max 100).
440
- :range_toosmallex : 5:3:[/min-ex-only/0] '10': too small (<= min 10.0).
441
- :range_toosmallex : 6:3:[/min-ex-only/1] '10.0': too small (<= min 10.0).
442
- :range_toolargeex : 8:3:[/max-ex-and-min-ex/0] '100': too large (>= max 100.0).
443
- :range_toolargeex : 9:3:[/max-ex-and-min-ex/1] '100.0': too large (>= max 100.0).
444
- :range_toosmallex : 10:3:[/max-ex-and-min-ex/2] '10': too small (<= min 10.0).
445
- :range_toosmallex : 11:3:[/max-ex-and-min-ex/3] '10.0': too small (<= min 10.0).
446
- ##
447
- ---
448
- name: range3
449
- desc: range test (with max, min, max-ex and min-ex)
450
- #
451
- schema: |
452
- type: map
453
- mapping:
454
- "A":
455
- type: seq
456
- sequence:
457
- - type: number
458
- required: yes
459
- range: { max: 100, min-ex: 10.0 }
460
- "B":
461
- type: seq
462
- sequence:
463
- - type: number
464
- required: yes
465
- range: { min: 10, max-ex: 100.0 }
466
- #
467
- valid: |
468
- A:
469
- - 100
470
- - 10.00001
471
- B:
472
- - 10
473
- - 99.99999
474
- #
475
- invalid: |
476
- A:
477
- - 100.00001
478
- - 10.0
479
- B:
480
- - 9.99999
481
- - 100.0
482
- #
483
- error: |
484
- :range_toolarge : (line 2)[/A/0] '100.00001': too large (> max 100).
485
- :range_toosmallex : (line 3)[/A/1] '10.0': too small (<= min 10.0).
486
- :range_toosmall : (line 5)[/B/0] '9.99999': too small (< min 10).
487
- :range_toolargeex : (line 6)[/B/1] '100.0': too large (>= max 100.0).
488
- error2: |
489
- :range_toolarge : 2:3:[/A/0] '100.00001': too large (> max 100).
490
- :range_toosmallex : 3:3:[/A/1] '10.0': too small (<= min 10.0).
491
- :range_toosmall : 5:3:[/B/0] '9.99999': too small (< min 10).
492
- :range_toolargeex : 6:3:[/B/1] '100.0': too large (>= max 100.0).
493
- ##
494
- ---
495
- name: length1
496
- desc: length test
497
- #
498
- schema: |
499
- type: map
500
- mapping:
501
- "max-only":
502
- type: seq
503
- sequence:
504
- - type: str
505
- length: { max: 8 }
506
- "min-only":
507
- type: seq
508
- sequence:
509
- - type: str
510
- length: { min: 4 }
511
- "max-and-min":
512
- type: seq
513
- sequence:
514
- - type: str
515
- length: { max: 8, min: 4 }
516
- #
517
- valid: |
518
- max-only:
519
- - hogehoge
520
- - a
521
- -
522
- min-only:
523
- - hoge
524
- - hogehogehogehogehoge
525
- max-and-min:
526
- - hogehoge
527
- - hoge
528
- #
529
- invalid: |
530
- max-only:
531
- - hogehoge!
532
- min-only:
533
- - foo
534
- -
535
- max-and-min:
536
- - foobarbaz
537
- - foo
538
- #
539
- error: |
540
- :length_toolong : (line 2)[/max-only/0] 'hogehoge!': too long (length 9 > max 8).
541
- :length_tooshort : (line 4)[/min-only/0] 'foo': too short (length 3 < min 4).
542
- :length_toolong : (line 7)[/max-and-min/0] 'foobarbaz': too long (length 9 > max 8).
543
- :length_tooshort : (line 8)[/max-and-min/1] 'foo': too short (length 3 < min 4).
544
- error2: |
545
- :length_toolong : 2:3:[/max-only/0] 'hogehoge!': too long (length 9 > max 8).
546
- :length_tooshort : 4:3:[/min-only/0] 'foo': too short (length 3 < min 4).
547
- :length_toolong : 7:3:[/max-and-min/0] 'foobarbaz': too long (length 9 > max 8).
548
- :length_tooshort : 8:3:[/max-and-min/1] 'foo': too short (length 3 < min 4).
549
- ##
550
- ---
551
- name: length2
552
- desc: length test (with max-ex and min-ex)
553
- #
554
- schema: |
555
- type: map
556
- mapping:
557
- "max-ex-only":
558
- type: seq
559
- sequence:
560
- - type: str
561
- length: { max-ex: 8 }
562
- "min-ex-only":
563
- type: seq
564
- sequence:
565
- - type: str
566
- length: { min-ex: 4 }
567
- "max-ex-and-min-ex":
568
- type: seq
569
- sequence:
570
- - type: str
571
- length: { max-ex: 8, min-ex: 4 }
572
- #
573
- valid: |
574
- max-ex-only:
575
- - hogehog
576
- - a
577
- -
578
- min-ex-only:
579
- - hoge!
580
- max-ex-and-min-ex:
581
- - hogehog
582
- - hoge!
583
- #
584
- invalid: |
585
- max-ex-only:
586
- - hogehoge
587
- min-ex-only:
588
- - foo!
589
- -
590
- max-ex-and-min-ex:
591
- - foobarba
592
- - foo!
593
- #
594
- error: |
595
- :length_toolongex : (line 2)[/max-ex-only/0] 'hogehoge': too long (length 8 >= max 8).
596
- :length_tooshortex : (line 4)[/min-ex-only/0] 'foo!': too short (length 4 <= min 4).
597
- :length_toolongex : (line 7)[/max-ex-and-min-ex/0] 'foobarba': too long (length 8 >= max 8).
598
- :length_tooshortex : (line 8)[/max-ex-and-min-ex/1] 'foo!': too short (length 4 <= min 4).
599
- error2: |
600
- :length_toolongex : 2:3:[/max-ex-only/0] 'hogehoge': too long (length 8 >= max 8).
601
- :length_tooshortex : 4:3:[/min-ex-only/0] 'foo!': too short (length 4 <= min 4).
602
- :length_toolongex : 7:3:[/max-ex-and-min-ex/0] 'foobarba': too long (length 8 >= max 8).
603
- :length_tooshortex : 8:3:[/max-ex-and-min-ex/1] 'foo!': too short (length 4 <= min 4).
604
- ##
605
- ---
606
- name: length3
607
- desc: length test (with min, max, max-ex and min-ex)
608
- #
609
- schema: |
610
- type: map
611
- mapping:
612
- "A":
613
- type: seq
614
- sequence:
615
- - type: str
616
- length: { max: 8, min-ex: 4 }
617
- "B":
618
- type: seq
619
- sequence:
620
- - type: str
621
- length: { max-ex: 8, min: 4 }
622
- #
623
- valid: |
624
- A:
625
- - hogehoge
626
- - hogeh
627
- B:
628
- - hogehog
629
- - hoge
630
- #
631
- invalid: |
632
- A:
633
- - hogehoge!
634
- - hoge
635
- B:
636
- - hogehoge
637
- - hog
638
- #
639
- error: |
640
- :length_toolong : (line 2)[/A/0] 'hogehoge!': too long (length 9 > max 8).
641
- :length_tooshortex : (line 3)[/A/1] 'hoge': too short (length 4 <= min 4).
642
- :length_toolongex : (line 5)[/B/0] 'hogehoge': too long (length 8 >= max 8).
643
- :length_tooshort : (line 6)[/B/1] 'hog': too short (length 3 < min 4).
644
- error2: |
645
- :length_toolong : 2:3:[/A/0] 'hogehoge!': too long (length 9 > max 8).
646
- :length_tooshortex : 3:3:[/A/1] 'hoge': too short (length 4 <= min 4).
647
- :length_toolongex : 5:3:[/B/0] 'hogehoge': too long (length 8 >= max 8).
648
- :length_tooshort : 6:3:[/B/1] 'hog': too short (length 3 < min 4).
649
- ##
650
- ---
651
- name: assert1
652
- desc: assert test
653
- #
654
- schema: |
655
- type: seq
656
- sequence:
657
- - type: map
658
- mapping:
659
- "less-than":
660
- type: number
661
- assert: val < 8
662
- "more-than":
663
- type: number
664
- assert: 3 < val
665
- "between":
666
- type: number
667
- assert: 3 < val && val < 8
668
- "except":
669
- type: number
670
- assert: val < 3 || 8 < val
671
- #
672
- valid: |
673
- - less-than: 5
674
- - more-than: 5
675
- - between: 5
676
- - except: 0
677
- #
678
- invalid*:
679
- java: ~
680
- ruby: |
681
- - less-than: 8
682
- - more-than: 3
683
- - between: 2.9
684
- - except: 3.1
685
- #
686
- error: |
687
- :assert_failed : (line 1)[/0/less-than] '8': assertion expression failed (val < 8).
688
- :assert_failed : (line 2)[/1/more-than] '3': assertion expression failed (3 < val).
689
- :assert_failed : (line 3)[/2/between] '2.9': assertion expression failed (3 < val && val < 8).
690
- :assert_failed : (line 4)[/3/except] '3.1': assertion expression failed (val < 3 || 8 < val).
691
- error2: |
692
- :assert_failed : 1:3:[/0/less-than] '8': assertion expression failed (val < 8).
693
- :assert_failed : 2:3:[/1/more-than] '3': assertion expression failed (3 < val).
694
- :assert_failed : 3:3:[/2/between] '2.9': assertion expression failed (3 < val && val < 8).
695
- :assert_failed : 4:3:[/3/except] '3.1': assertion expression failed (val < 3 || 8 < val).
696
- ##
697
- ---
698
- name: deftype1
699
- desc: default type test
700
- #
701
- schema: |
702
- type: seq
703
- sequence:
704
- - type: map
705
- mapping:
706
- "name":
707
- "email":
708
- #
709
- valid: |
710
- - name: foo
711
- email: foo@mail.com
712
- - name: bar
713
- - email: baz@mail.com
714
- #
715
- invalid: |
716
- - name: 123
717
- email: true
718
- - name: 3.14
719
- - email: 2004-01-01
720
- #
721
- error*:
722
- ruby: |
723
- :type_unmatch : (line 1)[/0/name] '123': not a string.
724
- :type_unmatch : (line 2)[/0/email] 'true': not a string.
725
- :type_unmatch : (line 3)[/1/name] '3.14': not a string.
726
- :type_unmatch : (line 4)[/2/email] '2004-01-01': not a string.
727
- java: |
728
- :type_unmatch : (line 1)[/0/name] '123': not a string.
729
- :type_unmatch : (line 2)[/0/email] 'true': not a string.
730
- :type_unmatch : (line 3)[/1/name] '3.14': not a string.
731
- :type_unmatch : (line 4)[/2/email] 'Sun Feb 01 00:00:00 JST 2004': not a string.
732
- error2*:
733
- ruby: |
734
- :type_unmatch : 1:3:[/0/name] '123': not a string.
735
- :type_unmatch : 2:3:[/0/email] 'true': not a string.
736
- :type_unmatch : 3:3:[/1/name] '3.14': not a string.
737
- :type_unmatch : 4:3:[/2/email] '2004-01-01': not a string.
738
- java: |
739
- :type_unmatch : 1:3:[/0/name] '123': not a string.
740
- :type_unmatch : 2:3:[/0/email] 'true': not a string.
741
- :type_unmatch : 3:3:[/1/name] '3.14': not a string.
742
- :type_unmatch : 4:3:[/2/email] 'Sun Feb 01 00:00:00 JST 2004': not a string.
743
- ##
744
- ---
745
- name: ident1
746
- desc: ident constraint test
747
- #
748
- schema: |
749
- type: seq
750
- sequence:
751
- - type: map
752
- mapping:
753
- "name":
754
- ident: yes
755
- "age":
756
- type: int
757
- #
758
- valid: |
759
- - name: foo
760
- age: 10
761
- - name: bar
762
- age: 10
763
- - name: baz
764
- age: 10
765
- #
766
- invalid: |
767
- - name: foo
768
- age: 10
769
- - name: bar
770
- age: 10
771
- - name: bar
772
- age: 10
773
- #
774
- error: |
775
- :value_notunique : (line 5)[/2/name] 'bar': is already used at '/1/name'.
776
- error2: |
777
- :value_notunique : 5:3:[/2/name] 'bar': is already used at '/1/name'.
778
- ##
779
- ---
780
- name: unique1
781
- desc: unique constraint test with map
782
- #
783
- schema: |
784
- type: seq
785
- sequence:
786
- - type: map
787
- mapping:
788
- "name":
789
- unique: yes
790
- "age":
791
- type: int
792
- #
793
- valid: |
794
- - name: foo
795
- age: 10
796
- - name: bar
797
- age: 10
798
- - name: baz
799
- age: 10
800
- #
801
- invalid: |
802
- - name: foo
803
- age: 10
804
- - name: bar
805
- age: 10
806
- - age: 10
807
- name: bar
808
- #
809
- error: |
810
- :value_notunique : (line 6)[/2/name] 'bar': is already used at '/1/name'.
811
- error2: |
812
- :value_notunique : 6:3:[/2/name] 'bar': is already used at '/1/name'.
813
- ##
814
- ---
815
- name: unique2
816
- desc: unique constraint test with seq
817
- #
818
- schema: |
819
- type: seq
820
- sequence:
821
- - type: str
822
- unique: yes
823
- #
824
- valid: |
825
- - foo
826
- - ~
827
- - bar
828
- - ~
829
- - baz
830
- #
831
- invalid: |
832
- - foo
833
- - ~
834
- - bar
835
- - ~
836
- - bar
837
- #
838
- error: |
839
- :value_notunique : (line 5)[/4] 'bar': is already used at '/2'.
840
- error2: |
841
- :value_notunique : 5:1:[/4] 'bar': is already used at '/2'.
842
- ##
843
- ---
844
- name: unique3
845
- desc: unique constraint and '<<' (merge)
846
- #
847
- schema: |
848
- type: seq
849
- sequence:
850
- - type: map
851
- mapping:
852
- "name": { type: str, required: yes, unique: yes }
853
- "value": { type: any, required: yes }
854
- #
855
- valid: |
856
- # no sense
857
- - name: x1
858
- value: 10
859
- - name: x2
860
- value: 20
861
- #
862
- invalid: |
863
- - &a1
864
- name: x1
865
- value: 10
866
- - <<: *a1
867
- - <<: *a1 # wrong validation error
868
- name: x3
869
- #
870
- error: |
871
- :value_notunique : (line 2)[/1/name] 'x1': is already used at '/0/name'.
872
- error2: |
873
- :value_notunique : 4:3:[/1/name] 'x1': is already used at '/0/name'.
874
- :value_notunique : 5:3:[/2/name] 'x1': is already used at '/0/name'.
875
- memo: |
876
- * '(line 2)' is not expected line number.
877
- ##
878
- ---
879
- name: unique4
880
- desc: unique constrant and anchor
881
- #
882
- schema: |
883
- type: seq
884
- sequence:
885
- - type: map
886
- mapping:
887
- "name": { type: str }
888
- "value": { type: any }
889
- #
890
- valid: |
891
- # no sense
892
- - name: x1
893
- value: 10
894
- - name: x2
895
- value: 20
896
- #
897
- invalid: |
898
- - &a1
899
- name: x1
900
- value: 10
901
- - name: x2
902
- value: 20
903
- - *a1
904
- #
905
- error: |
906
- # :value_notunique : (line 6)[/2/name] 'x1': is already used at '/0/name'.
907
- error2: |
908
- memo: |
909
- * validation error should be reported but not reported.
910
- ##
911
- ---
912
- name: default1
913
- desc: default value of map
914
- #
915
- schema: |
916
- type: map
917
- mapping:
918
- =:
919
- type: number
920
- range: { min: -10, max: 10 }
921
- #
922
- valid: |
923
- value1: 0
924
- value2: 10
925
- value3: -10
926
- #
927
- invalid: |
928
- value1: 0
929
- value2: 20
930
- value3: -20
931
- error: |
932
- :range_toolarge : (line 2)[/value2] '20': too large (> max 10).
933
- :range_toosmall : (line 3)[/value3] '-20': too small (< min -10).
934
- error2: |
935
- :range_toolarge : 2:1:[/value2] '20': too large (> max 10).
936
- :range_toosmall : 3:1:[/value3] '-20': too small (< min -10).
937
- ##
938
- ---
939
- name: merge1
940
- desc: merge maps
941
- #
942
- schema: |
943
- type: map
944
- mapping:
945
- "group":
946
- type: map
947
- mapping:
948
- "name": &name
949
- type: str
950
- required: yes
951
- "email": &email
952
- type: str
953
- pattern: /@/
954
- required: no
955
- "user":
956
- type: map
957
- mapping:
958
- "name":
959
- <<: *name # merge
960
- length: { max: 16 } # add
961
- "email":
962
- <<: *email # merge
963
- required: yes # override
964
- #
965
- valid: |
966
- group:
967
- name: foo
968
- email: foo@mail.com
969
- user:
970
- name: bar
971
- email: bar@mail.com
972
- #
973
- invalid: |
974
- group:
975
- name: foo
976
- email: foo@mail.com
977
- user:
978
- name: toooooo-looooong-naaaame
979
- #
980
- error: |
981
- :required_nokey : (line 4)[/user] key 'email:' is required.
982
- :length_toolong : (line 5)[/user/name] 'toooooo-looooong-naaaame': too long (length 24 > max 16).
983
- error2: |
984
- :required_nokey : 5:3:[/user] key 'email:' is required.
985
- :length_toolong : 5:3:[/user/name] 'toooooo-looooong-naaaame': too long (length 24 > max 16).
986
- ##