dry-schema 1.14.0 → 1.14.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:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b6967bfe7737c11a9df20fc846698f42a911e454cb8c1621d20bc69d93e53dca
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0a97d750986808ca32535839e779485018d9a7eba1d6a5f09f2128e93f8bbaef
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b42eb4a52a991fdf5605d8dc69b6b7362578ef140e272a2cff4ef0fc3852e01797714dfbe2507f9aa05ef6885b738413bd8f93536e4aabb8cccbd1c8a23e7cf1
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a59cc89f18b981031fc7df87e0c3df9692512617dc0bdc35a417a5dce55196788262969ea742da0957a0616a9a0f648c78b4905abb031977570da0751002572b
         
     | 
| 
         @@ -52,15 +52,15 @@ module Dry 
     | 
|
| 
       52 
52 
     | 
    
         
             
                    # @return [Macros::Core]
         
     | 
| 
       53 
53 
     | 
    
         
             
                    #
         
     | 
| 
       54 
54 
     | 
    
         
             
                    # @api public
         
     | 
| 
       55 
     | 
    
         
            -
                    def value(*args, **opts, &)
         
     | 
| 
      
 55 
     | 
    
         
            +
                    def value(*args, **opts, &block)
         
     | 
| 
       56 
56 
     | 
    
         
             
                      if (type_spec_from_opts = opts[:type_spec])
         
     | 
| 
       57 
57 
     | 
    
         
             
                        append_macro(Macros::Value) do |macro|
         
     | 
| 
       58 
     | 
    
         
            -
                          macro.call(*args, type_spec: type_spec_from_opts, **opts, &)
         
     | 
| 
      
 58 
     | 
    
         
            +
                          macro.call(*args, type_spec: type_spec_from_opts, **opts, &block)
         
     | 
| 
       59 
59 
     | 
    
         
             
                        end
         
     | 
| 
       60 
60 
     | 
    
         
             
                      else
         
     | 
| 
       61 
61 
     | 
    
         
             
                        extract_type_spec(args) do |*predicates, type_spec:, type_rule:|
         
     | 
| 
       62 
62 
     | 
    
         
             
                          append_macro(Macros::Value) do |macro|
         
     | 
| 
       63 
     | 
    
         
            -
                            macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &)
         
     | 
| 
      
 63 
     | 
    
         
            +
                            macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &block)
         
     | 
| 
       64 
64 
     | 
    
         
             
                          end
         
     | 
| 
       65 
65 
     | 
    
         
             
                        end
         
     | 
| 
       66 
66 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -77,10 +77,10 @@ module Dry 
     | 
|
| 
       77 
77 
     | 
    
         
             
                    # @return [Macros::Core]
         
     | 
| 
       78 
78 
     | 
    
         
             
                    #
         
     | 
| 
       79 
79 
     | 
    
         
             
                    # @api public
         
     | 
| 
       80 
     | 
    
         
            -
                    def filled(*args, **opts, &)
         
     | 
| 
      
 80 
     | 
    
         
            +
                    def filled(*args, **opts, &block)
         
     | 
| 
       81 
81 
     | 
    
         
             
                      extract_type_spec(args) do |*predicates, type_spec:, type_rule:|
         
     | 
| 
       82 
82 
     | 
    
         
             
                        append_macro(Macros::Filled) do |macro|
         
     | 
| 
       83 
     | 
    
         
            -
                          macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &)
         
     | 
| 
      
 83 
     | 
    
         
            +
                          macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &block)
         
     | 
| 
       84 
84 
     | 
    
         
             
                        end
         
     | 
| 
       85 
85 
     | 
    
         
             
                      end
         
     | 
| 
       86 
86 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -95,10 +95,10 @@ module Dry 
     | 
|
| 
       95 
95 
     | 
    
         
             
                    # @return [Macros::Key]
         
     | 
| 
       96 
96 
     | 
    
         
             
                    #
         
     | 
| 
       97 
97 
     | 
    
         
             
                    # @api public
         
     | 
| 
       98 
     | 
    
         
            -
                    def maybe(*args, **opts, &)
         
     | 
| 
      
 98 
     | 
    
         
            +
                    def maybe(*args, **opts, &block)
         
     | 
| 
       99 
99 
     | 
    
         
             
                      extract_type_spec(args, nullable: true) do |*predicates, type_spec:, type_rule:|
         
     | 
| 
       100 
100 
     | 
    
         
             
                        append_macro(Macros::Maybe) do |macro|
         
     | 
| 
       101 
     | 
    
         
            -
                          macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &)
         
     | 
| 
      
 101 
     | 
    
         
            +
                          macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &block)
         
     | 
| 
       102 
102 
     | 
    
         
             
                        end
         
     | 
| 
       103 
103 
     | 
    
         
             
                      end
         
     | 
| 
       104 
104 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -8,14 +8,14 @@ module Dry 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  # @api private
         
     | 
| 
       9 
9 
     | 
    
         
             
                  class Each < DSL
         
     | 
| 
       10 
10 
     | 
    
         
             
                    # @api private
         
     | 
| 
       11 
     | 
    
         
            -
                    def value(*args, **opts, &)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    def value(*args, **opts, &block)
         
     | 
| 
       12 
12 
     | 
    
         
             
                      extract_type_spec(args, set_type: false) do |*predicates, type_spec:, type_rule:|
         
     | 
| 
       13 
13 
     | 
    
         
             
                        if type_spec && !type_spec.is_a?(Dry::Types::Type)
         
     | 
| 
       14 
14 
     | 
    
         
             
                          type(schema_dsl.array[type_spec])
         
     | 
| 
       15 
15 
     | 
    
         
             
                        end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                        append_macro(Macros::Value) do |macro|
         
     | 
| 
       18 
     | 
    
         
            -
                          macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &)
         
     | 
| 
      
 18 
     | 
    
         
            +
                          macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &block)
         
     | 
| 
       19 
19 
     | 
    
         
             
                        end
         
     | 
| 
       20 
20 
     | 
    
         
             
                      end
         
     | 
| 
       21 
21 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -8,16 +8,16 @@ module Dry 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  # @api private
         
     | 
| 
       9 
9 
     | 
    
         
             
                  class Filled < Value
         
     | 
| 
       10 
10 
     | 
    
         
             
                    # @api private
         
     | 
| 
       11 
     | 
    
         
            -
                    def call(*predicates, **opts, &)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    def call(*predicates, **opts, &block)
         
     | 
| 
       12 
12 
     | 
    
         
             
                      ensure_valid_predicates(predicates)
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                      append_macro(Macros::Value) do |macro|
         
     | 
| 
       15 
15 
     | 
    
         
             
                        if opts[:type_spec] && !filter_empty_string?
         
     | 
| 
       16 
     | 
    
         
            -
                          macro.call(predicates[0], :filled?, *predicates.drop(1), **opts, &)
         
     | 
| 
      
 16 
     | 
    
         
            +
                          macro.call(predicates[0], :filled?, *predicates.drop(1), **opts, &block)
         
     | 
| 
       17 
17 
     | 
    
         
             
                        elsif opts[:type_rule]
         
     | 
| 
       18 
     | 
    
         
            -
                          macro.call(:filled?).value(*predicates, **opts, &)
         
     | 
| 
      
 18 
     | 
    
         
            +
                          macro.call(:filled?).value(*predicates, **opts, &block)
         
     | 
| 
       19 
19 
     | 
    
         
             
                        else
         
     | 
| 
       20 
     | 
    
         
            -
                          macro.call(:filled?, *predicates, **opts, &)
         
     | 
| 
      
 20 
     | 
    
         
            +
                          macro.call(:filled?, *predicates, **opts, &block)
         
     | 
| 
       21 
21 
     | 
    
         
             
                        end
         
     | 
| 
       22 
22 
     | 
    
         
             
                      end
         
     | 
| 
       23 
23 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -8,7 +8,7 @@ module Dry 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  # @api private
         
     | 
| 
       9 
9 
     | 
    
         
             
                  class Hash < Schema
         
     | 
| 
       10 
10 
     | 
    
         
             
                    # @api private
         
     | 
| 
       11 
     | 
    
         
            -
                    def call(*args, &)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    def call(*args, &block)
         
     | 
| 
       12 
12 
     | 
    
         
             
                      if args.size >= 1 && args[0].respond_to?(:keys)
         
     | 
| 
       13 
13 
     | 
    
         
             
                        hash_type = args[0]
         
     | 
| 
       14 
14 
     | 
    
         
             
                        type_predicates = predicate_inferrer[hash_type]
         
     | 
| 
         @@ -21,7 +21,7 @@ module Dry 
     | 
|
| 
       21 
21 
     | 
    
         
             
                            else
         
     | 
| 
       22 
22 
     | 
    
         
             
                              optional(key.name).value(key.type)
         
     | 
| 
       23 
23 
     | 
    
         
             
                            end
         
     | 
| 
       24 
     | 
    
         
            -
                            instance_exec(&) if block_given?
         
     | 
| 
      
 24 
     | 
    
         
            +
                            instance_exec(&block) if block_given?
         
     | 
| 
       25 
25 
     | 
    
         
             
                          end
         
     | 
| 
       26 
26 
     | 
    
         
             
                        end
         
     | 
| 
       27 
27 
     | 
    
         
             
                      else
         
     | 
| 
         @@ -8,7 +8,7 @@ module Dry 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  # @api private
         
     | 
| 
       9 
9 
     | 
    
         
             
                  class Maybe < DSL
         
     | 
| 
       10 
10 
     | 
    
         
             
                    # @api private
         
     | 
| 
       11 
     | 
    
         
            -
                    def call(*args, **opts, &)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    def call(*args, **opts, &block)
         
     | 
| 
       12 
12 
     | 
    
         
             
                      if args.include?(:empty?)
         
     | 
| 
       13 
13 
     | 
    
         
             
                        raise ::Dry::Schema::InvalidSchemaError, "Using maybe with empty? predicate is invalid"
         
     | 
| 
       14 
14 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -18,7 +18,7 @@ module Dry 
     | 
|
| 
       18 
18 
     | 
    
         
             
                      end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                      append_macro(Macros::Value) do |macro|
         
     | 
| 
       21 
     | 
    
         
            -
                        macro.call(*args, **opts, &)
         
     | 
| 
      
 21 
     | 
    
         
            +
                        macro.call(*args, **opts, &block)
         
     | 
| 
       22 
22 
     | 
    
         
             
                      end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                      self
         
     | 
    
        data/lib/dry/schema/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: dry-schema
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.14. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.14.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Piotr Solnica
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2025- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-03-03 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: concurrent-ruby
         
     |