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