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