dry-validation 1.3.1 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,93 +1,280 @@
1
- # v1.3.1 2019-08-16
1
+ <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
+
3
+ ## 1.8.1 2022-05-28
4
+
5
+
6
+ ### Fixed
7
+
8
+ - Raise an InvalidKeyErrors on substring of valid keys (issue #705 fixed via #706) (@MatElGran)
9
+ - Using `rule(:arr).each { .. }` doesn't crash when `:arr` turns out to be `nil` (issue #708 fixed via #709) (@bautrey37)
10
+
11
+
12
+ [Compare v1.8.0...v1.8.1](https://github.com/dry-rb/dry-validation/compare/v1.8.0...v1.8.1)
13
+
14
+ ## 1.8.0 2022-02-17
15
+
16
+
17
+ ### Added
18
+
19
+ - New rule helper `base_rule_error?` which checks if there's any base error set (via #690) (@wuarmin)
20
+
21
+ ### Changed
22
+
23
+ - Dependency on dry-schema was bumped to 1.9.1 (@solnic)
24
+
25
+ [Compare v1.7.0...v1.8.0](https://github.com/dry-rb/dry-validation/compare/v1.7.0...v1.8.0)
26
+
27
+ ## 1.7.0 2021-09-12
28
+
29
+
30
+ ### Changed
31
+
32
+ - [internal] Upgraded to new `setting` API provided in dry-configurable 0.13.0 (@timriley in #686 and 3f8f7d8)
33
+ - Bumped dry-schema dependency to 1.8.0 (in part, to ensure dry-configurable 0.13.0 is available) (@timriley)
34
+
35
+ [Compare v1.6.0...v1.7.0](https://github.com/dry-rb/dry-validation/compare/v1.6.0...v1.7.0)
36
+
37
+ ## 1.6.0 2020-12-05
38
+
39
+
40
+ ### Added
41
+
42
+ - You can now pass a key name or path to `rule_error?` predicate (issue #658 closed via #673) (@moofkit)
43
+ - You can now pass initial context object to `Contract#call` (issue #674 via #675) (@pyromaniac)
44
+
45
+ ### Fixed
46
+
47
+ - Checking `key?` within a rule no longer crashes when value is `nil` or an empty string (issue #670 fixed via #672) (@alexxty7)
48
+
49
+
50
+ [Compare v1.5.6...v1.6.0](https://github.com/dry-rb/dry-validation/compare/v1.5.6...v1.6.0)
51
+
52
+ ## 1.5.6 2020-09-04
53
+
54
+
55
+ ### Fixed
56
+
57
+ - Dependency on dry-schema was bumped to >= 1.5.1. This time for real (@solnic)
58
+
59
+
60
+ [Compare v1.5.5...v1.5.6](https://github.com/dry-rb/dry-validation/compare/v1.5.5...v1.5.6)
61
+
62
+ ## 1.5.5 2020-09-03
63
+
64
+
65
+ ### Fixed
66
+
67
+ - Dependency on dry-schema was bumped to >= 1.5.2 (see #666 for more info) (@artofhuman)
68
+
69
+
70
+ [Compare v1.5.4...v1.5.5](https://github.com/dry-rb/dry-validation/compare/v1.5.4...v1.5.5)
71
+
72
+ ## 1.5.4 2020-08-21
73
+
74
+
75
+ ### Added
76
+
77
+ - You can now pass any key or a path to the rule's `key?` helper (see #664 for more info) (@alassek)
78
+
79
+ ### Fixed
80
+
81
+ - Full messages work correctly with rule failures now (issue #661 fixed via #662) (@stind)
82
+ - Providing a custom message template for array errors works correctly (issue #663 fixed via #665) (@tadeusz-niemiec)
83
+
84
+
85
+ [Compare v1.5.3...v1.5.4](https://github.com/dry-rb/dry-validation/compare/v1.5.3...v1.5.4)
86
+
87
+ ## 1.5.3 2020-07-27
88
+
89
+
90
+ ### Added
91
+
92
+ - You can now access current value's index via `rule(:foo).each do |index:|` (issue #606 done via #657) (@mrbongiolo)
93
+
94
+ ### Fixed
95
+
96
+ - Using `.each(:foo)` works as expected when there are errors related to other keys (issue #659 fixed via #660) (@solnic)
97
+
98
+ ### Changed
99
+
100
+ - `Result#error?` is now a public API and it takes into consideration both schema and rule errors (issue #655 fixed via #656) (@PragTob)
101
+
102
+ [Compare v1.5.2...v1.5.3](https://github.com/dry-rb/dry-validation/compare/v1.5.2...v1.5.3)
103
+
104
+ ## 1.5.2 2020-07-14
105
+
106
+
107
+ ### Fixed
108
+
109
+ - `key?` predicate in rules no longer crashes when the rule path points to a non-existent array value (issue #653 fixed via #654) (@solnic)
110
+
111
+
112
+ [Compare v1.5.1...v1.5.2](https://github.com/dry-rb/dry-validation/compare/v1.5.1...v1.5.2)
113
+
114
+ ## 1.5.1 2020-06-18
115
+
116
+
117
+ ### Fixed
118
+
119
+ - dry-monads no longer required for the `:hints` extension (@schokomarie)
120
+ - Using `full: true` option works as expected with custom rule messages (issue #618 fixed via #651) (@sirfilip)
121
+ - Using `locale: ...` option works as expected with hints (issue #589 fixed via 652) (@sirfilip)
122
+
123
+
124
+ [Compare v1.5.0...v1.5.1](https://github.com/dry-rb/dry-validation/compare/v1.5.0...v1.5.1)
125
+
126
+ ## 1.5.0 2020-03-11
127
+
128
+
129
+ ### Added
130
+
131
+ - `schema_error?` rule helper (@waiting-for-dev)
132
+ - `rule_error?` rule helper (@waiting-for-dev)
133
+
134
+ ### Changed
135
+
136
+ - dry-schema dependency was bumped to `~> 1.5` (@solnic)
137
+ - [internal] `KeyMap` patches have been removed since dry-schema now provides required functionality (@solnic)
138
+
139
+ [Compare v1.4.2...v1.5.0](https://github.com/dry-rb/dry-validation/compare/v1.4.2...v1.5.0)
140
+
141
+ ## 1.4.2 2020-01-18
142
+
143
+
144
+ ### Fixed
145
+
146
+ - Macros using predicates that accept a range argument work as expected (no need to wrap the argument in an array) (@waiting-for-dev)
147
+
148
+
149
+ [Compare v1.4.1...v1.4.2](https://github.com/dry-rb/dry-validation/compare/v1.4.1...v1.4.2)
150
+
151
+ ## 1.4.1 2020-01-08
152
+
153
+
154
+ ### Added
155
+
156
+ - Pattern matching on result values (@flash-gordon)
157
+
158
+ ### Fixed
159
+
160
+ - List tokens are correctly interpolated as a comma separated list in rule messages (see #611) (@waiting-for-dev)
161
+ - Warnings about delegated keywords (@flash-gordon)
162
+
163
+
164
+ [Compare v1.4.0...v1.4.1](https://github.com/dry-rb/dry-validation/compare/v1.4.0...v1.4.1)
165
+
166
+ ## 1.4.0 2019-12-12
167
+
168
+
169
+ ### Added
170
+
171
+ - Support for multi-schema inheritance (@ianwhite)
172
+
173
+ ### Fixed
174
+
175
+ - Keyword warnings reported by Ruby 2.7 (@flash-gordon)
176
+ - Fixed an issue where `MessageSet` would be marked as empty too early (@ianwhite)
177
+ - Messages are correctly generated when there are errors for both an array and one or more of its elements (see #599) (@Bugagazavr)
2
178
 
3
179
  ### Changed
4
180
 
5
- * You can now set an external schema without providing a block (alassek)
181
+ - A meaningful exception is raised when failure options are not valid (@MatElGran)
182
+ - [internal] improved performance in `Contract.ensure_valid_keys` (@grzegorz-jakubiak)
183
+ - [internal] fixed keyword warnings on MRI 2.7.0 (@flash-gordon)
184
+
185
+ [Compare v1.3.1...v1.4.0](https://github.com/dry-rb/dry-validation/compare/v1.3.1...v1.4.0)
186
+
187
+ ## 1.3.1 2019-08-16
188
+
189
+
190
+ ### Changed
191
+
192
+ - You can now set an external schema without providing a block (@alassek)
6
193
 
7
194
  [Compare v1.3.0...v1.3.1](https://github.com/dry-rb/dry-validation/compare/v1.3.0...v1.3.1)
8
195
 
9
- # v1.3.0 2019-08-14
196
+ ## 1.3.0 2019-08-14
197
+
10
198
 
11
199
  ### Added
12
200
 
13
- * Support for setting an external schema (that can be extended too) (fixed #574) (@solnic)
201
+ - Support for setting an external schema (that can be extended too) (fixed #574) (@solnic)
14
202
 
15
203
  ### Fixed
16
204
 
17
- * Using a hash spec to define rule keys with more than one value is properly handled by rule guard now (fixed #576) (@solnic)
205
+ - Using a hash spec to define rule keys with more than one value is properly handled by rule guard now (fixed #576) (@solnic)
18
206
 
19
207
  ### Changed
20
208
 
21
- * `values` within rules uses `Hash#fetch_values` internally now, which improves performance (@esparta)
209
+ - `values` within rules uses `Hash#fetch_values` internally now, which improves performance (@esparta)
22
210
 
23
211
  [Compare v1.2.1...v1.3.0](https://github.com/dry-rb/dry-validation/compare/v1.2.1...v1.3.0)
24
212
 
25
- # v1.2.1 2019-07-16
213
+ ## 1.2.1 2019-07-16
214
+
26
215
 
27
216
  ### Fixed
28
217
 
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)
218
+ - Defining an abstract contract class that has no schema no longer crashes (issue #565) (@solnic)
219
+ - Fixed an issue where `Rule#each` would crash when the value is not an array (issue #567) (@solnic)
220
+ - Fixed an issue where guarding a rule would crash when keys are missing in the input (issue #569) (@solnic)
221
+ - Added missing "pathname" require (issue #570) (@solnic)
222
+
33
223
 
34
224
  [Compare v1.2.0...v1.2.1](https://github.com/dry-rb/dry-validation/compare/v1.2.0...v1.2.1)
35
225
 
36
- # v1.2.0 2019-07-08
226
+ ## 1.2.0 2019-07-08
227
+
37
228
 
38
229
  ### Added
39
230
 
40
- * New extension `:predicates_as_macros` (@waiting-for-dev)
231
+ - New extension `:predicates_as_macros` (@waiting-for-dev)
41
232
 
42
233
  ### Fixed
43
234
 
44
- * Guarding rules for nested keys works correctly (issue #560) (@solnic)
235
+ - Guarding rules for nested keys works correctly (issue #560) (@solnic)
45
236
 
46
237
  ### Changed
47
238
 
48
- * `dry-schema` dependency was bumped to `>= 1.3.1` (@solnic)
239
+ - `dry-schema` dependency was bumped to `>= 1.3.1` (@solnic)
49
240
 
50
241
  [Compare v1.1.1...v1.2.0](https://github.com/dry-rb/dry-validation/compare/v1.1.1...v1.2.0)
51
242
 
52
- # v1.1.1 2019-06-24
243
+ ## 1.1.1 2019-06-24
244
+
53
245
 
54
246
  ### Fixed
55
247
 
56
- * `Rule#each` works with array values from nested hashes (@mustardnoise)
248
+ - `Rule#each` works with array values from nested hashes (@mustardnoise)
249
+
57
250
 
58
251
  [Compare v1.1.0...v1.1.1](https://github.com/dry-rb/dry-validation/compare/v1.1.0...v1.1.1)
59
252
 
60
- # v1.1.0 2019-06-14
253
+ ## 1.1.0 2019-06-14
254
+
61
255
 
62
256
  ### Added
63
257
 
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)
258
+ - `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)
259
+ - `value` supports hash-based path specifications now (refs #547) (@solnic)
260
+ - `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
261
 
68
262
  ### Fixed
69
263
 
70
- * Passing multiple macro names to `validate` or `each` works correctly (fixed #538 #541) (@jandudulski)
264
+ - Passing multiple macro names to `validate` or `each` works correctly (fixed #538 #541) (@jandudulski)
71
265
 
72
- [Compare v1.0.0...v1.1.0](https://github.com/dry-rb/dry-validation/compare/v1.0.0...v1.1.0)
73
266
 
74
- # v1.0.0 2019-06-10
267
+ [Compare v1.0.0...v1.1.0](https://github.com/dry-rb/dry-validation/compare/v1.0.0...v1.1.0)
75
268
 
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.
269
+ ## 1.0.0 2019-06-10
77
270
 
78
271
  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
272
 
80
- ### :sparkles: Release highlights :sparkles:
81
273
 
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
274
+ [Compare v1.0.0...v1.0.0](https://github.com/dry-rb/dry-validation/compare/v1.0.0...v1.0.0)
87
275
 
88
- [Compare v0.13.3...v1.0.0](https://github.com/dry-rb/dry-validation/compare/v0.13.3...v1.0.0)
276
+ ## 1.0.0 2019-06-10
89
277
 
90
- # v1.0.0 2019-06-10 (compared to 1.0.0.rc3)
91
278
 
92
279
  ### Added
93
280
 
@@ -110,65 +297,69 @@ See [the list of all addressed issues](https://github.com/dry-rb/dry-validation/
110
297
 
111
298
  [Compare v1.0.0.rc3...v1.0.0](https://github.com/dry-rb/dry-validation/compare/v1.0.0.rc3...v1.0.0)
112
299
 
113
- # v1.0.0.rc3 2019-05-06
300
+ ## 1.0.0.rc3 2019-05-06
301
+
114
302
 
115
303
  ### Added
116
304
 
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)
305
+ - [EXPERIMENTAL] `Validation.register_macro` for registering global macros (solnic)
306
+ - [EXPERIMENTAL] `Contract.register_macro` for registering macros available to specific contract classes (solnic)
307
+ - `Dry::Validation.Contract` shortcut for quickly defining a contract and getting its instance back (solnic)
308
+ - New configuration option `config.locale` for setting the default locale (solnic)
121
309
 
122
310
  ### Fixed
123
311
 
124
- * `config/errors.yml` are now bundled with the gem, **`rc2` was broken because of this** (solnic)
312
+ - `config/errors.yml` are now bundled with the gem, **`rc2` was broken because of this** (solnic)
313
+
125
314
 
126
315
  [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
316
 
128
- # v1.0.0.rc2 2019-05-04
317
+ ## 1.0.0.rc2 2019-05-04
129
318
 
130
319
  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
320
 
132
321
  ### Added
133
322
 
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)
323
+ - [EXPERIMENTAL] support for registering macros via `Dry::Validation::Macros.register(:your_macro, &block)` (solnic)
324
+ - [EXPERIMENTAL] `:acceptance` as the first built-in macro (issue #157) (solnic)
136
325
 
137
326
  ### Fixed
138
327
 
139
- * Passing invalid argument to `failure` will raise a meaningful error instead of crashing (solnic)
328
+ - Passing invalid argument to `failure` will raise a meaningful error instead of crashing (solnic)
140
329
 
141
330
  ### Changed
142
331
 
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)
332
+ - 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)
333
+ - Dependency on `dry-schema` was updated to `~> 1.0` (solnic)
145
334
 
146
335
  [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
336
 
148
- # v1.0.0.rc1 2019-04-26
337
+ ## 1.0.0.rc1 2019-04-26
338
+
149
339
 
150
340
  ### Added
151
341
 
152
- * `:hints` extension is back (solnic)
153
- * `Result` objects have access to the context object which is shared between rules (flash-gordon)
342
+ - `:hints` extension is back (solnic)
343
+ - `Result` objects have access to the context object which is shared between rules (flash-gordon)
154
344
 
155
345
  ### Fixed
156
346
 
157
- * Multiple hint messages no longer crash message set (flash-gordon)
158
- * `Contract#inspect` no longer crashes (solnic)
347
+ - Multiple hint messages no longer crash message set (flash-gordon)
348
+ - `Contract#inspect` no longer crashes (solnic)
159
349
 
160
350
  ### Changed
161
351
 
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)
352
+ - Dependency on `dry-schema` was bumped to `~> 0.6` - this pulls in `dry-types 1.0.0` and `dry-logic 1.0.0` (solnic)
353
+ - Dependency on `dry-initializer` was bumped to `~> 3.0` (solnic)
164
354
 
165
355
  [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
356
 
167
- # v1.0.0.beta2 2019-04-04
357
+ ## 1.0.0.beta2 2019-04-04
358
+
168
359
 
169
360
  ### Added
170
361
 
171
- * Support for arbitrary meta-data in failures, ie:
362
+ - Support for arbitrary meta-data in failures, ie:
172
363
 
173
364
  ```ruby
174
365
  class NewUserContract < Dry::Validation::Contract
@@ -186,98 +377,107 @@ This was **yanked** on rubygems.org because the bundled gem was missing `config`
186
377
 
187
378
  ### Changed
188
379
 
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)
380
+ - [BREAKING] `Error` was renamed to `Message` as it is a more generic concept (solnic)
381
+ - [BREAKING] `ErrorSet` was renamed to `MessageSet` for consistency (solnic)
382
+ - [BREAKING] `:monads` extension wraps entire result objects in `Success` or `Failure` (flash-gordon)
192
383
 
193
384
  [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
385
 
195
- # v1.0.0.beta1 2019-03-26
386
+ ## 1.0.0.beta1 2019-03-26
387
+
196
388
 
197
389
  ### Added
198
390
 
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)
391
+ - New API for setting failures `base.failure` for base errors and `key.failure` for key errors (solnic)
392
+ - Support for `base` errors associated with a key even when child keys have errors too (solnic)
393
+ - Support for `base` errors not associated with any key (solnic)
394
+ - Result objects use `ErrorSet` object now for managing messages (solnic)
395
+ - Nested keys are properly handled when generating messages hash (issue #489) (flash-gordon + solnic)
396
+ - Result objects support `locale` and `full` options now (solnic)
397
+ - Ability to configure `top_namespace` for messages, which will be used for both schema and rule localization (solnic)
398
+ - Rule blocks receive a context object that you can use to share data between rules (solnic)
207
399
 
208
400
  ### Changed
209
401
 
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)
402
+ - [BREAKING] `Result#errors` returns an instance of `ErrorSet` now, it's an enumerable, coerible to a hash (solnic)
403
+ - [BREAKING] `failure` was removed in favor of `key.failure` or `key(:foo).failure` (solnic)
404
+ - [BREAKING] `Result#to_hash` was removed (flash-gordon)
213
405
 
214
406
  [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
407
 
216
- # v1.0.0.alpha2 2019-03-05
408
+ ## 1.0.0.alpha2 2019-03-05
217
409
 
218
410
  First round of bug fixes. Thanks for testing <3!
219
411
 
220
412
  ### Fixed
221
413
 
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)
414
+ - Errors with nested messages are correctly built (flash-gordon)
415
+ - Messages for nested keys are correctly resolved (solnic)
416
+ - 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
417
 
226
418
  ### Changed
227
419
 
228
- * When a message template is not found a more meaningful error is raised that includes both rule identifier and key path (solnic)
420
+ - When a message template is not found a more meaningful error is raised that includes both rule identifier and key path (solnic)
229
421
 
230
422
  [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
423
 
232
- # v1.0.0.alpha1 2019-03-04
424
+ ## 1.0.0.alpha1 2019-03-04
233
425
 
234
426
  Complete rewrite on top of `dry-schema`.
235
427
 
236
428
  ### Added
237
429
 
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)
430
+ - [BREAKING] `Dry::Validation::Contract` as a replacement for validation schemas (solnic)
431
+ - [BREAKING] New `rule` DSL with an improved API for setting error messages (solnic)
240
432
 
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
433
 
243
- # v0.13.0 2019-01-29
434
+ [Compare v0.13.0...v1.0.0.alpha1](https://github.com/dry-rb/dry-validation/compare/v0.13.0...v1.0.0.alpha1)
244
435
 
245
- ### Changed
436
+ ## 0.13.0 2019-01-29
246
437
 
247
- - `dry-logic` was bumped to `~> 0.5` (solnic)
248
- - `dry-types` was bumped to `~> 0.14` (solnic)
249
438
 
250
439
  ### Fixed
251
440
 
252
441
  - Warning about method redefined (amatsuda)
253
442
 
443
+ ### Changed
444
+
445
+ - `dry-logic` was bumped to `~> 0.5` (solnic)
446
+ - `dry-types` was bumped to `~> 0.14` (solnic)
447
+
254
448
  [Compare v0.12.3...v0.13.0](https://github.com/dry-rb/dry-validation/compare/v0.12.3...v0.13.0)
255
449
 
256
- # v0.12.3 2019-01-29
450
+ ## 0.12.3 2019-01-29
451
+
257
452
 
258
453
  ### Changed
259
454
 
260
- * [internal] dry-logic was pinned to `~> 0.4.2` (flash-gordon)
455
+ - [internal] dry-logic was pinned to `~> 0.4.2` (flash-gordon)
261
456
 
262
457
  [Compare v0.12.2...v0.12.3](https://github.com/dry-rb/dry-validation/compare/v0.12.2...v0.12.3)
263
458
 
264
- # v0.12.2 2018-08-29
459
+ ## 0.12.2 2018-08-29
460
+
265
461
 
266
462
  ### Fixed
267
463
 
268
464
  - Use correct key names for rule messages when using i18n (jozzi05)
269
465
 
466
+
270
467
  [Compare v0.12.1...v0.12.2](https://github.com/dry-rb/dry-validation/compare/v0.12.1...v0.12.2)
271
468
 
272
- # v0.12.1 2018-07-06
469
+ ## 0.12.1 2018-07-06
470
+
273
471
 
274
472
  ### Fixed
275
473
 
276
474
  - [internal] fixed deprecation warnings (flash-gordon)
277
475
 
476
+
278
477
  [Compare v0.12.0...v0.12.1](https://github.com/dry-rb/dry-validation/compare/v0.12.0...v0.12.1)
279
478
 
280
- # v0.12.0 2018-05-31
479
+ ## 0.12.0 2018-05-31
480
+
281
481
 
282
482
  ### Changed
283
483
 
@@ -286,7 +486,8 @@ Complete rewrite on top of `dry-schema`.
286
486
 
287
487
  [Compare v0.11.1...v0.12.0](https://github.com/dry-rb/dry-validation/compare/v0.11.1...v0.12.0)
288
488
 
289
- # v0.11.1 2017-09-15
489
+ ## 0.11.1 2017-09-15
490
+
290
491
 
291
492
  ### Changed
292
493
 
@@ -295,7 +496,8 @@ Complete rewrite on top of `dry-schema`.
295
496
 
296
497
  [Compare v0.11.0...v0.11.1](https://github.com/dry-rb/dry-validation/compare/v0.11.0...v0.11.1)
297
498
 
298
- # v0.11.0 2017-05-30
499
+ ## 0.11.0 2017-05-30
500
+
299
501
 
300
502
  ### Changed
301
503
 
@@ -303,32 +505,39 @@ Complete rewrite on top of `dry-schema`.
303
505
 
304
506
  [Compare v0.10.7...v0.11.0](https://github.com/dry-rb/dry-validation/compare/v0.10.7...v0.11.0)
305
507
 
306
- # v0.10.7 2017-05-15
508
+ ## 0.10.7 2017-05-15
509
+
307
510
 
308
511
  ### Fixed
309
512
 
310
513
  - `validate` can now be defined multiple times for the same key (kimquy)
311
514
  - Re-using rules between schemas no longer mutates original rule set (pabloh)
312
515
 
516
+
313
517
  [Compare v0.10.6...v0.10.7](https://github.com/dry-rb/dry-validation/compare/v0.10.6...v0.10.7)
314
518
 
315
- # v0.10.6 2017-04-26
519
+ ## 0.10.6 2017-04-26
520
+
316
521
 
317
522
  ### Fixed
318
523
 
319
524
  - Fixes issue with wrong localized error messages when namespaced messages are used (kbredemeier)
320
525
 
526
+
321
527
  [Compare v0.10.5...v0.10.6](https://github.com/dry-rb/dry-validation/compare/v0.10.5...v0.10.6)
322
528
 
323
- # v0.10.5 2017-01-12
529
+ ## 0.10.5 2017-01-12
530
+
324
531
 
325
532
  ### Fixed
326
533
 
327
534
  - Warnings under MRI 2.4.0 are gone (koic)
328
535
 
536
+
329
537
  [Compare v0.10.4...v0.10.5](https://github.com/dry-rb/dry-validation/compare/v0.10.4...v0.10.5)
330
538
 
331
- # v0.10.4 2016-12-03
539
+ ## 0.10.4 2016-12-03
540
+
332
541
 
333
542
  ### Fixed
334
543
 
@@ -341,31 +550,38 @@ Complete rewrite on top of `dry-schema`.
341
550
 
342
551
  [Compare v0.10.3...v0.10.4](https://github.com/dry-rb/dry-validation/compare/v0.10.3...v0.10.4)
343
552
 
344
- # v0.10.3 2016-09-27
553
+ ## 0.10.3 2016-09-27
554
+
345
555
 
346
556
  ### Fixed
347
557
 
348
558
  - Custom predicates work correctly with `each` macro (solnic)
349
559
 
560
+
350
561
  [Compare v0.10.2...v0.10.3](https://github.com/dry-rb/dry-validation/compare/v0.10.2...v0.10.3)
351
562
 
352
- # v0.10.2 2016-09-23
563
+ ## 0.10.2 2016-09-23
564
+
353
565
 
354
566
  ### Fixed
355
567
 
356
568
  - Constrained types + hints work again (solnic)
357
569
 
570
+
358
571
  [Compare v0.10.1...v0.10.2](https://github.com/dry-rb/dry-validation/compare/v0.10.1...v0.10.2)
359
572
 
360
- # v0.10.1 2016-09-22
573
+ ## 0.10.1 2016-09-22
574
+
361
575
 
362
576
  ### Fixed
363
577
 
364
578
  - Remove obsolete require of `dry/struct` which is now an optional extension (flash-gordon)
365
579
 
580
+
366
581
  [Compare v0.10.0...v0.10.1](https://github.com/dry-rb/dry-validation/compare/v0.10.0...v0.10.1)
367
582
 
368
- # v0.10.0 2016-09-21
583
+ ## 0.10.0 2016-09-21
584
+
369
585
 
370
586
  ### Added
371
587
 
@@ -388,34 +604,31 @@ Complete rewrite on top of `dry-schema`.
388
604
  - [BREAKING] `when` macro no longer supports multiple disconnected rules in its block, whatever the block returns will be used for the implication (solnic)
389
605
  - [BREAKING] `rule(some_name: %i(some keys))` will _always_ use `:some_name` as the key for failure messages (solnic)
390
606
 
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
607
  [Compare v0.9.5...v0.10.0](https://github.com/dry-rb/dry-validation/compare/v0.9.5...v0.10.0)
400
608
 
401
- # v0.9.5 2016-08-16
609
+ ## 0.9.5 2016-08-16
610
+
402
611
 
403
612
  ### Fixed
404
613
 
405
614
  - Infering multiple predicates with options works as expected ie `value(:str?, min_size?: 3, max_size?: 6)` (solnic)
406
615
  - Default `locale` configured in `I18n` is now respected by the messages compiler (agustin + cavi21)
407
616
 
617
+
408
618
  [Compare v0.9.4...v0.9.5](https://github.com/dry-rb/dry-validation/compare/v0.9.4...v0.9.5)
409
619
 
410
- # v0.9.4 2016-08-11
620
+ ## 0.9.4 2016-08-11
621
+
411
622
 
412
623
  ### Fixed
413
624
 
414
625
  - Error messages for sibling deeply nested schemas are nested correctly (timriley)
415
626
 
627
+
416
628
  [Compare v0.9.3...v0.9.4](https://github.com/dry-rb/dry-validation/compare/v0.9.3...v0.9.4)
417
629
 
418
- # v0.9.3 2016-07-22
630
+ ## 0.9.3 2016-07-22
631
+
419
632
 
420
633
  ### Added
421
634
 
@@ -433,24 +646,29 @@ Complete rewrite on top of `dry-schema`.
433
646
 
434
647
  [Compare v0.9.2...v0.9.3](https://github.com/dry-rb/dry-validation/compare/v0.9.2...v0.9.3)
435
648
 
436
- # v0.9.2 2016-07-13
649
+ ## 0.9.2 2016-07-13
650
+
437
651
 
438
652
  ### Fixed
439
653
 
440
654
  - Constrained types now work with `each` macro (solnic)
441
655
  - Array coercion without member type works now ie `required(:arr).maybe(:array?)` (solnic)
442
656
 
657
+
443
658
  [Compare v0.9.1...v0.9.2](https://github.com/dry-rb/dry-validation/compare/v0.9.1...v0.9.2)
444
659
 
445
- # v0.9.1 2016-07-11
660
+ ## 0.9.1 2016-07-11
661
+
446
662
 
447
663
  ### Fixed
448
664
 
449
665
  - `I18n` backend is no longer required and set by default (solnic)
450
666
 
667
+
451
668
  [Compare v0.9.0...v0.9.1](https://github.com/dry-rb/dry-validation/compare/v0.9.0...v0.9.1)
452
669
 
453
- # v0.9.0 2016-07-08
670
+ ## 0.9.0 2016-07-08
671
+
454
672
 
455
673
  ### Added
456
674
 
@@ -463,10 +681,6 @@ Complete rewrite on top of `dry-schema`.
463
681
  - Support for message token transformations in custom predicates (fran-worley)
464
682
  - [EXPERIMENTAL] Ability to compose predicates that accept dynamic args provided by the schema (solnic)
465
683
 
466
- ### Changed
467
-
468
- - Tokens for `size?` were renamed `left` => `size_left` and `right` => `size_right` (fran-worley)
469
-
470
684
  ### Fixed
471
685
 
472
686
  - Duped key names in nested schemas no longer result in invalid error messages structure (solnic)
@@ -476,18 +690,14 @@ Complete rewrite on top of `dry-schema`.
476
690
  - Hints for elements are no longer provided for an array when the value is not an array (solnic)
477
691
  - `input` macro no longer messes up error messages for nested structures (solnic)
478
692
 
479
- ### Internal
693
+ ### Changed
480
694
 
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)
695
+ - Tokens for `size?` were renamed `left` => `size_left` and `right` => `size_right` (fran-worley)
487
696
 
488
697
  [Compare v0.8.0...v0.9.0](https://github.com/dry-rb/dry-validation/compare/v0.8.0...v0.9.0)
489
698
 
490
- # v0.8.0 2016-07-01
699
+ ## 0.8.0 2016-07-01
700
+
491
701
 
492
702
  ### Added
493
703
 
@@ -533,19 +743,10 @@ Complete rewrite on top of `dry-schema`.
533
743
  - Deprecate key in favor of required (coop)
534
744
  - Remove nested key syntax (solnic)
535
745
 
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
746
  [Compare v0.7.4...v0.8.0](https://github.com/dry-rb/dry-validation/compare/v0.7.4...v0.8.0)
547
747
 
548
- # v0.7.4 2016-04-06
748
+ ## 0.7.4 2016-04-06
749
+
549
750
 
550
751
  ### Added
551
752
 
@@ -556,9 +757,11 @@ Complete rewrite on top of `dry-schema`.
556
757
 
557
758
  - Depending on deeply nested values in high-level rules works now (solnic)
558
759
 
760
+
559
761
  [Compare v0.7.3...v0.7.4](https://github.com/dry-rb/dry-validation/compare/v0.7.3...v0.7.4)
560
762
 
561
- # v0.7.3 2016-03-30
763
+ ## 0.7.3 2016-03-30
764
+
562
765
 
563
766
  ### Added
564
767
 
@@ -571,22 +774,22 @@ Complete rewrite on top of `dry-schema`.
571
774
  - Creating a nested schema properly sets full path to nested data structure (solnic)
572
775
  - Error message for `empty?` predicate is now correct (jodosha)
573
776
 
574
- ### Internal
575
-
576
- - Switch from `thread_safe` to `concurrent` (joevandyk)
577
777
 
578
778
  [Compare v0.7.2...v0.7.3](https://github.com/dry-rb/dry-validation/compare/v0.7.2...v0.7.3)
579
779
 
580
- # v0.7.2 2016-03-28
780
+ ## 0.7.2 2016-03-28
781
+
581
782
 
582
783
  ### Added
583
784
 
584
785
  - Support for nested schemas inside high-level rules (solnic)
585
786
  - `Schema#to_proc` so that you can do `data.each(&schema)` (solnic)
586
787
 
788
+
587
789
  [Compare v0.7.1...v0.7.2](https://github.com/dry-rb/dry-validation/compare/v0.7.1...v0.7.2)
588
790
 
589
- # v0.7.1 2016-03-21
791
+ ## 0.7.1 2016-03-21
792
+
590
793
 
591
794
  ### Added
592
795
 
@@ -604,7 +807,8 @@ Complete rewrite on top of `dry-schema`.
604
807
 
605
808
  [Compare v0.7.0...v0.7.1](https://github.com/dry-rb/dry-validation/compare/v0.7.0...v0.7.1)
606
809
 
607
- # v0.7.0 2016-03-16
810
+ ## 0.7.0 2016-03-16
811
+
608
812
 
609
813
  ### Added
610
814
 
@@ -628,6 +832,12 @@ Complete rewrite on top of `dry-schema`.
628
832
  - `Validation::Result` responds to `#[]` and `#each` (delegating to its output)
629
833
  and it's an enumerable (solnic)
630
834
 
835
+ ### Fixed
836
+
837
+ - Qualified rule names properly use last node by default for error messages (solnic)
838
+ - Validation hints only include relevant messages (solnic)
839
+ - `:yaml` messages respect `:locale` option in `Result#messages` (solnic)
840
+
631
841
  ### Changed
632
842
 
633
843
  - `schema` was **removed** from the DSL, just use `key(:name).schema` instead (solnic)
@@ -638,15 +848,10 @@ Complete rewrite on top of `dry-schema`.
638
848
  - `Schema::Result` is now `Validation::Result` and it no longer has success and
639
849
  failure results, only error results are provided (solnic)
640
850
 
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
851
  [Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-validation/compare/v0.6.0...v0.7.0)
648
852
 
649
- # v0.6.0 2016-01-20
853
+ ## 0.6.0 2016-01-20
854
+
650
855
 
651
856
  ### Added
652
857
 
@@ -657,38 +862,41 @@ Complete rewrite on top of `dry-schema`.
657
862
  - Support for `confirmation(:foo, some_predicate: some_argument)` shortcut syntax (solnic)
658
863
  - Support for error messages for grouped rules (like `confirmation`) (solnic)
659
864
  - Schemas support injecting rules from the outside (solnic)
660
-
661
- ## Changed
662
-
865
+ - ## Changed
663
866
  - `rule` uses objects that inherit from `BasicObject` to avoid conflicts with
664
867
  predicate names and built-in `Object` methods (solnic)
665
868
  - In `Schema::Form` both `key` and `optional` will apply `filled?` predicate by
666
869
  default when no block is passed (solnic)
667
870
 
871
+
668
872
  [Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-validation/compare/v0.5.0...v0.6.0)
669
873
 
670
- # v0.5.0 2016-01-11
874
+ ## 0.5.0 2016-01-11
671
875
 
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
876
 
677
877
  ### Fixed
678
878
 
679
879
  - `Schema::Form` uses safe `form.array` and `form.hash` types which fixes #42 (solnic)
680
880
 
881
+ ### Changed
882
+
883
+ - Now depends on [dry-logic](https://github.com/dry-rb/dry-logic) for predicates and rules (solnic)
884
+ - `dry/validation/schema/form` is now required by default (solnic)
885
+
681
886
  [Compare v0.4.1...v0.5.0](https://github.com/dry-rb/dry-validation/compare/v0.4.1...v0.5.0)
682
887
 
683
- # v0.4.1 2015-12-27
888
+ ## 0.4.1 2015-12-27
889
+
684
890
 
685
891
  ### Added
686
892
 
687
893
  - Support for `each` and type coercion inference in `Schema::Form` (solnic)
688
894
 
895
+
689
896
  [Compare v0.4.0...v0.4.1](https://github.com/dry-rb/dry-validation/compare/v0.4.0...v0.4.1)
690
897
 
691
- # v0.4.0 2015-12-21
898
+ ## 0.4.0 2015-12-21
899
+
692
900
 
693
901
  ### Added
694
902
 
@@ -702,9 +910,11 @@ Complete rewrite on top of `dry-schema`.
702
910
 
703
911
  - Error messages hash has now consistent structure `rule_name => [msgs_array, input_value]` (solnic)
704
912
 
913
+
705
914
  [Compare v0.3.1...v0.4.0](https://github.com/dry-rb/dry-validation/compare/v0.3.1...v0.4.0)
706
915
 
707
- # v0.3.1 2015-12-08
916
+ ## 0.3.1 2015-12-08
917
+
708
918
 
709
919
  ### Added
710
920
 
@@ -714,9 +924,11 @@ Complete rewrite on top of `dry-schema`.
714
924
 
715
925
  - Error compiler returns an empty hash rather than a nil when there are no errors (solnic)
716
926
 
927
+
717
928
  [Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-validation/compare/v0.3.0...v0.3.1)
718
929
 
719
- # v0.3.0 2015-12-07
930
+ ## 0.3.0 2015-12-07
931
+
720
932
 
721
933
  ### Added
722
934
 
@@ -738,9 +950,10 @@ Complete rewrite on top of `dry-schema`.
738
950
  errors and messages
739
951
  - `Schema::Result#messages` returns a hash with rule names, messages and input values (solnic)
740
952
 
741
- [Compare v0.2.0...HEAD](https://github.com/dry-rb/dry-validation/compare/v0.2.0...HEAD)
953
+ [Compare v0.2.0...v0.3.0](https://github.com/dry-rb/dry-validation/compare/v0.2.0...v0.3.0)
954
+
955
+ ## 0.2.0 2015-11-30
742
956
 
743
- # v0.2.0 2015-11-30
744
957
 
745
958
  ### Added
746
959
 
@@ -761,8 +974,9 @@ Complete rewrite on top of `dry-schema`.
761
974
 
762
975
  - Added missing `and` / `or` interfaces to composite rules (solnic)
763
976
 
764
- [Compare v0.1.0...HEAD](https://github.com/dry-rb/dry-validation/compare/v0.1.0...HEAD)
765
977
 
766
- # v0.1.0 2015-11-25
978
+ [Compare v0.1.0...v0.2.0](https://github.com/dry-rb/dry-validation/compare/v0.1.0...v0.2.0)
979
+
980
+ ## 0.1.0 2015-11-25
767
981
 
768
982
  First public release