dry-validation 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2deba7f8bd2d4ad011e0f4be2aa20d4f20d219d85d0eeec23d3b3e0b12c0bcf4
4
+ data.tar.gz: 12f9500062c0239d19f6bf32450db22065a9caa3062e4cb71d79a9370c3229ec
5
+ SHA512:
6
+ metadata.gz: be6cf6d5dfce8ebec88743b7661eaf4d3cc1294cea249b87e7c02fd00b36013a033fe5feab1ccdb3e6e6020873435fbfc5bf6ee41b5f76836358973f5074843e
7
+ data.tar.gz: 77f87593b028dfa608f22835413a73fcbd7c2585e9a98c95f20a158df47fc5ca3f46a0357188f5bd1fc37140de7b57b833ae969aabe55bbdf71628f7db6f645e
@@ -0,0 +1,869 @@
1
+ ## unreleased
2
+
3
+
4
+ ### Fixed
5
+
6
+ - dry-monads no longer required for the `:hints` extension (@schokomarie)
7
+ - Using `full: true` option works as expected with custom rule messages (issue #618 fixed via #651) (@sirfilip)
8
+ - Using `locale: ...` option works as expected with hints (issue #589 fixed via #652) (@sirfilip)
9
+
10
+
11
+ [Compare v1.5.0...master](https://github.com/dry-rb/dry-validation/compare/v1.5.0...master)
12
+
13
+ ## 1.5.0 2020-03-11
14
+
15
+
16
+ ### Added
17
+
18
+ - `schema_error?` rule helper (@waiting-for-dev)
19
+ - `rule_error?` rule helper (@waiting-for-dev)
20
+
21
+ ### Changed
22
+
23
+ - dry-schema dependency was bumped to `~> 1.5` (@solnic)
24
+ - [internal] `KeyMap` patches have been removed since dry-schema now provides required functionality (@solnic)
25
+
26
+ [Compare v1.4.2...v1.5.0](https://github.com/dry-rb/dry-validation/compare/v1.4.2...v1.5.0)
27
+
28
+ ## 1.4.2 2020-01-18
29
+
30
+
31
+ ### Fixed
32
+
33
+ - Macros using predicates that accept a range argument work as expected (no need to wrap the argument in an array) (@waiting-for-dev)
34
+
35
+
36
+ [Compare v1.4.1...v1.4.2](https://github.com/dry-rb/dry-validation/compare/v1.4.1...v1.4.2)
37
+
38
+ ## 1.4.1 2020-01-08
39
+
40
+
41
+ ### Added
42
+
43
+ - Pattern matching on result values (@flash-gordon)
44
+
45
+ ### Fixed
46
+
47
+ - List tokens are correctly interpolated as a comma separated list in rule messages (see #611) (@waiting-for-dev)
48
+ - Warnings about delegated keywords (@flash-gordon)
49
+
50
+
51
+ [Compare v1.4.0...v1.4.1](https://github.com/dry-rb/dry-validation/compare/v1.4.0...v1.4.1)
52
+
53
+ ## 1.4.0 2019-12-12
54
+
55
+
56
+ ### Added
57
+
58
+ - Support for multi-schema inheritance (@ianwhite)
59
+
60
+ ### Fixed
61
+
62
+ - Keyword warnings reported by Ruby 2.7 (@flash-gordon)
63
+ - Fixed an issue where `MessageSet` would be marked as empty too early (@ianwhite)
64
+ - Messages are correctly generated when there are errors for both an array and one or more of its elements (see #599) (@Bugagazavr)
65
+
66
+ ### Changed
67
+
68
+ - A meaningful exception is raised when failure options are not valid (@MatElGran)
69
+ - [internal] improved performance in `Contract.ensure_valid_keys` (@grzegorz-jakubiak)
70
+ - [internal] fixed keyword warnings on MRI 2.7.0 (@flash-gordon)
71
+
72
+ [Compare v1.3.1...v1.4.0](https://github.com/dry-rb/dry-validation/compare/v1.3.1...v1.4.0)
73
+
74
+ ## 1.3.1 2019-08-16
75
+
76
+
77
+ ### Changed
78
+
79
+ - You can now set an external schema without providing a block (@alassek)
80
+
81
+ [Compare v1.3.0...v1.3.1](https://github.com/dry-rb/dry-validation/compare/v1.3.0...v1.3.1)
82
+
83
+ ## 1.3.0 2019-08-14
84
+
85
+
86
+ ### Added
87
+
88
+ - Support for setting an external schema (that can be extended too) (fixed #574) (@solnic)
89
+
90
+ ### Fixed
91
+
92
+ - Using a hash spec to define rule keys with more than one value is properly handled by rule guard now (fixed #576) (@solnic)
93
+
94
+ ### Changed
95
+
96
+ - `values` within rules uses `Hash#fetch_values` internally now, which improves performance (@esparta)
97
+
98
+ [Compare v1.2.1...v1.3.0](https://github.com/dry-rb/dry-validation/compare/v1.2.1...v1.3.0)
99
+
100
+ ## 1.2.1 2019-07-16
101
+
102
+
103
+ ### Fixed
104
+
105
+ - Defining an abstract contract class that has no schema no longer crashes (issue #565) (@solnic)
106
+ - Fixed an issue where `Rule#each` would crash when the value is not an array (issue #567) (@solnic)
107
+ - Fixed an issue where guarding a rule would crash when keys are missing in the input (issue #569) (@solnic)
108
+ - Added missing "pathname" require (issue #570) (@solnic)
109
+
110
+
111
+ [Compare v1.2.0...v1.2.1](https://github.com/dry-rb/dry-validation/compare/v1.2.0...v1.2.1)
112
+
113
+ ## 1.2.0 2019-07-08
114
+
115
+
116
+ ### Added
117
+
118
+ - New extension `:predicates_as_macros` (@waiting-for-dev)
119
+
120
+ ### Fixed
121
+
122
+ - Guarding rules for nested keys works correctly (issue #560) (@solnic)
123
+
124
+ ### Changed
125
+
126
+ - `dry-schema` dependency was bumped to `>= 1.3.1` (@solnic)
127
+
128
+ [Compare v1.1.1...v1.2.0](https://github.com/dry-rb/dry-validation/compare/v1.1.1...v1.2.0)
129
+
130
+ ## 1.1.1 2019-06-24
131
+
132
+
133
+ ### Fixed
134
+
135
+ - `Rule#each` works with array values from nested hashes (@mustardnoise)
136
+
137
+
138
+ [Compare v1.1.0...v1.1.1](https://github.com/dry-rb/dry-validation/compare/v1.1.0...v1.1.1)
139
+
140
+ ## 1.1.0 2019-06-14
141
+
142
+
143
+ ### Added
144
+
145
+ - `key?` method available within rules, that can be used to check if there's a value under the rule's default key (refs #540) (@solnic)
146
+ - `value` supports hash-based path specifications now (refs #547) (@solnic)
147
+ - `value` can read multiple values when the key points to them, ie in case of `rule(geo: [:lat, :lon])` it would return an array with `lat` and `lon` (@solnic)
148
+
149
+ ### Fixed
150
+
151
+ - Passing multiple macro names to `validate` or `each` works correctly (fixed #538 #541) (@jandudulski)
152
+
153
+
154
+ [Compare v1.0.0...v1.1.0](https://github.com/dry-rb/dry-validation/compare/v1.0.0...v1.1.0)
155
+
156
+ ## 1.0.0 2019-06-10
157
+
158
+ See [the list of all addressed issues](https://github.com/dry-rb/dry-validation/issues?utf8=✓&q=is%3Aissue+is%3Aclosed+closed%3A%3E%3D2019-01-01+) as well as issues that were moved to dry-schema and [addressed there](https://github.com/dry-rb/dry-schema/issues?q=is%3Aissue+is%3Aclosed+dry-validation+milestone%3A1.0.0).
159
+
160
+
161
+ [Compare v1.0.0...v1.0.0](https://github.com/dry-rb/dry-validation/compare/v1.0.0...v1.0.0)
162
+
163
+ ## 1.0.0 2019-06-10
164
+
165
+
166
+ ### Added
167
+
168
+ - Support for defining rules for each element of an array via `rule(:items).each { ... }` (solnic)
169
+ - Support for parameterized macros via `rule(:foo).validate(my_macro: :some_option)` (solnic)
170
+ - `values#[]` is now compatible with path specs (symbol, array with keys or dot-notation) (issue #528) (solnic)
171
+ - `value` shortcut for accessing the value found under the first key specified by a rule. ie `rule(:foo) { value }` returns `values[:foo]` (solnic)
172
+
173
+ ### Fixed
174
+
175
+ - Contract's `config.locale` option was replaced by `config.messages.default_locale` to avoid conflicts with run-time `:locale` option and/or whatever is set via `I18n` gem (solnic)
176
+ - Macros no longer mutate `Dry::Validation::Contract.macros` when using inheritance (solnic)
177
+ - Missing dependency on `dry-container` was added (solnic)
178
+
179
+ ### Changed
180
+
181
+ - `rule` will raise `InvalidKeysError` when specified keys are not defined by the schema (solnic)
182
+ - `Contract.new` will raise `SchemaMissingError` when the class doesn't have schema defined (solnic)
183
+ - Contracts no longer support `:locale` option in the constructor. Use `Result#errors(locale: :pl)` to change locale at run-time (solnic)
184
+
185
+ [Compare v1.0.0.rc3...v1.0.0](https://github.com/dry-rb/dry-validation/compare/v1.0.0.rc3...v1.0.0)
186
+
187
+ ## 1.0.0.rc3 2019-05-06
188
+
189
+
190
+ ### Added
191
+
192
+ - [EXPERIMENTAL] `Validation.register_macro` for registering global macros (solnic)
193
+ - [EXPERIMENTAL] `Contract.register_macro` for registering macros available to specific contract classes (solnic)
194
+ - `Dry::Validation.Contract` shortcut for quickly defining a contract and getting its instance back (solnic)
195
+ - New configuration option `config.locale` for setting the default locale (solnic)
196
+
197
+ ### Fixed
198
+
199
+ - `config/errors.yml` are now bundled with the gem, **`rc2` was broken because of this** (solnic)
200
+
201
+
202
+ [Compare v1.0.0.rc2...v1.0.0.rc3](https://github.com/dry-rb/dry-validation/compare/v1.0.0.rc2...v1.0.0.rc3)
203
+
204
+ ## 1.0.0.rc2 2019-05-04
205
+
206
+ This was **yanked** on rubygems.org because the bundled gem was missing `config` directory, thus it was not possible to require it. It was fixed in `rc3`.
207
+
208
+ ### Added
209
+
210
+ - [EXPERIMENTAL] support for registering macros via `Dry::Validation::Macros.register(:your_macro, &block)` (solnic)
211
+ - [EXPERIMENTAL] `:acceptance` as the first built-in macro (issue #157) (solnic)
212
+
213
+ ### Fixed
214
+
215
+ - Passing invalid argument to `failure` will raise a meaningful error instead of crashing (solnic)
216
+
217
+ ### Changed
218
+
219
+ - In rule validation blocks, `values` is now an instance of a hash-like `Dry::Validation::Values` class, rather than `Dry::Schema::Result`. This gives more convenient access to data within rules (solnic)
220
+ - Dependency on `dry-schema` was updated to `~> 1.0` (solnic)
221
+
222
+ [Compare v1.0.0.rc1...v1.0.0.rc2](https://github.com/dry-rb/dry-validation/compare/v1.0.0.rc1...v1.0.0.rc2)
223
+
224
+ ## 1.0.0.rc1 2019-04-26
225
+
226
+
227
+ ### Added
228
+
229
+ - `:hints` extension is back (solnic)
230
+ - `Result` objects have access to the context object which is shared between rules (flash-gordon)
231
+
232
+ ### Fixed
233
+
234
+ - Multiple hint messages no longer crash message set (flash-gordon)
235
+ - `Contract#inspect` no longer crashes (solnic)
236
+
237
+ ### Changed
238
+
239
+ - Dependency on `dry-schema` was bumped to `~> 0.6` - this pulls in `dry-types 1.0.0` and `dry-logic 1.0.0` (solnic)
240
+ - Dependency on `dry-initializer` was bumped to `~> 3.0` (solnic)
241
+
242
+ [Compare v1.0.0.beta2...v1.0.0.rc1](https://github.com/dry-rb/dry-validation/compare/v1.0.0.beta2...v1.0.0.rc1)
243
+
244
+ ## 1.0.0.beta2 2019-04-04
245
+
246
+
247
+ ### Added
248
+
249
+ - Support for arbitrary meta-data in failures, ie:
250
+
251
+ ```ruby
252
+ class NewUserContract < Dry::Validation::Contract
253
+ params do
254
+ required(:login).filled(:string)
255
+ end
256
+
257
+ rule(:login) do
258
+ key.failure(text: 'is taken', code: 123) unless db.unique?(values[:login])
259
+ end
260
+ end
261
+ ```
262
+
263
+ Now your error hash will include `{ login: [{ text: 'is taken', code: 123 }] }` (solnic + flash-gordon)
264
+
265
+ ### Changed
266
+
267
+ - [BREAKING] `Error` was renamed to `Message` as it is a more generic concept (solnic)
268
+ - [BREAKING] `ErrorSet` was renamed to `MessageSet` for consistency (solnic)
269
+ - [BREAKING] `:monads` extension wraps entire result objects in `Success` or `Failure` (flash-gordon)
270
+
271
+ [Compare v1.0.0.beta1...v1.0.0.beta2](https://github.com/dry-rb/dry-validation/compare/v1.0.0.beta1...v1.0.0.beta2)
272
+
273
+ ## 1.0.0.beta1 2019-03-26
274
+
275
+
276
+ ### Added
277
+
278
+ - New API for setting failures `base.failure` for base errors and `key.failure` for key errors (solnic)
279
+ - Support for `base` errors associated with a key even when child keys have errors too (solnic)
280
+ - Support for `base` errors not associated with any key (solnic)
281
+ - Result objects use `ErrorSet` object now for managing messages (solnic)
282
+ - Nested keys are properly handled when generating messages hash (issue #489) (flash-gordon + solnic)
283
+ - Result objects support `locale` and `full` options now (solnic)
284
+ - Ability to configure `top_namespace` for messages, which will be used for both schema and rule localization (solnic)
285
+ - Rule blocks receive a context object that you can use to share data between rules (solnic)
286
+
287
+ ### Changed
288
+
289
+ - [BREAKING] `Result#errors` returns an instance of `ErrorSet` now, it's an enumerable, coerible to a hash (solnic)
290
+ - [BREAKING] `failure` was removed in favor of `key.failure` or `key(:foo).failure` (solnic)
291
+ - [BREAKING] `Result#to_hash` was removed (flash-gordon)
292
+
293
+ [Compare v1.0.0.alpha2...v1.0.0.beta1](https://github.com/dry-rb/dry-validation/compare/v1.0.0.alpha2...v1.0.0.beta1)
294
+
295
+ ## 1.0.0.alpha2 2019-03-05
296
+
297
+ First round of bug fixes. Thanks for testing <3!
298
+
299
+ ### Fixed
300
+
301
+ - Errors with nested messages are correctly built (flash-gordon)
302
+ - Messages for nested keys are correctly resolved (solnic)
303
+ - A message for a nested key is resolved when it's defined under `errors.rule.%{key}` too, but a message under nested key will override it (solnic)
304
+
305
+ ### Changed
306
+
307
+ - When a message template is not found a more meaningful error is raised that includes both rule identifier and key path (solnic)
308
+
309
+ [Compare v1.0.0.alpha1...v1.0.0.alpha2](https://github.com/dry-rb/dry-validation/compare/v1.0.0.alpha1...v1.0.0.alpha2)
310
+
311
+ ## 1.0.0.alpha1 2019-03-04
312
+
313
+ Complete rewrite on top of `dry-schema`.
314
+
315
+ ### Added
316
+
317
+ - [BREAKING] `Dry::Validation::Contract` as a replacement for validation schemas (solnic)
318
+ - [BREAKING] New `rule` DSL with an improved API for setting error messages (solnic)
319
+
320
+
321
+ [Compare v0.13.0...v1.0.0.alpha1](https://github.com/dry-rb/dry-validation/compare/v0.13.0...v1.0.0.alpha1)
322
+
323
+ ## 0.13.0 2019-01-29
324
+
325
+
326
+ ### Fixed
327
+
328
+ - Warning about method redefined (amatsuda)
329
+
330
+ ### Changed
331
+
332
+ - `dry-logic` was bumped to `~> 0.5` (solnic)
333
+ - `dry-types` was bumped to `~> 0.14` (solnic)
334
+
335
+ [Compare v0.12.3...v0.13.0](https://github.com/dry-rb/dry-validation/compare/v0.12.3...v0.13.0)
336
+
337
+ ## 0.12.3 2019-01-29
338
+
339
+
340
+ ### Changed
341
+
342
+ - [internal] dry-logic was pinned to `~> 0.4.2` (flash-gordon)
343
+
344
+ [Compare v0.12.2...v0.12.3](https://github.com/dry-rb/dry-validation/compare/v0.12.2...v0.12.3)
345
+
346
+ ## 0.12.2 2018-08-29
347
+
348
+
349
+ ### Fixed
350
+
351
+ - Use correct key names for rule messages when using i18n (jozzi05)
352
+
353
+
354
+ [Compare v0.12.1...v0.12.2](https://github.com/dry-rb/dry-validation/compare/v0.12.1...v0.12.2)
355
+
356
+ ## 0.12.1 2018-07-06
357
+
358
+
359
+ ### Fixed
360
+
361
+ - [internal] fixed deprecation warnings (flash-gordon)
362
+
363
+
364
+ [Compare v0.12.0...v0.12.1](https://github.com/dry-rb/dry-validation/compare/v0.12.0...v0.12.1)
365
+
366
+ ## 0.12.0 2018-05-31
367
+
368
+
369
+ ### Changed
370
+
371
+ - Code updated to work with `dry-types` 0.13.1 and `dry-struct` 0.5.0, these are now minimal supported versions (flash-gordon)
372
+ - [BREAKING] `Form` was renamed to `Params` to be consistent with the latest changes from `dry-types`. You can `require 'dry/validation/compat/form'` to use the previous names but it will be removed in the next version (flash-gordon)
373
+
374
+ [Compare v0.11.1...v0.12.0](https://github.com/dry-rb/dry-validation/compare/v0.11.1...v0.12.0)
375
+
376
+ ## 0.11.1 2017-09-15
377
+
378
+
379
+ ### Changed
380
+
381
+ - `Result#to_either` was renamed to `#to_monad`, the previous name is kept for backward compatibility (flash-gordon)
382
+ - [internal] fix warnings from dry-types v0.12.0
383
+
384
+ [Compare v0.11.0...v0.11.1](https://github.com/dry-rb/dry-validation/compare/v0.11.0...v0.11.1)
385
+
386
+ ## 0.11.0 2017-05-30
387
+
388
+
389
+ ### Changed
390
+
391
+ - [internal] input processor compilers have been updated to work with new dry-types' AST (GustavoCaso)
392
+
393
+ [Compare v0.10.7...v0.11.0](https://github.com/dry-rb/dry-validation/compare/v0.10.7...v0.11.0)
394
+
395
+ ## 0.10.7 2017-05-15
396
+
397
+
398
+ ### Fixed
399
+
400
+ - `validate` can now be defined multiple times for the same key (kimquy)
401
+ - Re-using rules between schemas no longer mutates original rule set (pabloh)
402
+
403
+
404
+ [Compare v0.10.6...v0.10.7](https://github.com/dry-rb/dry-validation/compare/v0.10.6...v0.10.7)
405
+
406
+ ## 0.10.6 2017-04-26
407
+
408
+
409
+ ### Fixed
410
+
411
+ - Fixes issue with wrong localized error messages when namespaced messages are used (kbredemeier)
412
+
413
+
414
+ [Compare v0.10.5...v0.10.6](https://github.com/dry-rb/dry-validation/compare/v0.10.5...v0.10.6)
415
+
416
+ ## 0.10.5 2017-01-12
417
+
418
+
419
+ ### Fixed
420
+
421
+ - Warnings under MRI 2.4.0 are gone (koic)
422
+
423
+
424
+ [Compare v0.10.4...v0.10.5](https://github.com/dry-rb/dry-validation/compare/v0.10.4...v0.10.5)
425
+
426
+ ## 0.10.4 2016-12-03
427
+
428
+
429
+ ### Fixed
430
+
431
+ - Updated to dry-core >= 0.2.1 (ruby warnings are gone) (flash-gordon)
432
+ - `format?` predicate is excluded from hints (solnic)
433
+
434
+ ### Changed
435
+
436
+ - `version` file is now required by default (georgemillo)
437
+
438
+ [Compare v0.10.3...v0.10.4](https://github.com/dry-rb/dry-validation/compare/v0.10.3...v0.10.4)
439
+
440
+ ## 0.10.3 2016-09-27
441
+
442
+
443
+ ### Fixed
444
+
445
+ - Custom predicates work correctly with `each` macro (solnic)
446
+
447
+
448
+ [Compare v0.10.2...v0.10.3](https://github.com/dry-rb/dry-validation/compare/v0.10.2...v0.10.3)
449
+
450
+ ## 0.10.2 2016-09-23
451
+
452
+
453
+ ### Fixed
454
+
455
+ - Constrained types + hints work again (solnic)
456
+
457
+
458
+ [Compare v0.10.1...v0.10.2](https://github.com/dry-rb/dry-validation/compare/v0.10.1...v0.10.2)
459
+
460
+ ## 0.10.1 2016-09-22
461
+
462
+
463
+ ### Fixed
464
+
465
+ - Remove obsolete require of `dry/struct` which is now an optional extension (flash-gordon)
466
+
467
+
468
+ [Compare v0.10.0...v0.10.1](https://github.com/dry-rb/dry-validation/compare/v0.10.0...v0.10.1)
469
+
470
+ ## 0.10.0 2016-09-21
471
+
472
+
473
+ ### Added
474
+
475
+ - Support for `validate` DSL which accepts an arbitratry validation block that gets executed in the context of a schema object and is treated as a custom predicate (solnic)
476
+ - Support for `or` error messages ie "must be a string or must be an integer" (solnic)
477
+ - Support for retrieving error messages exclusively via `schema.(input).errors` (solnic)
478
+ - Support for retrieving hint messages exclusively via `schema.(input).hints` (solnic)
479
+ - Support for opt-in extensions loaded via `Dry::Validation.load_extensions(:my_ext)` (flash-gordon)
480
+ - Add `:monads` extension which transforms a result instance to `Either` monad, `schema.(input).to_either` (flash-gordon)
481
+ - Add `dry-struct` integration via an extension activated by `Dry::Validation.load_extensions(:struct)` (flash-gordon)
482
+
483
+ ### Fixed
484
+
485
+ - Input rules (defined via `input` macro) are now lazy-initialized which makes it work with predicates defined on the schema object (solnic)
486
+ - Hints are properly generated based on argument type in cases like `size?`, where the message should be different for strings (uses "length") or other types (uses "size") (solnic)
487
+ - Defining nested keys without `schema` blocks results in `ArgumentError` (solnic)
488
+
489
+ ### Changed
490
+
491
+ - [BREAKING] `when` macro no longer supports multiple disconnected rules in its block, whatever the block returns will be used for the implication (solnic)
492
+ - [BREAKING] `rule(some_name: %i(some keys))` will _always_ use `:some_name` as the key for failure messages (solnic)
493
+
494
+ [Compare v0.9.5...v0.10.0](https://github.com/dry-rb/dry-validation/compare/v0.9.5...v0.10.0)
495
+
496
+ ## 0.9.5 2016-08-16
497
+
498
+
499
+ ### Fixed
500
+
501
+ - Infering multiple predicates with options works as expected ie `value(:str?, min_size?: 3, max_size?: 6)` (solnic)
502
+ - Default `locale` configured in `I18n` is now respected by the messages compiler (agustin + cavi21)
503
+
504
+
505
+ [Compare v0.9.4...v0.9.5](https://github.com/dry-rb/dry-validation/compare/v0.9.4...v0.9.5)
506
+
507
+ ## 0.9.4 2016-08-11
508
+
509
+
510
+ ### Fixed
511
+
512
+ - Error messages for sibling deeply nested schemas are nested correctly (timriley)
513
+
514
+
515
+ [Compare v0.9.3...v0.9.4](https://github.com/dry-rb/dry-validation/compare/v0.9.3...v0.9.4)
516
+
517
+ ## 0.9.3 2016-07-22
518
+
519
+
520
+ ### Added
521
+
522
+ - Support for range arg in error messages for `excluded_from?` and `included_in?` (mrbongiolo)
523
+ - `Result#message_set` returns raw message set object (solnic)
524
+
525
+ ### Fixed
526
+
527
+ - Error messages for high-level rules in nested schemas are nested correctly (solnic)
528
+ - Dumping error messages works with high-level rules relying on the same value (solnic)
529
+
530
+ ### Changed
531
+
532
+ - `#messages` is no longer memoized (solnic)
533
+
534
+ [Compare v0.9.2...v0.9.3](https://github.com/dry-rb/dry-validation/compare/v0.9.2...v0.9.3)
535
+
536
+ ## 0.9.2 2016-07-13
537
+
538
+
539
+ ### Fixed
540
+
541
+ - Constrained types now work with `each` macro (solnic)
542
+ - Array coercion without member type works now ie `required(:arr).maybe(:array?)` (solnic)
543
+
544
+
545
+ [Compare v0.9.1...v0.9.2](https://github.com/dry-rb/dry-validation/compare/v0.9.1...v0.9.2)
546
+
547
+ ## 0.9.1 2016-07-11
548
+
549
+
550
+ ### Fixed
551
+
552
+ - `I18n` backend is no longer required and set by default (solnic)
553
+
554
+
555
+ [Compare v0.9.0...v0.9.1](https://github.com/dry-rb/dry-validation/compare/v0.9.0...v0.9.1)
556
+
557
+ ## 0.9.0 2016-07-08
558
+
559
+
560
+ ### Added
561
+
562
+ - Support for defining maybe-schemas via `maybe { schema { .. } }` (solnic)
563
+ - Support for interpolation of custom failure messages for custom rules (solnic)
564
+ - Support for defining a base schema **class** with config and rules (solnic)
565
+ - Support for more than 1 predicate in `input` macro (solnic)
566
+ - Class-level `define!` API for defining rules on a class (solnic)
567
+ - `:i18n` messages support merging from other paths via `messages_file` setting (solnic)
568
+ - Support for message token transformations in custom predicates (fran-worley)
569
+ - [EXPERIMENTAL] Ability to compose predicates that accept dynamic args provided by the schema (solnic)
570
+
571
+ ### Fixed
572
+
573
+ - Duped key names in nested schemas no longer result in invalid error messages structure (solnic)
574
+ - Error message structure for deeply nested each/schema rules (solnic)
575
+ - Values from `option` are passed down to nested schemas when using `Schema#with` (solnic)
576
+ - Hints now work with array elements too (solnic)
577
+ - Hints for elements are no longer provided for an array when the value is not an array (solnic)
578
+ - `input` macro no longer messes up error messages for nested structures (solnic)
579
+
580
+ ### Changed
581
+
582
+ - Tokens for `size?` were renamed `left` => `size_left` and `right` => `size_right` (fran-worley)
583
+
584
+ [Compare v0.8.0...v0.9.0](https://github.com/dry-rb/dry-validation/compare/v0.8.0...v0.9.0)
585
+
586
+ ## 0.8.0 2016-07-01
587
+
588
+
589
+ ### Added
590
+
591
+ - Explicit interface for type specs used to set up coercions, ie `required(:age, :int)` (solnic)
592
+ - Support new dry-logic predicates: `:excluded_from?`, `:excludes?`, `:included_in?`, `:includes?`, `:not_eql?`, `:odd?`, `:even?` (jodosha, fran-worley)
593
+ - Support for blocks in `value`, `filled` and `maybe` macros (solnic)
594
+ - Support for passing a schema to `value|filled|maybe` macros ie `maybe(SomeSchema)` (solnic)
595
+ - Support for `each(SomeSchema)` (solnic)
596
+ - Support for `value|filled|maybe` macros + `each` inside a block ie: `maybe(:filled?) { each(:int?) }` (solnic)
597
+ - Support for dedicated hint messages via `en.errors.#{predicate}.(hint|failure)` look-up paths (solnic)
598
+ - Support for configuring custom DSL extensions via `dsl_extensions` setting on Schema class (solnic)
599
+ - Support for preconfiguring a predicate for the input value ie `value :hash?` used for prerequisite-checks (solnic)
600
+ - Infer coercion from constrained types (solnic)
601
+ - Add value macro (coop)
602
+ - Enable .schema to accept objects that respond to #schema (ttdonovan)
603
+ - Support for schema predicates which don't need any arguments (fran-worley)
604
+ - Error and hint messages have access to all predicate arguments by default (fran-worley+solnic)
605
+ - Invalid predicate name in DSL will raise an error (solnic)
606
+ - Predicate with invalid arity in DSL will raise an error (solnic)
607
+
608
+ ### Fixed
609
+
610
+ - Support for jRuby 9.1.1.0 (flash-gordon)
611
+ - Fix bug when using predicates with options in each and when (fran-worley)
612
+ - Fix bug when validating custom types (coop)
613
+ - Fix depending on deeply nested values in high-lvl rules (solnic)
614
+ - Fix duplicated error message for lt? when hint was used (solnic)
615
+ - Fix hints for nested schemas (solnic)
616
+ - Fix an issue where rules with same names inside nested schemas have incorrect hints (solnic)
617
+ - Fix a bug where hints were being generated 4 times (solnic)
618
+ - Fix duplicated error messages when message is different than a hint (solnic)
619
+
620
+ ### Changed
621
+
622
+ - Uses new `:weak` hash constructor from dry-types 0.8.0 which can partially coerce invalid hash (solnic)
623
+ - `key` has been deprecated in favor of `required` (coop)
624
+ - `required` has been deprecated in favor of `filled` (coop)
625
+ - Now relies on dry-logic v0.3.0 and dry-types v0.8.0 (fran-worley)
626
+ - Tring to use illogical predicates with maybe and filled macros now raise InvalidSchemaError (fran-worley)
627
+ - Enable coercion on form.true and form.false (fran-worley)
628
+ - Remove attr (will be extracted to a separate gem) (coop)
629
+ - Deprecate required in favour of filled (coop)
630
+ - Deprecate key in favor of required (coop)
631
+ - Remove nested key syntax (solnic)
632
+
633
+ [Compare v0.7.4...v0.8.0](https://github.com/dry-rb/dry-validation/compare/v0.7.4...v0.8.0)
634
+
635
+ ## 0.7.4 2016-04-06
636
+
637
+
638
+ ### Added
639
+
640
+ - `Schema.JSON` with json-specific coercions (coop)
641
+ - Support for error messages for `odd? and`even?` predicates (fran-worley)
642
+
643
+ ### Fixed
644
+
645
+ - Depending on deeply nested values in high-level rules works now (solnic)
646
+
647
+
648
+ [Compare v0.7.3...v0.7.4](https://github.com/dry-rb/dry-validation/compare/v0.7.3...v0.7.4)
649
+
650
+ ## 0.7.3 2016-03-30
651
+
652
+
653
+ ### Added
654
+
655
+ - Support for inferring rules from constrained type (coop + solnic)
656
+ - Support for inferring nested schemas from `Dry::Types::Struct` classes (coop)
657
+ - Support for `number?` predicate (solnic)
658
+
659
+ ### Fixed
660
+
661
+ - Creating a nested schema properly sets full path to nested data structure (solnic)
662
+ - Error message for `empty?` predicate is now correct (jodosha)
663
+
664
+
665
+ [Compare v0.7.2...v0.7.3](https://github.com/dry-rb/dry-validation/compare/v0.7.2...v0.7.3)
666
+
667
+ ## 0.7.2 2016-03-28
668
+
669
+
670
+ ### Added
671
+
672
+ - Support for nested schemas inside high-level rules (solnic)
673
+ - `Schema#to_proc` so that you can do `data.each(&schema)` (solnic)
674
+
675
+
676
+ [Compare v0.7.1...v0.7.2](https://github.com/dry-rb/dry-validation/compare/v0.7.1...v0.7.2)
677
+
678
+ ## 0.7.1 2016-03-21
679
+
680
+
681
+ ### Added
682
+
683
+ - You can use `schema` inside `each` macro (solnic)
684
+
685
+ ### Fixed
686
+
687
+ - `confirmation` macro defines an optional key with maybe value with `_confirmation` suffix (solnic)
688
+ - `each` macro works correctly when its inner rule specify just one key (solnic)
689
+ - error messages for `each` rules where input is equal are now correctly generated (solnic)
690
+
691
+ ### Changed
692
+
693
+ - Now depends on `dry-logic` >= `0.2.1` (solnic)
694
+
695
+ [Compare v0.7.0...v0.7.1](https://github.com/dry-rb/dry-validation/compare/v0.7.0...v0.7.1)
696
+
697
+ ## 0.7.0 2016-03-16
698
+
699
+
700
+ ### Added
701
+
702
+ - Support for macros:
703
+ - `required` - when value must be filled
704
+ - `maybe` - when value can be nil (or empty, in case of `Form`)
705
+ - `when` - for composing high-level rule based on predicates applied to a
706
+ validated value
707
+ - `confirmation` - for confirmation validation
708
+ - Support for `value(:foo).eql?(value(:bar))` syntax in high-level rules (solnic)
709
+ - New DSL for defining schema objects `Dry::Validation.Schema do .. end` (solnic)
710
+ - Ability to define a schema for an array via top-level `each` rule (solnic)
711
+ - Ability to define nested schemas via `key(:location).schema do .. end` (solnic)
712
+ - Ability to re-use schemas inside other schemas via `key(:location).schema(LocationSchema)` (solnic)
713
+ - Ability to inherit rules from another schema via `Dry::Validation.Schema(Other) do .. end` (solnic)
714
+ - Ability to inject arbitrary dependencies to schemas via `Schema.option` + `Schema#with` (solnic)
715
+ - Ability to provide translations for rule names under `%{locale}.rules.%{name}` pattern (solnic)
716
+ - Ability to configure input processor, either `:form` or `:sanitizer` (solnic)
717
+ - Ability to pass a constrained dry type when defining keys or attrs, ie `key(:age, Types::Age)` (solnic)
718
+ - `Result#messages` supports `:full` option to get messages with rule names, disabled by default (solnic)
719
+ - `Validation::Result` responds to `#[]` and `#each` (delegating to its output)
720
+ and it's an enumerable (solnic)
721
+
722
+ ### Fixed
723
+
724
+ - Qualified rule names properly use last node by default for error messages (solnic)
725
+ - Validation hints only include relevant messages (solnic)
726
+ - `:yaml` messages respect `:locale` option in `Result#messages` (solnic)
727
+
728
+ ### Changed
729
+
730
+ - `schema` was **removed** from the DSL, just use `key(:name).schema` instead (solnic)
731
+ - `confirmation` is now a macro that you can call on a key rule (solnic)
732
+ - rule names for nested structures are now fully qualified, which means you can
733
+ provide customized messages for them. ie `user: :email` (solnic)
734
+ - `Schema::Result#params` was renamed to `#output` (solnic)
735
+ - `Schema::Result` is now `Validation::Result` and it no longer has success and
736
+ failure results, only error results are provided (solnic)
737
+
738
+ [Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-validation/compare/v0.6.0...v0.7.0)
739
+
740
+ ## 0.6.0 2016-01-20
741
+
742
+
743
+ ### Added
744
+
745
+ - Support for validating objects with attr readers via `attr` (SunnyMagadan)
746
+ - Support for `value` interface in the DSL for composing high-level rules based on values (solnic)
747
+ - Support for `rule(name: :something)` syntax for grouping high-level rules under
748
+ the same name (solnic)
749
+ - Support for `confirmation(:foo, some_predicate: some_argument)` shortcut syntax (solnic)
750
+ - Support for error messages for grouped rules (like `confirmation`) (solnic)
751
+ - Schemas support injecting rules from the outside (solnic)
752
+ - ## Changed
753
+ - `rule` uses objects that inherit from `BasicObject` to avoid conflicts with
754
+ predicate names and built-in `Object` methods (solnic)
755
+ - In `Schema::Form` both `key` and `optional` will apply `filled?` predicate by
756
+ default when no block is passed (solnic)
757
+
758
+
759
+ [Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-validation/compare/v0.5.0...v0.6.0)
760
+
761
+ ## 0.5.0 2016-01-11
762
+
763
+
764
+ ### Fixed
765
+
766
+ - `Schema::Form` uses safe `form.array` and `form.hash` types which fixes #42 (solnic)
767
+
768
+ ### Changed
769
+
770
+ - Now depends on [dry-logic](https://github.com/dry-rb/dry-logic) for predicates and rules (solnic)
771
+ - `dry/validation/schema/form` is now required by default (solnic)
772
+
773
+ [Compare v0.4.1...v0.5.0](https://github.com/dry-rb/dry-validation/compare/v0.4.1...v0.5.0)
774
+
775
+ ## 0.4.1 2015-12-27
776
+
777
+
778
+ ### Added
779
+
780
+ - Support for `each` and type coercion inference in `Schema::Form` (solnic)
781
+
782
+
783
+ [Compare v0.4.0...v0.4.1](https://github.com/dry-rb/dry-validation/compare/v0.4.0...v0.4.1)
784
+
785
+ ## 0.4.0 2015-12-21
786
+
787
+
788
+ ### Added
789
+
790
+ - Support for high-level rule composition via `rule` interface (solnic)
791
+ - Support for exclusive disjunction (aka xor/^ operator) (solnic)
792
+ - Support for nested schemas within a schema class (solnic)
793
+ - Support for negating rules via `rule(name).not` (solnic)
794
+ - Support for `validation hints` that are included in the error messages (solnic)
795
+
796
+ ### Fixed
797
+
798
+ - Error messages hash has now consistent structure `rule_name => [msgs_array, input_value]` (solnic)
799
+
800
+
801
+ [Compare v0.3.1...v0.4.0](https://github.com/dry-rb/dry-validation/compare/v0.3.1...v0.4.0)
802
+
803
+ ## 0.3.1 2015-12-08
804
+
805
+
806
+ ### Added
807
+
808
+ - Support for `Range` and `Array` as an argument in `size?` predicate (solnic)
809
+
810
+ ### Fixed
811
+
812
+ - Error compiler returns an empty hash rather than a nil when there are no errors (solnic)
813
+
814
+
815
+ [Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-validation/compare/v0.3.0...v0.3.1)
816
+
817
+ ## 0.3.0 2015-12-07
818
+
819
+
820
+ ### Added
821
+
822
+ - I18n messages support (solnic)
823
+ - Ability to configure `messages` via `configure { config.messages = :i18n }` (solnic)
824
+ - `rule` interface in DSL for defining rules that depend on other rules (solnic)
825
+ - `confirmation` interface as a shortcut for defining "confirmation of" rule (solnic)
826
+ - Error messages can be now matched by input value type too (solnic)
827
+
828
+ ### Fixed
829
+
830
+ - `optional` rule with coercions work correctly with `|` + multiple `&`s (solnic)
831
+ - `Schema#[]` checks registered predicates first before defaulting to its own predicates (solnic)
832
+
833
+ ### Changed
834
+
835
+ - `Schema#messages(input)` => `Schema#call(input).messages` (solnic)
836
+ - `Schema#call` returns `Schema::Result` which has access to all rule results,
837
+ errors and messages
838
+ - `Schema::Result#messages` returns a hash with rule names, messages and input values (solnic)
839
+
840
+ [Compare v0.2.0...v0.3.0](https://github.com/dry-rb/dry-validation/compare/v0.2.0...v0.3.0)
841
+
842
+ ## 0.2.0 2015-11-30
843
+
844
+
845
+ ### Added
846
+
847
+ - `Schema::Form` with a built-in coercer inferred from type-check predicates (solnic)
848
+ - Ability to pass a block to predicate check in the DSL ie `value.hash? { ... }` (solnic)
849
+ - Optional keys using `optional(:key_name) { ... }` interface in the DSL (solnic)
850
+ - New predicates:
851
+ - `bool?`
852
+ - `date?`
853
+ - `date_time?`
854
+ - `time?`
855
+ - `float?`
856
+ - `decimal?`
857
+ - `hash?`
858
+ - `array?`
859
+
860
+ ### Fixed
861
+
862
+ - Added missing `and` / `or` interfaces to composite rules (solnic)
863
+
864
+
865
+ [Compare v0.1.0...v0.2.0](https://github.com/dry-rb/dry-validation/compare/v0.1.0...v0.2.0)
866
+
867
+ ## 0.1.0 2015-11-25
868
+
869
+ First public release