json-schema_builder 0.6.0 → 0.6.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b2db2f9c08d0d7f20bc942b2b8f80692dcb6606
|
4
|
+
data.tar.gz: 4aaa1d7fc0179c8c8f8d8dc5b3e20165f27b919b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3989f1a40c2f42e11540011f74f6edbfa23595868dea68b985c90f349178607f6ebe1f1a1526e156cf5c8a3de3aa000a7858a67793b434cb1b4518e251bf484a
|
7
|
+
data.tar.gz: 4ab4fe02482693de7c9628e29f80258c315ddc37a886ac70489dc2e8dfe355c9bec275286b02c015a2fc8d6a49cd6e3aed20be903288f1ae5112168058cc3912
|
@@ -18,6 +18,7 @@ module JSON
|
|
18
18
|
opts = args.extract_options!
|
19
19
|
name = args.shift
|
20
20
|
nullable = opts.delete :null
|
21
|
+
any_ofs = opts.delete :any_of
|
21
22
|
|
22
23
|
entity name do
|
23
24
|
list = [
|
@@ -29,7 +30,8 @@ module JSON
|
|
29
30
|
}
|
30
31
|
]
|
31
32
|
|
32
|
-
list
|
33
|
+
list |= any_ofs if any_ofs
|
34
|
+
list |= [null] if nullable && list.none? { |item| item.is_a?(Null) }
|
33
35
|
any_of list
|
34
36
|
end
|
35
37
|
end
|
@@ -26,6 +26,35 @@ RSpec.describe Examples::MixedAnyOfs, type: :integration do
|
|
26
26
|
{ type: "null" }
|
27
27
|
]
|
28
28
|
},
|
29
|
+
mixed_type: {
|
30
|
+
anyOf: [
|
31
|
+
{
|
32
|
+
type: "object",
|
33
|
+
properties: {
|
34
|
+
property: {
|
35
|
+
type: "string"
|
36
|
+
}
|
37
|
+
}
|
38
|
+
},
|
39
|
+
{
|
40
|
+
type: "array",
|
41
|
+
items: {
|
42
|
+
type: "object",
|
43
|
+
properties: {
|
44
|
+
property: {
|
45
|
+
type: "string"
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
},
|
50
|
+
{
|
51
|
+
type: "string",
|
52
|
+
},
|
53
|
+
{
|
54
|
+
type: "null"
|
55
|
+
}
|
56
|
+
]
|
57
|
+
},
|
29
58
|
flexible: {
|
30
59
|
anyOf: [
|
31
60
|
{ type: "string", minLength: 100 },
|
@@ -10,6 +10,10 @@ module Examples
|
|
10
10
|
string :test
|
11
11
|
end
|
12
12
|
|
13
|
+
object_or_array :mixed_type, any_of: [string, null], null: true do
|
14
|
+
string :property
|
15
|
+
end
|
16
|
+
|
13
17
|
entity :flexible, any_of: [string(min_length: 100), empty_string, integer], null: true do
|
14
18
|
any_of [
|
15
19
|
an_object(self),
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-schema_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Parrish
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01
|
11
|
+
date: 2018-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|