dry-schema 1.13.2 → 1.13.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/README.md +1 -1
- data/config/errors.yml +2 -0
- data/lib/dry/schema/extensions/json_schema/schema_compiler.rb +1 -1
- data/lib/dry/schema/extensions/struct.rb +25 -3
- data/lib/dry/schema/key_validator.rb +2 -2
- data/lib/dry/schema/version.rb +1 -1
- data/lib/dry/schema.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a740c1cb0f62a33428ff5c187c9a93ce6fdd2dc567dd904f86e07d68d94f119
|
4
|
+
data.tar.gz: b25d1dc73b7f6a2a7161a06495e4f1d5e4dfd6bafc52ad2a2088018fe9ecaf10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e914b3630c16022e6fb323a749ca66ad2dcff14ba24cff66f16b36fc102092ec9269d95e1f25dad3817eb4a44786d3a6a21d1fe7a930a75d63532a2fdcca663c
|
7
|
+
data.tar.gz: d0436db384cf03b10eed4a20717de7f06c12fdfa94426af6bae7e92c93c88efcbc851ad658f0370add6fc0ebf1bad9b636fdc7d41faf75299da3c57fa947e767
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 1.13.4 2024-05-22
|
4
|
+
|
5
|
+
|
6
|
+
### Added
|
7
|
+
|
8
|
+
- Default error message for `:uri?` (issue #476 via #477) (@timjnh)
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
- Fix json-schema type of objects nested under arrays (issue #400 fixed via #462) (@tomgi)
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
|
16
|
+
- i18n backend is no longer eager-loaded (via 85a9e0b) (@adam12)
|
17
|
+
|
18
|
+
[Compare v1.13.3...v1.13.4](https://github.com/dry-rb/dry-schema/compare/v1.13.3...v1.13.4)
|
19
|
+
|
20
|
+
## 1.13.3 2023-08-26
|
21
|
+
|
22
|
+
|
23
|
+
### Fixed
|
24
|
+
|
25
|
+
- Fix struct extension for nested struct definitions (via #466) (@flash-gordon)
|
26
|
+
|
27
|
+
|
28
|
+
[Compare v1.13.2...v1.13.3](https://github.com/dry-rb/dry-schema/compare/v1.13.2...v1.13.3)
|
29
|
+
|
3
30
|
## 1.13.2 2023-05-31
|
4
31
|
|
5
32
|
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[gem]: https://rubygems.org/gems/dry-schema
|
3
3
|
[actions]: https://github.com/dry-rb/dry-schema/actions
|
4
4
|
|
5
|
-
# dry-schema [![Gem Version](https://badge.fury.io/rb/dry-schema.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-schema/workflows/
|
5
|
+
# dry-schema [![Gem Version](https://badge.fury.io/rb/dry-schema.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-schema/workflows/CI/badge.svg)][actions]
|
6
6
|
|
7
7
|
## Links
|
8
8
|
|
data/config/errors.yml
CHANGED
@@ -90,7 +90,7 @@ module Dry
|
|
90
90
|
def visit_set(node, opts = EMPTY_HASH)
|
91
91
|
target = (key = opts[:key]) ? self.class.new(loose: loose?) : self
|
92
92
|
|
93
|
-
node.map { |child| target.visit(child, opts) }
|
93
|
+
node.map { |child| target.visit(child, opts.except(:member)) }
|
94
94
|
|
95
95
|
return unless key
|
96
96
|
|
@@ -5,20 +5,42 @@ require "dry/struct"
|
|
5
5
|
module Dry
|
6
6
|
module Schema
|
7
7
|
module Macros
|
8
|
+
class StructToSchema < ::Dry::Struct::Compiler
|
9
|
+
def call(struct)
|
10
|
+
visit(struct.to_ast)
|
11
|
+
end
|
12
|
+
|
13
|
+
# strip away structs from AST
|
14
|
+
def visit_struct(node)
|
15
|
+
_, ast = node
|
16
|
+
visit(ast)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Hash.option :struct_compiler, default: proc { StructToSchema.new(schema_dsl.config.types) }
|
21
|
+
|
8
22
|
Hash.prepend(::Module.new {
|
9
23
|
def call(*args)
|
10
|
-
if args.size >= 1 &&
|
24
|
+
if args.size >= 1 && struct?(args[0])
|
11
25
|
if block_given?
|
12
26
|
raise ArgumentError, "blocks are not supported when using "\
|
13
27
|
"a struct class (#{name.inspect} => #{args[0]})"
|
14
28
|
end
|
15
29
|
|
16
|
-
|
17
|
-
|
30
|
+
schema = struct_compiler.(args[0])
|
31
|
+
|
32
|
+
super(schema, *args.drop(1))
|
33
|
+
type(schema_dsl.types[name].constructor(schema))
|
18
34
|
else
|
19
35
|
super
|
20
36
|
end
|
21
37
|
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def struct?(type)
|
42
|
+
type.is_a?(::Class) && type <= ::Dry::Struct
|
43
|
+
end
|
22
44
|
})
|
23
45
|
end
|
24
46
|
|
data/lib/dry/schema/version.rb
CHANGED
data/lib/dry/schema.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.13.
|
4
|
+
version: 1.13.4
|
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: 2024-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
281
|
- !ruby/object:Gem::Version
|
282
282
|
version: '0'
|
283
283
|
requirements: []
|
284
|
-
rubygems_version: 3.3.
|
284
|
+
rubygems_version: 3.3.27
|
285
285
|
signing_key:
|
286
286
|
specification_version: 4
|
287
287
|
summary: Coercion and validation for data structures
|