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