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