dry-schema 1.4.0 → 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 +19 -0
- data/lib/dry/schema/processor_steps.rb +16 -1
- data/lib/dry/schema/version.rb +1 -1
- metadata +1 -1
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,3 +1,11 @@
|
|
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
|
+
|
1
9
|
# 1.4.0 2019-10-08
|
2
10
|
|
3
11
|
### Added
|
@@ -13,6 +21,17 @@
|
|
13
21
|
- Improved error messages about missing translations (@skryukov)
|
14
22
|
- [experimental] before/after callbacks for schema steps (@skryukov)
|
15
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
|
+
|
16
35
|
### Fixed
|
17
36
|
|
18
37
|
- Added/fixed support for custom optional types (@flash-gordon)
|
@@ -26,6 +26,13 @@ module Dry
|
|
26
26
|
option :before_steps, default: -> { EMPTY_HASH.dup }
|
27
27
|
option :after_steps, default: -> { EMPTY_HASH.dup }
|
28
28
|
|
29
|
+
# Executes steps and callbacks in order
|
30
|
+
#
|
31
|
+
# @param [Result] result
|
32
|
+
#
|
33
|
+
# @return [Result]
|
34
|
+
#
|
35
|
+
# @api public
|
29
36
|
def call(result)
|
30
37
|
STEPS_IN_ORDER.each do |name|
|
31
38
|
before_steps[name]&.each { |step| process_step(step, result) }
|
@@ -35,7 +42,7 @@ module Dry
|
|
35
42
|
result
|
36
43
|
end
|
37
44
|
|
38
|
-
#
|
45
|
+
# Returns step by name
|
39
46
|
#
|
40
47
|
# @param [Symbol] name The step name
|
41
48
|
#
|
@@ -96,6 +103,14 @@ module Dry
|
|
96
103
|
|
97
104
|
raise ArgumentError, "Undefined step name #{name}. Available names: #{STEPS_IN_ORDER}"
|
98
105
|
end
|
106
|
+
|
107
|
+
# @api private
|
108
|
+
def initialize_copy(source)
|
109
|
+
super
|
110
|
+
@steps = source.steps.dup
|
111
|
+
@before_steps = source.before_steps.dup
|
112
|
+
@after_steps = source.after_steps.dup
|
113
|
+
end
|
99
114
|
end
|
100
115
|
end
|
101
116
|
end
|
data/lib/dry/schema/version.rb
CHANGED