dry-schema 1.7.0 → 1.9.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 +43 -0
- data/README.md +2 -2
- data/dry-schema.gemspec +2 -2
- data/lib/dry/schema/compiler.rb +1 -1
- data/lib/dry/schema/config.rb +9 -9
- data/lib/dry/schema/dsl.rb +7 -4
- data/lib/dry/schema/extensions/hints/message_compiler_methods.rb +9 -4
- data/lib/dry/schema/extensions/hints.rb +11 -9
- data/lib/dry/schema/extensions/info/schema_compiler.rb +10 -1
- data/lib/dry/schema/extensions/json_schema/schema_compiler.rb +232 -0
- data/lib/dry/schema/extensions/json_schema.rb +29 -0
- data/lib/dry/schema/extensions/struct.rb +1 -1
- data/lib/dry/schema/extensions.rb +4 -0
- data/lib/dry/schema/key.rb +75 -74
- data/lib/dry/schema/key_coercer.rb +2 -2
- data/lib/dry/schema/key_validator.rb +44 -23
- data/lib/dry/schema/macros/array.rb +4 -0
- data/lib/dry/schema/macros/core.rb +1 -1
- data/lib/dry/schema/macros/dsl.rb +17 -15
- data/lib/dry/schema/macros/hash.rb +1 -1
- data/lib/dry/schema/macros/key.rb +2 -2
- data/lib/dry/schema/macros/schema.rb +2 -0
- data/lib/dry/schema/macros/value.rb +7 -0
- data/lib/dry/schema/message/or/multi_path.rb +7 -5
- data/lib/dry/schema/message_compiler.rb +13 -10
- data/lib/dry/schema/messages/abstract.rb +9 -9
- data/lib/dry/schema/messages/i18n.rb +98 -96
- data/lib/dry/schema/messages/namespaced.rb +6 -0
- data/lib/dry/schema/messages/yaml.rb +165 -158
- data/lib/dry/schema/predicate.rb +2 -2
- data/lib/dry/schema/predicate_inferrer.rb +2 -0
- data/lib/dry/schema/primitive_inferrer.rb +2 -0
- data/lib/dry/schema/processor.rb +4 -4
- data/lib/dry/schema/result.rb +5 -7
- data/lib/dry/schema/trace.rb +5 -1
- data/lib/dry/schema/type_registry.rb +1 -2
- data/lib/dry/schema/version.rb +1 -1
- metadata +9 -7
data/lib/dry/schema/result.rb
CHANGED
@@ -185,13 +185,11 @@ module Dry
|
|
185
185
|
"#<#{self.class}#{to_h.inspect} errors=#{errors.to_h.inspect} path=#{path.keys.inspect}>"
|
186
186
|
end
|
187
187
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
output
|
194
|
-
end
|
188
|
+
# Pattern matching support
|
189
|
+
#
|
190
|
+
# @api private
|
191
|
+
def deconstruct_keys(_)
|
192
|
+
output
|
195
193
|
end
|
196
194
|
|
197
195
|
# Add a new error AST node
|
data/lib/dry/schema/trace.rb
CHANGED
@@ -89,6 +89,10 @@ module Dry
|
|
89
89
|
captures.map(&:to_ast).map(&compiler.method(:visit)).reduce(:and)
|
90
90
|
end
|
91
91
|
|
92
|
+
def respond_to_missing?(meth, include_private = false)
|
93
|
+
super || (meth.to_s.end_with?(QUESTION_MARK) && compuiler.support?(meth))
|
94
|
+
end
|
95
|
+
|
92
96
|
# @api private
|
93
97
|
def method_missing(meth, *args, &block)
|
94
98
|
if meth.to_s.end_with?(QUESTION_MARK)
|
@@ -96,7 +100,7 @@ module Dry
|
|
96
100
|
::Kernel.raise InvalidSchemaError, "#{meth} predicate cannot be used in this context"
|
97
101
|
end
|
98
102
|
|
99
|
-
unless compiler.
|
103
|
+
unless compiler.support?(meth)
|
100
104
|
::Kernel.raise ::ArgumentError, "#{meth} predicate is not defined"
|
101
105
|
end
|
102
106
|
|
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.
|
4
|
+
version: 1.9.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:
|
11
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -30,20 +30,20 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.13'
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 0.
|
36
|
+
version: 0.13.0
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0.
|
43
|
+
version: '0.13'
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
46
|
+
version: 0.13.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: dry-core
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +178,8 @@ files:
|
|
178
178
|
- lib/dry/schema/extensions/hints/result_methods.rb
|
179
179
|
- lib/dry/schema/extensions/info.rb
|
180
180
|
- lib/dry/schema/extensions/info/schema_compiler.rb
|
181
|
+
- lib/dry/schema/extensions/json_schema.rb
|
182
|
+
- lib/dry/schema/extensions/json_schema/schema_compiler.rb
|
181
183
|
- lib/dry/schema/extensions/monads.rb
|
182
184
|
- lib/dry/schema/extensions/struct.rb
|
183
185
|
- lib/dry/schema/json.rb
|
@@ -246,7 +248,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
246
248
|
requirements:
|
247
249
|
- - ">="
|
248
250
|
- !ruby/object:Gem::Version
|
249
|
-
version: 2.
|
251
|
+
version: 2.7.0
|
250
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
253
|
requirements:
|
252
254
|
- - ">="
|