dry-schema 1.3.4 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +253 -101
- data/LICENSE +1 -1
- data/README.md +6 -6
- data/config/errors.yml +4 -0
- data/dry-schema.gemspec +46 -0
- data/lib/dry-schema.rb +1 -1
- data/lib/dry/schema.rb +20 -7
- data/lib/dry/schema/compiler.rb +4 -4
- data/lib/dry/schema/config.rb +15 -6
- data/lib/dry/schema/constants.rb +19 -9
- data/lib/dry/schema/dsl.rb +144 -38
- data/lib/dry/schema/extensions.rb +10 -2
- data/lib/dry/schema/extensions/hints.rb +15 -8
- data/lib/dry/schema/extensions/hints/message_compiler_methods.rb +2 -2
- data/lib/dry/schema/extensions/hints/message_set_methods.rb +0 -47
- data/lib/dry/schema/extensions/info.rb +27 -0
- data/lib/dry/schema/extensions/info/schema_compiler.rb +105 -0
- data/lib/dry/schema/extensions/monads.rb +1 -1
- data/lib/dry/schema/extensions/struct.rb +32 -0
- data/lib/dry/schema/json.rb +1 -1
- data/lib/dry/schema/key.rb +20 -5
- data/lib/dry/schema/key_coercer.rb +4 -4
- data/lib/dry/schema/key_map.rb +9 -4
- data/lib/dry/schema/key_validator.rb +66 -0
- data/lib/dry/schema/macros.rb +8 -8
- data/lib/dry/schema/macros/array.rb +17 -4
- data/lib/dry/schema/macros/core.rb +11 -6
- data/lib/dry/schema/macros/dsl.rb +53 -21
- data/lib/dry/schema/macros/each.rb +4 -4
- data/lib/dry/schema/macros/filled.rb +5 -6
- data/lib/dry/schema/macros/hash.rb +21 -3
- data/lib/dry/schema/macros/key.rb +10 -10
- data/lib/dry/schema/macros/maybe.rb +4 -5
- data/lib/dry/schema/macros/optional.rb +1 -1
- data/lib/dry/schema/macros/required.rb +1 -1
- data/lib/dry/schema/macros/schema.rb +23 -2
- data/lib/dry/schema/macros/value.rb +34 -7
- data/lib/dry/schema/message.rb +35 -9
- data/lib/dry/schema/message/or.rb +18 -39
- data/lib/dry/schema/message/or/abstract.rb +28 -0
- data/lib/dry/schema/message/or/multi_path.rb +37 -0
- data/lib/dry/schema/message/or/single_path.rb +64 -0
- data/lib/dry/schema/message_compiler.rb +40 -19
- data/lib/dry/schema/message_compiler/visitor_opts.rb +2 -2
- data/lib/dry/schema/message_set.rb +26 -37
- data/lib/dry/schema/messages.rb +6 -6
- data/lib/dry/schema/messages/abstract.rb +79 -66
- data/lib/dry/schema/messages/i18n.rb +36 -10
- data/lib/dry/schema/messages/namespaced.rb +13 -3
- data/lib/dry/schema/messages/template.rb +19 -44
- data/lib/dry/schema/messages/yaml.rb +72 -13
- data/lib/dry/schema/params.rb +1 -1
- data/lib/dry/schema/path.rb +44 -5
- data/lib/dry/schema/predicate.rb +2 -2
- data/lib/dry/schema/predicate_inferrer.rb +4 -184
- data/lib/dry/schema/predicate_registry.rb +3 -24
- data/lib/dry/schema/primitive_inferrer.rb +3 -86
- data/lib/dry/schema/processor.rb +54 -50
- data/lib/dry/schema/processor_steps.rb +139 -0
- data/lib/dry/schema/result.rb +52 -5
- data/lib/dry/schema/rule_applier.rb +8 -7
- data/lib/dry/schema/step.rb +79 -0
- data/lib/dry/schema/trace.rb +5 -4
- data/lib/dry/schema/type_container.rb +3 -3
- data/lib/dry/schema/type_registry.rb +2 -2
- data/lib/dry/schema/types.rb +1 -1
- data/lib/dry/schema/value_coercer.rb +2 -2
- data/lib/dry/schema/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45a3441f7099ddd2ea6c0af6345f1fdcff20cf0629953dfc1eedcce5f8f54995
|
4
|
+
data.tar.gz: 841584478740cfc72a653e50445b9e3a16c01a6ce49b2c8c8375da76811ca50d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 368b80c79f2598dd4cf215c8223dbd704b75909857acf9fa51e60abed19ba3bdc2904ce5d7227ef7259b45593017131ce6ab5434ee3d713fe6b97eed643eecd8
|
7
|
+
data.tar.gz: 4f5ac8469feb749ed6ca95c022f99b822204d1b1cdde05969795571cabd43cd573111c86cfb4322413a22b5e99958156ba061a598c381989510ecf700fbfc7f0
|
data/CHANGELOG.md
CHANGED
@@ -1,40 +1,178 @@
|
|
1
|
-
|
1
|
+
## 1.5.0 2020-03-11
|
2
|
+
|
3
|
+
|
4
|
+
### Added
|
5
|
+
|
6
|
+
- Support for complex sum types ie `value([:integer, array[:integer])` (issue #214) (@solnic)
|
7
|
+
- You can now set global config via `Dry::Schema.config` (issue #205) (@robhanlon22)
|
8
|
+
- Default error message for `:uuid_v4?` predicate (isssue #230) (@solnic)
|
9
|
+
- [experimental] you can compose schemas in the DSL using the standard logic operators (issue #231 closed via #245) (@solnic)
|
10
|
+
- Hash schema type can now be used with proper keys and predicates inferring. Constructor
|
11
|
+
and default types are explicitly not supported (@flash-gordon)
|
12
|
+
```ruby
|
13
|
+
UserType = Dry::Types['hash'].schema(
|
14
|
+
name: 'string',
|
15
|
+
email: 'string'
|
16
|
+
)
|
17
|
+
|
18
|
+
Dry::Schema.define do
|
19
|
+
require(:user).hash(UserType)
|
20
|
+
end
|
21
|
+
```
|
22
|
+
- `:struct` extension which allows using dry-struct classes as source for hash schemas. Note that output will still be presented as plain hashes, returning structs from schemas will require more work, it's planned for next versions (@flash-gordon)
|
23
|
+
- `:info` extension which adds #info method to your schemas which produces a simple hash providing information about keys and types (issue #36 closed via #262) (@solnic)
|
2
24
|
|
3
25
|
### Fixed
|
4
26
|
|
5
|
-
|
27
|
+
- `maybe` macro in JSON schemas no longer converts empty strings to `nil`.
|
28
|
+
This was a bug in dry-types but your code may rely on this behavior. If you still
|
29
|
+
require this behavior, we recommend using a custom type (see Advanced -> Custom types in the docs) (@flash-gordon)
|
30
|
+
- YAML message backend no longer crashes when load_paths are empty (@robhanlon22)
|
31
|
+
- Callbacks can now be inherited from multiple parents (@skryukov)
|
32
|
+
- Callbacks work with nested schemas (issue #209) (@solnic)
|
33
|
+
- Custom type is respected when defining nested schemas (issue #174 closed via 263) (@solnic)
|
34
|
+
- Key map is properly inferred for maybe-hashes (issue #266 fixed via #269) (@solnic)
|
35
|
+
|
36
|
+
### Changed
|
37
|
+
|
38
|
+
- `:i18n` message backend delegates interpolation and caching to `I18n` (issue #211) (@robhanlon22)
|
39
|
+
- Raise ArgumentError in DSL if parent DSL configs differ (@robhanlon22)
|
40
|
+
- (internal) `PredicateInferrer` was removed. `Dry::Types::PredicateInferrer` is a drop-in replacement (@flash-gordon)
|
41
|
+
|
42
|
+
[Compare v1.4.3...v1.5.0](https://github.com/dry-rb/dry-schema/compare/v1.4.3...v1.5.0)
|
43
|
+
|
44
|
+
## 1.4.3 2020-01-08
|
45
|
+
|
46
|
+
|
47
|
+
### Added
|
48
|
+
|
49
|
+
- Pattern matching for `Dry::Schema::Result` objects (@flash-gordon)
|
50
|
+
```ruby
|
51
|
+
schema = Dry::Schema::Params { required(:name).filled }
|
52
|
+
case schema.('name' => 'John')
|
53
|
+
in name:
|
54
|
+
name # => 'John'
|
55
|
+
end
|
56
|
+
```
|
57
|
+
Try it with monads!
|
58
|
+
- Shortcut for nested schemas in `value` and `maybe` macros (@waiting-for-dev)
|
59
|
+
```ruby
|
60
|
+
Dry::Schema.Params do
|
61
|
+
required(:address).value(:hash) do
|
62
|
+
required(:city).filled
|
63
|
+
end
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
67
|
+
### Fixed
|
68
|
+
|
69
|
+
- Some keyword warnings that slipped into the previous release (@flash-gordon)
|
70
|
+
|
71
|
+
|
72
|
+
[Compare v1.4.2...v1.4.3](https://github.com/dry-rb/dry-schema/compare/v1.4.2...v1.4.3)
|
73
|
+
|
74
|
+
## 1.4.2 2019-12-19
|
75
|
+
|
76
|
+
|
77
|
+
### Fixed
|
78
|
+
|
79
|
+
- `I18n` messages backend supports procs as text properly (issue #208) (@robhanlon22)
|
80
|
+
- `I18n` messages backend supports message meta-data (issue #210) (@robhanlon22)
|
81
|
+
- Fixed keyword warnings from MRI 2.7.0 (@flash-gordon)
|
82
|
+
- Array with a member works correctly with `maybe` (issue #206) (@solnic)
|
83
|
+
|
84
|
+
|
85
|
+
[Compare v1.4.1...v1.4.2](https://github.com/dry-rb/dry-schema/compare/v1.4.1...v1.4.2)
|
86
|
+
|
87
|
+
## 1.4.1 2019-10-08
|
88
|
+
|
89
|
+
|
90
|
+
### Fixed
|
91
|
+
|
92
|
+
- Child schemas no longer mutate processing steps of their parent classes (@skryukov)
|
93
|
+
|
94
|
+
|
95
|
+
[Compare v1.4.0...v1.4.1](https://github.com/dry-rb/dry-schema/compare/v1.4.0...v1.4.1)
|
96
|
+
|
97
|
+
## 1.4.0 2019-10-08
|
98
|
+
|
99
|
+
|
100
|
+
### Added
|
101
|
+
|
102
|
+
- Support for passing multiple parent schemas. They are inherited from left to right (@ianwhite)
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
Dry::Schema.define(parent: [parent_a, parent_b, parent_c]) do
|
106
|
+
...
|
107
|
+
end
|
108
|
+
```
|
109
|
+
- Improved error messages about missing translations (@skryukov)
|
110
|
+
- [experimental] before/after callbacks for schema steps (@skryukov)
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
Dry::Schema.Params do
|
114
|
+
required(:name).value(:string)
|
115
|
+
optional(:age).value(:integer)
|
116
|
+
|
117
|
+
before(:value_coercer) do |result|
|
118
|
+
result.to_h.compact
|
119
|
+
end
|
120
|
+
end
|
121
|
+
```
|
122
|
+
|
123
|
+
### Fixed
|
124
|
+
|
125
|
+
- Added/fixed support for custom optional types (@flash-gordon)
|
126
|
+
|
127
|
+
|
128
|
+
[Compare v1.3.4...v1.4.0](https://github.com/dry-rb/dry-schema/compare/v1.3.4...v1.4.0)
|
129
|
+
|
130
|
+
## 1.3.4 2019-09-11
|
131
|
+
|
132
|
+
|
133
|
+
### Fixed
|
134
|
+
|
135
|
+
- Fixed regression where using `array?` predicate within a block would crach (issue #186) (@skryukov)
|
136
|
+
|
6
137
|
|
7
138
|
[Compare v1.3.3...v1.3.4](https://github.com/dry-rb/dry-schema/compare/v1.3.3...v1.3.4)
|
8
139
|
|
9
|
-
|
140
|
+
## 1.3.3 2019-08-14
|
141
|
+
|
10
142
|
|
11
143
|
### Fixed
|
12
144
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
145
|
+
- Reject attempts to build a nested schema for array types built on `Dry::Types::Nominal` (fixed #171) (@flash-gordon)
|
146
|
+
- Current `I18n.locale` is now properly handled when caching message templates (@flash-gordon)
|
147
|
+
- Default processor uses strict types by default, which fixes various cases when `maybe` is used with a constructor type (@flash-gordon)
|
148
|
+
- Namespaced messages no longer causes a crash when used with nested schemas (fixed #176) (@solnic)
|
149
|
+
|
17
150
|
|
18
151
|
[Compare v1.3.2...v1.3.3](https://github.com/dry-rb/dry-schema/compare/v1.3.2...v1.3.3)
|
19
152
|
|
20
|
-
|
153
|
+
## 1.3.2 2019-08-01
|
154
|
+
|
21
155
|
|
22
156
|
### Added
|
23
157
|
|
24
|
-
|
158
|
+
- Support for new predicates: `bytesize?`, `min_bytesize?` and `max_bytesize?` (@bmalinconico)
|
159
|
+
|
25
160
|
|
26
161
|
[Compare v1.3.1...v1.3.2](https://github.com/dry-rb/dry-schema/compare/v1.3.1...v1.3.2)
|
27
162
|
|
28
|
-
|
163
|
+
## 1.3.1 2019-07-08
|
164
|
+
|
29
165
|
|
30
166
|
### Fixed
|
31
167
|
|
32
|
-
|
33
|
-
|
168
|
+
- `Result#error?` works correctly with nested hashes and arrays (@solnic)
|
169
|
+
- `:hints` extension no longer causes a crash where base messages are generated too (issue #165) (@solnic)
|
170
|
+
|
34
171
|
|
35
172
|
[Compare v1.3.0...v1.3.1](https://github.com/dry-rb/dry-schema/compare/v1.3.0...v1.3.1)
|
36
173
|
|
37
|
-
|
174
|
+
## 1.3.0 2019-07-06
|
175
|
+
|
38
176
|
|
39
177
|
### Added
|
40
178
|
|
@@ -49,16 +187,17 @@
|
|
49
187
|
|
50
188
|
schema.(name: '').errors.to_h # => { name: ["size cannot be less than 1"] }
|
51
189
|
```
|
52
|
-
|
53
190
|
- Support for redefining re-used schemas (issue #43) (@skryukov)
|
54
191
|
|
55
192
|
### Fixed
|
56
193
|
|
57
194
|
- Type container is passed down to nested schemas (@flash-gordon)
|
58
195
|
|
196
|
+
|
59
197
|
[Compare v1.2.0...v1.3.0](https://github.com/dry-rb/dry-schema/compare/v1.2.0...v1.3.0)
|
60
198
|
|
61
|
-
|
199
|
+
## 1.2.0 2019-06-13
|
200
|
+
|
62
201
|
|
63
202
|
### Added
|
64
203
|
|
@@ -94,83 +233,96 @@
|
|
94
233
|
|
95
234
|
[Compare v1.1.0...v1.2.0](https://github.com/dry-rb/dry-schema/compare/v1.1.0...v1.2.0)
|
96
235
|
|
97
|
-
|
236
|
+
## 1.1.0 2019-05-30
|
237
|
+
|
98
238
|
|
99
239
|
### Added
|
100
240
|
|
101
|
-
- `config.messages.default_locale` for setting...default locale (surprise, surprise) (solnic)
|
102
|
-
- `Config` exposes `predicates` setting too (solnic)
|
241
|
+
- `config.messages.default_locale` for setting...default locale (surprise, surprise) (@solnic)
|
242
|
+
- `Config` exposes `predicates` setting too (@solnic)
|
103
243
|
|
104
244
|
### Fixed
|
105
245
|
|
106
|
-
- `filled` macro behavior results in `must be filled` error messages when appropriate - see PR #141 for more information (issue #134) (solnic)
|
107
|
-
- Filter rules no longer cause keys to be added to input (issue #142) (solnic)
|
108
|
-
- Filter rules work now with inheritance (solnic)
|
109
|
-
- Inherited type schemas used by coercion are now properly configured as `lax` type (solnic)
|
110
|
-
- `Config` is now finalized before instantiating schemas and properly dupped when its inherited (flash-gordon + solnic)
|
111
|
-
- `Config#eql?` works as expected (solnic)
|
112
|
-
- Predicates are properly inferred from array with a member type spec, ie `array[:integer]` results in `array? + each(:integer?)` (issue #140) (solnic)
|
246
|
+
- `filled` macro behavior results in `must be filled` error messages when appropriate - see PR #141 for more information (issue #134) (@solnic)
|
247
|
+
- Filter rules no longer cause keys to be added to input (issue #142) (@solnic)
|
248
|
+
- Filter rules work now with inheritance (@solnic)
|
249
|
+
- Inherited type schemas used by coercion are now properly configured as `lax` type (@solnic)
|
250
|
+
- `Config` is now finalized before instantiating schemas and properly dupped when its inherited (@flash-gordon + @solnic)
|
251
|
+
- `Config#eql?` works as expected (@solnic)
|
252
|
+
- Predicates are properly inferred from array with a member type spec, ie `array[:integer]` results in `array? + each(:integer?)` (issue #140) (@solnic)
|
253
|
+
|
113
254
|
|
114
255
|
[Compare v1.0.3...v1.1.0](https://github.com/dry-rb/dry-schema/compare/v1.0.3...v1.1.0)
|
115
256
|
|
116
|
-
|
257
|
+
## 1.0.3 2019-05-21
|
258
|
+
|
117
259
|
|
118
260
|
### Fixed
|
119
261
|
|
120
|
-
- `Object#hash` is no longer used to calculate cache keys due to a potential risk of having hash collisions (solnic)
|
121
|
-
- Predicate arguments are used again for template cache keys (solnic)
|
122
|
-
- `I18n` messages backend no longer evaluates templates twice (solnic)
|
262
|
+
- `Object#hash` is no longer used to calculate cache keys due to a potential risk of having hash collisions (@solnic)
|
263
|
+
- Predicate arguments are used again for template cache keys (@solnic)
|
264
|
+
- `I18n` messages backend no longer evaluates templates twice (@solnic)
|
265
|
+
|
123
266
|
|
124
267
|
[Compare v1.0.2...v1.0.3](https://github.com/dry-rb/dry-schema/compare/v1.0.2...v1.0.3)
|
125
268
|
|
126
|
-
|
269
|
+
## 1.0.2 2019-05-12
|
270
|
+
|
127
271
|
|
128
272
|
### Fixed
|
129
273
|
|
130
|
-
- Caching message templates uses restricted set of known keys to calculate cache keys (issue #132) (solnic)
|
274
|
+
- Caching message templates uses restricted set of known keys to calculate cache keys (issue #132) (@solnic)
|
275
|
+
|
131
276
|
|
132
277
|
[Compare v1.0.1...v1.0.2](https://github.com/dry-rb/dry-schema/compare/v1.0.1...v1.0.2)
|
133
278
|
|
134
|
-
|
279
|
+
## 1.0.1 2019-05-08
|
280
|
+
|
135
281
|
|
136
282
|
### Fixed
|
137
283
|
|
138
|
-
- Applying `key?` predicate no longer causes recursive calls to `Result#errors` (issue #130) (solnic)
|
284
|
+
- Applying `key?` predicate no longer causes recursive calls to `Result#errors` (issue #130) (@solnic)
|
139
285
|
|
140
|
-
[Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-schema/compare/v1.0.0...v1.0.1)
|
141
286
|
|
142
|
-
|
287
|
+
[Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-schema/compare/v1.0.0...v1.0.1)
|
143
288
|
|
144
|
-
|
289
|
+
## 1.0.0 2019-05-03
|
145
290
|
|
146
|
-
- [BREAKING] `Result#to_hash` was removed (solnic)
|
147
291
|
|
148
292
|
### Fixed
|
149
293
|
|
150
|
-
- Setting `:any` as the type spec no longer crashes (solnic)
|
151
|
-
- `Result#error?` handles paths to array elements correctly (solnic)
|
294
|
+
- Setting `:any` as the type spec no longer crashes (@solnic)
|
295
|
+
- `Result#error?` handles paths to array elements correctly (@solnic)
|
296
|
+
|
297
|
+
### Changed
|
298
|
+
|
299
|
+
- [BREAKING] `Result#to_hash` was removed (@solnic)
|
152
300
|
|
153
301
|
[Compare v0.6.0...v1.0.0](https://github.com/dry-rb/dry-schema/compare/v0.6.0...v1.0.0)
|
154
302
|
|
155
|
-
|
303
|
+
## 0.6.0 2019-04-24
|
304
|
+
|
156
305
|
|
157
306
|
### Changed
|
158
307
|
|
159
|
-
- Dependency on `dry-types` was bumped to `~> 1.0` (solnic)
|
160
|
-
- Dependency on `dry-logic` was bumped to `~> 1.0` (solnic)
|
161
|
-
- Dependency on `dry-initializer` was bumped to `~> 3.0` (solnic)
|
308
|
+
- Dependency on `dry-types` was bumped to `~> 1.0` (@solnic)
|
309
|
+
- Dependency on `dry-logic` was bumped to `~> 1.0` (@solnic)
|
310
|
+
- Dependency on `dry-initializer` was bumped to `~> 3.0` (@solnic)
|
162
311
|
|
163
312
|
[Compare v0.5.1...v0.6.0](https://github.com/dry-rb/dry-schema/compare/v0.5.1...v0.6.0)
|
164
313
|
|
165
|
-
|
314
|
+
## 0.5.1 2019-04-17
|
315
|
+
|
166
316
|
|
167
317
|
### Fixed
|
168
318
|
|
169
|
-
- Key map no longer crashes on unexpected input (issue #118) (solnic)
|
319
|
+
- Key map no longer crashes on unexpected input (issue #118) (@solnic)
|
320
|
+
|
170
321
|
|
171
322
|
[Compare v0.5.0...v0.5.1](https://github.com/dry-rb/dry-schema/compare/v0.5.0...v0.5.1)
|
172
323
|
|
173
|
-
|
324
|
+
## 0.5.0 2019-04-04
|
325
|
+
|
174
326
|
|
175
327
|
### Added
|
176
328
|
|
@@ -185,10 +337,9 @@
|
|
185
337
|
code: 123
|
186
338
|
```
|
187
339
|
|
188
|
-
Now your error hash will include `{ foo: [{ text: 'cannot be blank', code: 123 }] }` (solnic + flash-gordon)
|
189
|
-
|
190
|
-
- Support for type specs in `
|
191
|
-
- Support for type specs in `each` macro, ie `required(:tags).each(:integer)` (solnic)
|
340
|
+
Now your error hash will include `{ foo: [{ text: 'cannot be blank', code: 123 }] }` (@solnic + @flash-gordon)
|
341
|
+
- Support for type specs in `array` macro, ie `required(:tags).array(:integer)` (@solnic)
|
342
|
+
- Support for type specs in `each` macro, ie `required(:tags).each(:integer)` (@solnic)
|
192
343
|
- Shortcut for defining an array with hash as its member, ie:
|
193
344
|
|
194
345
|
```ruby
|
@@ -201,110 +352,111 @@
|
|
201
352
|
|
202
353
|
### Fixed
|
203
354
|
|
204
|
-
- Inferring predicates doesn't crash when `Any` type is used (flash-gordon)
|
205
|
-
- Inferring type specs when type is already set works correctly (solnic)
|
355
|
+
- Inferring predicates doesn't crash when `Any` type is used (@flash-gordon)
|
356
|
+
- Inferring type specs when type is already set works correctly (@solnic)
|
206
357
|
|
207
358
|
### Changed
|
208
359
|
|
209
|
-
- [BREAKING] `:monads` extension wraps entire result objects in `Success` or `Failure` (flash-gordon)
|
210
|
-
- When `:hints` are disabled, result AST will not include hint nodes (solnic)
|
360
|
+
- [BREAKING] `:monads` extension wraps entire result objects in `Success` or `Failure` (@flash-gordon)
|
361
|
+
- When `:hints` are disabled, result AST will not include hint nodes (@solnic)
|
211
362
|
|
212
363
|
[Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-schema/compare/v0.4.0...v0.5.0)
|
213
364
|
|
214
|
-
|
365
|
+
## 0.4.0 2019-03-26
|
366
|
+
|
215
367
|
|
216
368
|
### Added
|
217
369
|
|
218
|
-
- Schemas are now compatible with procs via `#to_proc` (issue #53) (solnic)
|
219
|
-
- Support for configuring `top_namespace` for localized messages (solnic)
|
220
|
-
- Support for configuring more than one load path for localized messages (solnic)
|
221
|
-
- Support for inferring predicates from arbitrary types (issue #101) (solnic)
|
370
|
+
- Schemas are now compatible with procs via `#to_proc` (issue #53) (@solnic)
|
371
|
+
- Support for configuring `top_namespace` for localized messages (@solnic)
|
372
|
+
- Support for configuring more than one load path for localized messages (@solnic)
|
373
|
+
- Support for inferring predicates from arbitrary types (issue #101) (@solnic)
|
222
374
|
|
223
375
|
### Fixed
|
224
376
|
|
225
|
-
- Handling of messages for `optional` keys without value rules works correctly (issue #87) (solnic)
|
226
|
-
- Message structure for `optional` keys with an array of hashes no longer duplicates keys (issue #89) (solnic)
|
227
|
-
- Inferring `:date_time?` predicate works correctly with `DateTime` types (issue #97) (solnic)
|
377
|
+
- Handling of messages for `optional` keys without value rules works correctly (issue #87) (@solnic)
|
378
|
+
- Message structure for `optional` keys with an array of hashes no longer duplicates keys (issue #89) (@solnic)
|
379
|
+
- Inferring `:date_time?` predicate works correctly with `DateTime` types (issue #97) (@solnic)
|
228
380
|
|
229
381
|
### Changed
|
230
382
|
|
231
|
-
- [BREAKING] Updated to work with `dry-types 0.15.0` (flash-gordon)
|
232
|
-
- [BREAKING] `Result#{errors,messages,hints}` returns `MessageSet` object now which is an enumerable coercible to a hash (solnic)
|
233
|
-
- [BREAKING] `Messages` backend classes no longer use global configuration (solnic)
|
234
|
-
- [BREAKING] Passing a non-symbol key name in the DSL will raise `ArgumentError` (issue #29) (solnic)
|
383
|
+
- [BREAKING] Updated to work with `dry-types 0.15.0` (@flash-gordon)
|
384
|
+
- [BREAKING] `Result#{errors,messages,hints}` returns `MessageSet` object now which is an enumerable coercible to a hash (@solnic)
|
385
|
+
- [BREAKING] `Messages` backend classes no longer use global configuration (@solnic)
|
386
|
+
- [BREAKING] Passing a non-symbol key name in the DSL will raise `ArgumentError` (issue #29) (@solnic)
|
235
387
|
- [BREAKING] Configuration for message backends is now nested under `messages` key with following settings:
|
236
388
|
- `messages.backend` - previously `messages`
|
237
389
|
- `messages.load_paths` - previously `messages_path`
|
238
390
|
- `messages.namespace` - previously `namespace`
|
239
391
|
- `messages.top_namespace` - **new setting** see above
|
240
|
-
- [BREAKING] `Messages::I18n` uses `I18.store_translations` instead of messing with `I18n.load_path` (solnic)
|
241
|
-
- Schemas (`Params` and `JSON`) have nicer inspect (solnic)
|
392
|
+
- [BREAKING] `Messages::I18n` uses `I18.store_translations` instead of messing with `I18n.load_path` (@solnic)
|
393
|
+
- Schemas (`Params` and `JSON`) have nicer inspect (@solnic)
|
242
394
|
|
243
395
|
[Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-schema/compare/v0.3.0...v0.4.0)
|
244
396
|
|
245
|
-
|
397
|
+
## 0.3.0 2018-03-04
|
398
|
+
|
246
399
|
|
247
400
|
### Fixed
|
248
401
|
|
249
|
-
- Configuration is properly inherited from a parent schema (skryukov)
|
250
|
-
- `Result#error?` returns `true` when a preceding key has errors (solnic)
|
251
|
-
- Predicate inferrer no longer chokes on sum, constructor and enum types (solnic)
|
252
|
-
- Predicate inferrer infers `:bool?` from boolean types (solnic)
|
253
|
-
- Block-based definitions using `array` works correctly (solnic)
|
254
|
-
- Using a disjunction with `array` and `hash` produces correct errors when element validation for array failed (solnic)
|
402
|
+
- Configuration is properly inherited from a parent schema (@skryukov)
|
403
|
+
- `Result#error?` returns `true` when a preceding key has errors (@solnic)
|
404
|
+
- Predicate inferrer no longer chokes on sum, constructor and enum types (@solnic)
|
405
|
+
- Predicate inferrer infers `:bool?` from boolean types (@solnic)
|
406
|
+
- Block-based definitions using `array` works correctly (@solnic)
|
407
|
+
- Using a disjunction with `array` and `hash` produces correct errors when element validation for array failed (@solnic)
|
255
408
|
|
256
409
|
### Changed
|
257
410
|
|
258
|
-
- Required ruby version was removed from gemspec for people who are stuck on MRI 2.3.x (solnic)
|
411
|
+
- Required ruby version was removed from gemspec for people who are stuck on MRI 2.3.x (@solnic)
|
259
412
|
|
260
413
|
[Compare v0.2.0...v0.3.0](https://github.com/dry-rb/dry-schema/compare/v0.2.0...v0.3.0)
|
261
414
|
|
262
|
-
|
415
|
+
## 0.2.0 2019-02-26
|
416
|
+
|
263
417
|
|
264
418
|
### Added
|
265
419
|
|
266
|
-
- New `hash` macro which prepends `hash?` type-check and allows nested schema definition (solnic)
|
267
|
-
- New `array` macro which works like `each` but prepends `array?` type-check (solnic)
|
420
|
+
- New `hash` macro which prepends `hash?` type-check and allows nested schema definition (@solnic)
|
421
|
+
- New `array` macro which works like `each` but prepends `array?` type-check (@solnic)
|
268
422
|
|
269
423
|
### Fixed
|
270
424
|
|
271
|
-
- Rule name translation works correctly with I18n (issue #52) (solnic)
|
272
|
-
- Rule name translation works correctly with namespaced messages (both I18n and plain YAML) (issue #57) (solnic)
|
273
|
-
- Error messages under namespaces are correctly resolved for overridden names (issue #53) (solnic)
|
274
|
-
- Namespaced error messages work correctly when schemas are reused within other schemas (issue #49) (solnic)
|
275
|
-
- Child schema can override inherited rules now (issue #66) (skryukov)
|
276
|
-
- Hints are correctly generated for disjunction that use type-check predicates (issue #24) (solnic)
|
277
|
-
- Hints are correctly generated for nested schemas (issue #26) (solnic)
|
278
|
-
- `filled` macro respects inferred type-check predicates and puts them in front (solnic)
|
279
|
-
- Value coercion works correctly with re-usable nested schemas (issue #25) (solnic)
|
425
|
+
- Rule name translation works correctly with I18n (issue #52) (@solnic)
|
426
|
+
- Rule name translation works correctly with namespaced messages (both I18n and plain YAML) (issue #57) (@solnic)
|
427
|
+
- Error messages under namespaces are correctly resolved for overridden names (issue #53) (@solnic)
|
428
|
+
- Namespaced error messages work correctly when schemas are reused within other schemas (issue #49) (@solnic)
|
429
|
+
- Child schema can override inherited rules now (issue #66) (@skryukov)
|
430
|
+
- Hints are correctly generated for disjunction that use type-check predicates (issue #24) (@solnic)
|
431
|
+
- Hints are correctly generated for nested schemas (issue #26) (@solnic)
|
432
|
+
- `filled` macro respects inferred type-check predicates and puts them in front (@solnic)
|
433
|
+
- Value coercion works correctly with re-usable nested schemas (issue #25) (@solnic)
|
280
434
|
|
281
435
|
### Changed
|
282
436
|
|
283
|
-
- [BREAKING] **Messages are now configured under `dry_schema` namespace by default** (issue #38) (solnic)
|
284
|
-
- [BREAKING] Hints are now an optional feature provided by `:hints` extension, to load it do `Dry::Schema.load_extensions(:hints)` (solnic)
|
285
|
-
- [BREAKING] Hints generation was improved in general, output of `Result#messages` and `Result#hints` changed in some cases (solnic)
|
286
|
-
- [BREAKING] `schema` macro no longer prepends `hash?` check, for this behavior use the new `hash` macro (see #31) (solnic)
|
287
|
-
- [BREAKING] Support for MRI < 2.4 was dropped (solnic)
|
437
|
+
- [BREAKING] **Messages are now configured under `dry_schema` namespace by default** (issue #38) (@solnic)
|
438
|
+
- [BREAKING] Hints are now an optional feature provided by `:hints` extension, to load it do `Dry::Schema.load_extensions(:hints)` (@solnic)
|
439
|
+
- [BREAKING] Hints generation was improved in general, output of `Result#messages` and `Result#hints` changed in some cases (@solnic)
|
440
|
+
- [BREAKING] `schema` macro no longer prepends `hash?` check, for this behavior use the new `hash` macro (see #31) (@solnic)
|
441
|
+
- [BREAKING] Support for MRI < 2.4 was dropped (@solnic)
|
288
442
|
|
289
443
|
[Compare v0.1.1...v0.2.0](https://github.com/dry-rb/dry-schema/compare/v0.1.1...v0.2.0)
|
290
444
|
|
291
|
-
|
445
|
+
## 0.1.1 2019-02-17
|
446
|
+
|
292
447
|
|
293
448
|
### Added
|
294
449
|
|
295
|
-
- `Result#error?` supports checking nested errors too ie`result.error?('user.address')` (solnic)
|
450
|
+
- `Result#error?` supports checking nested errors too ie`result.error?('user.address')` (@solnic)
|
296
451
|
|
297
452
|
### Fixed
|
298
453
|
|
299
|
-
- Fix issues with templates and invalid tokens (issue #27) (solnic)
|
300
|
-
- Fix Ruby warnings (flash-gordon)
|
301
|
-
|
302
|
-
### Internal
|
454
|
+
- Fix issues with templates and invalid tokens (issue #27) (@solnic)
|
455
|
+
- Fix Ruby warnings (@flash-gordon)
|
303
456
|
|
304
|
-
- Key and value coercers are now equalizable (flash-gordon)
|
305
457
|
|
306
458
|
[Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-schema/compare/v0.1.0...v0.1.1)
|
307
459
|
|
308
|
-
|
460
|
+
## 0.1.0 2019-01-30
|
309
461
|
|
310
462
|
Initial release.
|