dry-schema 1.4.0 → 1.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bf30b15bfb1d11c70a14898fe9ac7d9cb74f46f70b5a26b1e08cf6568414160
4
- data.tar.gz: fcd0fc1691ffe1e2b2f5129710fa920daf7ec968749625e050fba3ee9a2a7f73
3
+ metadata.gz: 130427870a9d2f124a3fbd39a55f700c2c905c34a6ffab9b5e12946321f647aa
4
+ data.tar.gz: 71514ff28540db733a7d280656931c2e0f54b4f73b4a94b21e3a092234bfdfae
5
5
  SHA512:
6
- metadata.gz: 7d5a852339e072be3b033268ed826d75a319cf0c33f279e507fc80d6a3ba079370bd7e2859d3aaa5dba786e85521f9c328cf5107f941fa05f422d0bd1a8250af
7
- data.tar.gz: f1e95d4206bc7f45ccc8a5018c14f52f20db4c314509d2eedf72a67284cd574f43ee8d73ec071b7325be0512b87269043d1d488ab63c437fd767032907b0183f
6
+ metadata.gz: 42ed8a3c94600c20c2a1e843c76b2a945d9ef0b46bfa8379acf5369016899642525a9f3f6b574cc4e71b211ee690845abb0d164c07b681d19dfce474abd9ef92
7
+ data.tar.gz: c0485078b33e945a2174c3ceb349c7e46c40ada2007c8a6e6f671c8e31c57e25e4142902e0ff9638f118179169162c8225292bde042dc2e2082b4dd078bfc36f
@@ -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
- # Return step by name
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Schema
5
- VERSION = '1.4.0'
5
+ VERSION = '1.4.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica