dry-schema 1.3.0 → 1.4.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 +162 -105
- data/README.md +3 -1
- data/config/errors.yml +9 -0
- data/lib/dry/schema/constants.rb +3 -2
- data/lib/dry/schema/dsl.rb +63 -16
- data/lib/dry/schema/extensions/hints/message_set_methods.rb +48 -1
- data/lib/dry/schema/macros/dsl.rb +21 -4
- data/lib/dry/schema/macros/filled.rb +0 -7
- data/lib/dry/schema/macros/key.rb +0 -1
- data/lib/dry/schema/macros/schema.rb +2 -7
- data/lib/dry/schema/macros/value.rb +21 -2
- data/lib/dry/schema/message.rb +1 -1
- data/lib/dry/schema/message_compiler.rb +2 -1
- data/lib/dry/schema/messages/abstract.rb +42 -12
- data/lib/dry/schema/messages/i18n.rb +9 -0
- data/lib/dry/schema/messages/namespaced.rb +6 -1
- data/lib/dry/schema/messages/yaml.rb +12 -0
- data/lib/dry/schema/namespaced_rule.rb +2 -1
- data/lib/dry/schema/path.rb +10 -6
- data/lib/dry/schema/predicate_registry.rb +2 -23
- data/lib/dry/schema/processor.rb +9 -26
- data/lib/dry/schema/processor_steps.rb +101 -0
- data/lib/dry/schema/type_registry.rb +2 -2
- data/lib/dry/schema/version.rb +1 -1
- metadata +5 -5
- data/lib/dry/schema/primitive_inferrer.rb +0 -98
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bf30b15bfb1d11c70a14898fe9ac7d9cb74f46f70b5a26b1e08cf6568414160
|
4
|
+
data.tar.gz: fcd0fc1691ffe1e2b2f5129710fa920daf7ec968749625e050fba3ee9a2a7f73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d5a852339e072be3b033268ed826d75a319cf0c33f279e507fc80d6a3ba079370bd7e2859d3aaa5dba786e85521f9c328cf5107f941fa05f422d0bd1a8250af
|
7
|
+
data.tar.gz: f1e95d4206bc7f45ccc8a5018c14f52f20db4c314509d2eedf72a67284cd574f43ee8d73ec071b7325be0512b87269043d1d488ab63c437fd767032907b0183f
|
data/CHANGELOG.md
CHANGED
@@ -1,18 +1,75 @@
|
|
1
|
+
# 1.4.0 2019-10-08
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
- Support for passing multiple parent schemas. They are inherited from left to right (@ianwhite)
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
Dry::Schema.define(parent: [parent_a, parent_b, parent_c]) do
|
9
|
+
...
|
10
|
+
end
|
11
|
+
```
|
12
|
+
|
13
|
+
- Improved error messages about missing translations (@skryukov)
|
14
|
+
- [experimental] before/after callbacks for schema steps (@skryukov)
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
|
18
|
+
- Added/fixed support for custom optional types (@flash-gordon)
|
19
|
+
|
20
|
+
[Compare v1.3.4...v1.4.0](https://github.com/dry-rb/dry-schema/compare/v1.3.4...v1.4.0)
|
21
|
+
|
22
|
+
# 1.3.4 2019-09-11
|
23
|
+
|
24
|
+
### Fixed
|
25
|
+
|
26
|
+
- Fixed regression where using `array?` predicate within a block would crach (issue #186) (@skryukov)
|
27
|
+
|
28
|
+
[Compare v1.3.3...v1.3.4](https://github.com/dry-rb/dry-schema/compare/v1.3.3...v1.3.4)
|
29
|
+
|
30
|
+
# 1.3.3 2019-08-14
|
31
|
+
|
32
|
+
### Fixed
|
33
|
+
|
34
|
+
- Reject attempts to build a nested schema for array types built on `Dry::Types::Nominal` (fixed #171) (@flash-gordon)
|
35
|
+
- Current `I18n.locale` is now properly handled when caching message templates (@flash-gordon)
|
36
|
+
- Default processor uses strict types by default, which fixes various cases when `maybe` is used with a constructor type (@flash-gordon)
|
37
|
+
- Namespaced messages no longer causes a crash when used with nested schemas (fixed #176) (@solnic)
|
38
|
+
|
39
|
+
[Compare v1.3.2...v1.3.3](https://github.com/dry-rb/dry-schema/compare/v1.3.2...v1.3.3)
|
40
|
+
|
41
|
+
# 1.3.2 2019-08-01
|
42
|
+
|
43
|
+
### Added
|
44
|
+
|
45
|
+
- Support for new predicates: `bytesize?`, `min_bytesize?` and `max_bytesize?` (@bmalinconico)
|
46
|
+
|
47
|
+
[Compare v1.3.1...v1.3.2](https://github.com/dry-rb/dry-schema/compare/v1.3.1...v1.3.2)
|
48
|
+
|
49
|
+
# 1.3.1 2019-07-08
|
50
|
+
|
51
|
+
### Fixed
|
52
|
+
|
53
|
+
- `Result#error?` works correctly with nested hashes and arrays (@solnic)
|
54
|
+
- `:hints` extension no longer causes a crash where base messages are generated too (issue #165) (@solnic)
|
55
|
+
|
56
|
+
[Compare v1.3.0...v1.3.1](https://github.com/dry-rb/dry-schema/compare/v1.3.0...v1.3.1)
|
57
|
+
|
1
58
|
# 1.3.0 2019-07-06
|
2
59
|
|
3
60
|
### Added
|
4
61
|
|
5
62
|
- Automatic predicate inferring for constrained types! (@flash-gordon)
|
6
63
|
|
7
|
-
|
8
|
-
|
64
|
+
```ruby
|
65
|
+
Types::Name = Types::String.constrained(min_size: 1)
|
9
66
|
|
10
|
-
|
11
|
-
|
12
|
-
|
67
|
+
schema = Dry::Schema.define do
|
68
|
+
required(:name).value(Types::Name)
|
69
|
+
end
|
13
70
|
|
14
|
-
|
15
|
-
|
71
|
+
schema.(name: '').errors.to_h # => { name: ["size cannot be less than 1"] }
|
72
|
+
```
|
16
73
|
|
17
74
|
- Support for redefining re-used schemas (issue #43) (@skryukov)
|
18
75
|
|
@@ -28,19 +85,19 @@
|
|
28
85
|
|
29
86
|
- Ability to configure your own type container (@Morozzzko)
|
30
87
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
88
|
+
```ruby
|
89
|
+
types = Dry::Schema::TypeContainer.new
|
90
|
+
types.register(
|
91
|
+
'params.trimmed_string',
|
92
|
+
Types::String.constructor(&:strip).constructor(&:downcase)
|
93
|
+
)
|
37
94
|
|
38
|
-
|
39
|
-
|
95
|
+
Dry::Schema.Params do
|
96
|
+
config.types = types
|
40
97
|
|
41
|
-
|
42
|
-
|
43
|
-
|
98
|
+
require(:name).value(:trimmed_string)
|
99
|
+
end
|
100
|
+
```
|
44
101
|
|
45
102
|
### Fixed
|
46
103
|
|
@@ -62,18 +119,18 @@
|
|
62
119
|
|
63
120
|
### Added
|
64
121
|
|
65
|
-
- `config.messages.default_locale` for setting...default locale (surprise, surprise) (solnic)
|
66
|
-
- `Config` exposes `predicates` setting too (solnic)
|
122
|
+
- `config.messages.default_locale` for setting...default locale (surprise, surprise) (@solnic)
|
123
|
+
- `Config` exposes `predicates` setting too (@solnic)
|
67
124
|
|
68
125
|
### Fixed
|
69
126
|
|
70
|
-
- `filled` macro behavior results in `must be filled` error messages when appropriate - see PR #141 for more information (issue #134) (solnic)
|
71
|
-
- Filter rules no longer cause keys to be added to input (issue #142) (solnic)
|
72
|
-
- Filter rules work now with inheritance (solnic)
|
73
|
-
- Inherited type schemas used by coercion are now properly configured as `lax` type (solnic)
|
74
|
-
- `Config` is now finalized before instantiating schemas and properly dupped when its inherited (flash-gordon + solnic)
|
75
|
-
- `Config#eql?` works as expected (solnic)
|
76
|
-
- Predicates are properly inferred from array with a member type spec, ie `array[:integer]` results in `array? + each(:integer?)` (issue #140) (solnic)
|
127
|
+
- `filled` macro behavior results in `must be filled` error messages when appropriate - see PR #141 for more information (issue #134) (@solnic)
|
128
|
+
- Filter rules no longer cause keys to be added to input (issue #142) (@solnic)
|
129
|
+
- Filter rules work now with inheritance (@solnic)
|
130
|
+
- Inherited type schemas used by coercion are now properly configured as `lax` type (@solnic)
|
131
|
+
- `Config` is now finalized before instantiating schemas and properly dupped when its inherited (@flash-gordon + @solnic)
|
132
|
+
- `Config#eql?` works as expected (@solnic)
|
133
|
+
- Predicates are properly inferred from array with a member type spec, ie `array[:integer]` results in `array? + each(:integer?)` (issue #140) (@solnic)
|
77
134
|
|
78
135
|
[Compare v1.0.3...v1.1.0](https://github.com/dry-rb/dry-schema/compare/v1.0.3...v1.1.0)
|
79
136
|
|
@@ -81,9 +138,9 @@
|
|
81
138
|
|
82
139
|
### Fixed
|
83
140
|
|
84
|
-
- `Object#hash` is no longer used to calculate cache keys due to a potential risk of having hash collisions (solnic)
|
85
|
-
- Predicate arguments are used again for template cache keys (solnic)
|
86
|
-
- `I18n` messages backend no longer evaluates templates twice (solnic)
|
141
|
+
- `Object#hash` is no longer used to calculate cache keys due to a potential risk of having hash collisions (@solnic)
|
142
|
+
- Predicate arguments are used again for template cache keys (@solnic)
|
143
|
+
- `I18n` messages backend no longer evaluates templates twice (@solnic)
|
87
144
|
|
88
145
|
[Compare v1.0.2...v1.0.3](https://github.com/dry-rb/dry-schema/compare/v1.0.2...v1.0.3)
|
89
146
|
|
@@ -91,7 +148,7 @@
|
|
91
148
|
|
92
149
|
### Fixed
|
93
150
|
|
94
|
-
- Caching message templates uses restricted set of known keys to calculate cache keys (issue #132) (solnic)
|
151
|
+
- Caching message templates uses restricted set of known keys to calculate cache keys (issue #132) (@solnic)
|
95
152
|
|
96
153
|
[Compare v1.0.1...v1.0.2](https://github.com/dry-rb/dry-schema/compare/v1.0.1...v1.0.2)
|
97
154
|
|
@@ -99,7 +156,7 @@
|
|
99
156
|
|
100
157
|
### Fixed
|
101
158
|
|
102
|
-
- Applying `key?` predicate no longer causes recursive calls to `Result#errors` (issue #130) (solnic)
|
159
|
+
- Applying `key?` predicate no longer causes recursive calls to `Result#errors` (issue #130) (@solnic)
|
103
160
|
|
104
161
|
[Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-schema/compare/v1.0.0...v1.0.1)
|
105
162
|
|
@@ -107,12 +164,12 @@
|
|
107
164
|
|
108
165
|
### Changed
|
109
166
|
|
110
|
-
- [BREAKING] `Result#to_hash` was removed (solnic)
|
167
|
+
- [BREAKING] `Result#to_hash` was removed (@solnic)
|
111
168
|
|
112
169
|
### Fixed
|
113
170
|
|
114
|
-
- Setting `:any` as the type spec no longer crashes (solnic)
|
115
|
-
- `Result#error?` handles paths to array elements correctly (solnic)
|
171
|
+
- Setting `:any` as the type spec no longer crashes (@solnic)
|
172
|
+
- `Result#error?` handles paths to array elements correctly (@solnic)
|
116
173
|
|
117
174
|
[Compare v0.6.0...v1.0.0](https://github.com/dry-rb/dry-schema/compare/v0.6.0...v1.0.0)
|
118
175
|
|
@@ -120,9 +177,9 @@
|
|
120
177
|
|
121
178
|
### Changed
|
122
179
|
|
123
|
-
- Dependency on `dry-types` was bumped to `~> 1.0` (solnic)
|
124
|
-
- Dependency on `dry-logic` was bumped to `~> 1.0` (solnic)
|
125
|
-
- Dependency on `dry-initializer` was bumped to `~> 3.0` (solnic)
|
180
|
+
- Dependency on `dry-types` was bumped to `~> 1.0` (@solnic)
|
181
|
+
- Dependency on `dry-logic` was bumped to `~> 1.0` (@solnic)
|
182
|
+
- Dependency on `dry-initializer` was bumped to `~> 3.0` (@solnic)
|
126
183
|
|
127
184
|
[Compare v0.5.1...v0.6.0](https://github.com/dry-rb/dry-schema/compare/v0.5.1...v0.6.0)
|
128
185
|
|
@@ -130,7 +187,7 @@
|
|
130
187
|
|
131
188
|
### Fixed
|
132
189
|
|
133
|
-
- Key map no longer crashes on unexpected input (issue #118) (solnic)
|
190
|
+
- Key map no longer crashes on unexpected input (issue #118) (@solnic)
|
134
191
|
|
135
192
|
[Compare v0.5.0...v0.5.1](https://github.com/dry-rb/dry-schema/compare/v0.5.0...v0.5.1)
|
136
193
|
|
@@ -140,38 +197,38 @@
|
|
140
197
|
|
141
198
|
- Support for arbitrary meta-data in messages, ie:
|
142
199
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
200
|
+
```yaml
|
201
|
+
en:
|
202
|
+
dry_schema:
|
203
|
+
errors:
|
204
|
+
filled?:
|
205
|
+
text: "cannot be blank"
|
206
|
+
code: 123
|
207
|
+
```
|
151
208
|
|
152
|
-
|
209
|
+
Now your error hash will include `{ foo: [{ text: 'cannot be blank', code: 123 }] }` (@solnic + @flash-gordon)
|
153
210
|
|
154
|
-
- Support for type specs in `array` macro, ie `required(:tags).array(:integer)` (solnic)
|
155
|
-
- Support for type specs in `each` macro, ie `required(:tags).each(:integer)` (solnic)
|
211
|
+
- Support for type specs in `array` macro, ie `required(:tags).array(:integer)` (@solnic)
|
212
|
+
- Support for type specs in `each` macro, ie `required(:tags).each(:integer)` (@solnic)
|
156
213
|
- Shortcut for defining an array with hash as its member, ie:
|
157
214
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
215
|
+
```ruby
|
216
|
+
Dry::Schema.Params do
|
217
|
+
required(:tags).array(:hash) do
|
218
|
+
required(:name).filled(:string)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
```
|
165
222
|
|
166
223
|
### Fixed
|
167
224
|
|
168
|
-
- Inferring predicates doesn't crash when `Any` type is used (flash-gordon)
|
169
|
-
- Inferring type specs when type is already set works correctly (solnic)
|
225
|
+
- Inferring predicates doesn't crash when `Any` type is used (@flash-gordon)
|
226
|
+
- Inferring type specs when type is already set works correctly (@solnic)
|
170
227
|
|
171
228
|
### Changed
|
172
229
|
|
173
|
-
- [BREAKING] `:monads` extension wraps entire result objects in `Success` or `Failure` (flash-gordon)
|
174
|
-
- When `:hints` are disabled, result AST will not include hint nodes (solnic)
|
230
|
+
- [BREAKING] `:monads` extension wraps entire result objects in `Success` or `Failure` (@flash-gordon)
|
231
|
+
- When `:hints` are disabled, result AST will not include hint nodes (@solnic)
|
175
232
|
|
176
233
|
[Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-schema/compare/v0.4.0...v0.5.0)
|
177
234
|
|
@@ -179,30 +236,30 @@
|
|
179
236
|
|
180
237
|
### Added
|
181
238
|
|
182
|
-
- Schemas are now compatible with procs via `#to_proc` (issue #53) (solnic)
|
183
|
-
- Support for configuring `top_namespace` for localized messages (solnic)
|
184
|
-
- Support for configuring more than one load path for localized messages (solnic)
|
185
|
-
- Support for inferring predicates from arbitrary types (issue #101) (solnic)
|
239
|
+
- Schemas are now compatible with procs via `#to_proc` (issue #53) (@solnic)
|
240
|
+
- Support for configuring `top_namespace` for localized messages (@solnic)
|
241
|
+
- Support for configuring more than one load path for localized messages (@solnic)
|
242
|
+
- Support for inferring predicates from arbitrary types (issue #101) (@solnic)
|
186
243
|
|
187
244
|
### Fixed
|
188
245
|
|
189
|
-
- Handling of messages for `optional` keys without value rules works correctly (issue #87) (solnic)
|
190
|
-
- Message structure for `optional` keys with an array of hashes no longer duplicates keys (issue #89) (solnic)
|
191
|
-
- Inferring `:date_time?` predicate works correctly with `DateTime` types (issue #97) (solnic)
|
246
|
+
- Handling of messages for `optional` keys without value rules works correctly (issue #87) (@solnic)
|
247
|
+
- Message structure for `optional` keys with an array of hashes no longer duplicates keys (issue #89) (@solnic)
|
248
|
+
- Inferring `:date_time?` predicate works correctly with `DateTime` types (issue #97) (@solnic)
|
192
249
|
|
193
250
|
### Changed
|
194
251
|
|
195
|
-
- [BREAKING] Updated to work with `dry-types 0.15.0` (flash-gordon)
|
196
|
-
- [BREAKING] `Result#{errors,messages,hints}` returns `MessageSet` object now which is an enumerable coercible to a hash (solnic)
|
197
|
-
- [BREAKING] `Messages` backend classes no longer use global configuration (solnic)
|
198
|
-
- [BREAKING] Passing a non-symbol key name in the DSL will raise `ArgumentError` (issue #29) (solnic)
|
252
|
+
- [BREAKING] Updated to work with `dry-types 0.15.0` (@flash-gordon)
|
253
|
+
- [BREAKING] `Result#{errors,messages,hints}` returns `MessageSet` object now which is an enumerable coercible to a hash (@solnic)
|
254
|
+
- [BREAKING] `Messages` backend classes no longer use global configuration (@solnic)
|
255
|
+
- [BREAKING] Passing a non-symbol key name in the DSL will raise `ArgumentError` (issue #29) (@solnic)
|
199
256
|
- [BREAKING] Configuration for message backends is now nested under `messages` key with following settings:
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
- [BREAKING] `Messages::I18n` uses `I18.store_translations` instead of messing with `I18n.load_path` (solnic)
|
205
|
-
- Schemas (`Params` and `JSON`) have nicer inspect (solnic)
|
257
|
+
- `messages.backend` - previously `messages`
|
258
|
+
- `messages.load_paths` - previously `messages_path`
|
259
|
+
- `messages.namespace` - previously `namespace`
|
260
|
+
- `messages.top_namespace` - **new setting** see above
|
261
|
+
- [BREAKING] `Messages::I18n` uses `I18.store_translations` instead of messing with `I18n.load_path` (@solnic)
|
262
|
+
- Schemas (`Params` and `JSON`) have nicer inspect (@solnic)
|
206
263
|
|
207
264
|
[Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-schema/compare/v0.3.0...v0.4.0)
|
208
265
|
|
@@ -210,16 +267,16 @@
|
|
210
267
|
|
211
268
|
### Fixed
|
212
269
|
|
213
|
-
- Configuration is properly inherited from a parent schema (skryukov)
|
214
|
-
- `Result#error?` returns `true` when a preceding key has errors (solnic)
|
215
|
-
- Predicate inferrer no longer chokes on sum, constructor and enum types (solnic)
|
216
|
-
- Predicate inferrer infers `:bool?` from boolean types (solnic)
|
217
|
-
- Block-based definitions using `array` works correctly (solnic)
|
218
|
-
- Using a disjunction with `array` and `hash` produces correct errors when element validation for array failed (solnic)
|
270
|
+
- Configuration is properly inherited from a parent schema (@skryukov)
|
271
|
+
- `Result#error?` returns `true` when a preceding key has errors (@solnic)
|
272
|
+
- Predicate inferrer no longer chokes on sum, constructor and enum types (@solnic)
|
273
|
+
- Predicate inferrer infers `:bool?` from boolean types (@solnic)
|
274
|
+
- Block-based definitions using `array` works correctly (@solnic)
|
275
|
+
- Using a disjunction with `array` and `hash` produces correct errors when element validation for array failed (@solnic)
|
219
276
|
|
220
277
|
### Changed
|
221
278
|
|
222
|
-
- Required ruby version was removed from gemspec for people who are stuck on MRI 2.3.x (solnic)
|
279
|
+
- Required ruby version was removed from gemspec for people who are stuck on MRI 2.3.x (@solnic)
|
223
280
|
|
224
281
|
[Compare v0.2.0...v0.3.0](https://github.com/dry-rb/dry-schema/compare/v0.2.0...v0.3.0)
|
225
282
|
|
@@ -227,28 +284,28 @@
|
|
227
284
|
|
228
285
|
### Added
|
229
286
|
|
230
|
-
- New `hash` macro which prepends `hash?` type-check and allows nested schema definition (solnic)
|
231
|
-
- New `array` macro which works like `each` but prepends `array?` type-check (solnic)
|
287
|
+
- New `hash` macro which prepends `hash?` type-check and allows nested schema definition (@solnic)
|
288
|
+
- New `array` macro which works like `each` but prepends `array?` type-check (@solnic)
|
232
289
|
|
233
290
|
### Fixed
|
234
291
|
|
235
|
-
- Rule name translation works correctly with I18n (issue #52) (solnic)
|
236
|
-
- Rule name translation works correctly with namespaced messages (both I18n and plain YAML) (issue #57) (solnic)
|
237
|
-
- Error messages under namespaces are correctly resolved for overridden names (issue #53) (solnic)
|
238
|
-
- Namespaced error messages work correctly when schemas are reused within other schemas (issue #49) (solnic)
|
239
|
-
- Child schema can override inherited rules now (issue #66) (skryukov)
|
240
|
-
- Hints are correctly generated for disjunction that use type-check predicates (issue #24) (solnic)
|
241
|
-
- Hints are correctly generated for nested schemas (issue #26) (solnic)
|
242
|
-
- `filled` macro respects inferred type-check predicates and puts them in front (solnic)
|
243
|
-
- Value coercion works correctly with re-usable nested schemas (issue #25) (solnic)
|
292
|
+
- Rule name translation works correctly with I18n (issue #52) (@solnic)
|
293
|
+
- Rule name translation works correctly with namespaced messages (both I18n and plain YAML) (issue #57) (@solnic)
|
294
|
+
- Error messages under namespaces are correctly resolved for overridden names (issue #53) (@solnic)
|
295
|
+
- Namespaced error messages work correctly when schemas are reused within other schemas (issue #49) (@solnic)
|
296
|
+
- Child schema can override inherited rules now (issue #66) (@skryukov)
|
297
|
+
- Hints are correctly generated for disjunction that use type-check predicates (issue #24) (@solnic)
|
298
|
+
- Hints are correctly generated for nested schemas (issue #26) (@solnic)
|
299
|
+
- `filled` macro respects inferred type-check predicates and puts them in front (@solnic)
|
300
|
+
- Value coercion works correctly with re-usable nested schemas (issue #25) (@solnic)
|
244
301
|
|
245
302
|
### Changed
|
246
303
|
|
247
|
-
- [BREAKING] **Messages are now configured under `dry_schema` namespace by default** (issue #38) (solnic)
|
248
|
-
- [BREAKING] Hints are now an optional feature provided by `:hints` extension, to load it do `Dry::Schema.load_extensions(:hints)` (solnic)
|
249
|
-
- [BREAKING] Hints generation was improved in general, output of `Result#messages` and `Result#hints` changed in some cases (solnic)
|
250
|
-
- [BREAKING] `schema` macro no longer prepends `hash?` check, for this behavior use the new `hash` macro (see #31) (solnic)
|
251
|
-
- [BREAKING] Support for MRI < 2.4 was dropped (solnic)
|
304
|
+
- [BREAKING] **Messages are now configured under `dry_schema` namespace by default** (issue #38) (@solnic)
|
305
|
+
- [BREAKING] Hints are now an optional feature provided by `:hints` extension, to load it do `Dry::Schema.load_extensions(:hints)` (@solnic)
|
306
|
+
- [BREAKING] Hints generation was improved in general, output of `Result#messages` and `Result#hints` changed in some cases (@solnic)
|
307
|
+
- [BREAKING] `schema` macro no longer prepends `hash?` check, for this behavior use the new `hash` macro (see #31) (@solnic)
|
308
|
+
- [BREAKING] Support for MRI < 2.4 was dropped (@solnic)
|
252
309
|
|
253
310
|
[Compare v0.1.1...v0.2.0](https://github.com/dry-rb/dry-schema/compare/v0.1.1...v0.2.0)
|
254
311
|
|
@@ -256,16 +313,16 @@
|
|
256
313
|
|
257
314
|
### Added
|
258
315
|
|
259
|
-
- `Result#error?` supports checking nested errors too ie`result.error?('user.address')` (solnic)
|
316
|
+
- `Result#error?` supports checking nested errors too ie`result.error?('user.address')` (@solnic)
|
260
317
|
|
261
318
|
### Fixed
|
262
319
|
|
263
|
-
- Fix issues with templates and invalid tokens (issue #27) (solnic)
|
264
|
-
- Fix Ruby warnings (flash-gordon)
|
320
|
+
- Fix issues with templates and invalid tokens (issue #27) (@solnic)
|
321
|
+
- Fix Ruby warnings (@flash-gordon)
|
265
322
|
|
266
323
|
### Internal
|
267
324
|
|
268
|
-
- Key and value coercers are now equalizable (flash-gordon)
|
325
|
+
- Key and value coercers are now equalizable (@flash-gordon)
|
269
326
|
|
270
327
|
[Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-schema/compare/v0.1.0...v0.1.1)
|
271
328
|
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[gem]: https://rubygems.org/gems/dry-schema
|
2
2
|
[travis]: https://travis-ci.com/dry-rb/dry-schema
|
3
|
+
[actions]: https://github.com/dry-rb/dry-schema/actions
|
3
4
|
[codeclimate]: https://codeclimate.com/github/dry-rb/dry-schema
|
4
5
|
[chat]: https://dry-rb.zulipchat.com
|
5
6
|
[inchpages]: http://inch-ci.org/github/dry-rb/dry-schema
|
@@ -7,7 +8,8 @@
|
|
7
8
|
# dry-schema [][chat]
|
8
9
|
|
9
10
|
[][gem]
|
10
|
-
[][travis]
|
12
|
+
[][actions]
|
11
13
|
[][codeclimate]
|
12
14
|
[][codeclimate]
|
13
15
|
[][inchpages]
|
data/config/errors.yml
CHANGED
@@ -73,8 +73,12 @@ en:
|
|
73
73
|
|
74
74
|
max_size?: "size cannot be greater than %{num}"
|
75
75
|
|
76
|
+
max_bytesize?: "bytesize cannot be greater than %{num}"
|
77
|
+
|
76
78
|
min_size?: "size cannot be less than %{num}"
|
77
79
|
|
80
|
+
min_bytesize?: "bytesize cannot be less than %{num}"
|
81
|
+
|
78
82
|
nil?: "cannot be defined"
|
79
83
|
|
80
84
|
str?: "must be a string"
|
@@ -92,5 +96,10 @@ en:
|
|
92
96
|
default: "length must be %{size}"
|
93
97
|
range: "length must be within %{size_left} - %{size_right}"
|
94
98
|
|
99
|
+
bytesize?:
|
100
|
+
arg:
|
101
|
+
default: "must be %{size} bytes long"
|
102
|
+
range: "must be within %{size_left} - %{size_right} bytes long"
|
103
|
+
|
95
104
|
not:
|
96
105
|
empty?: "cannot be empty"
|