verse-schema 1.2.1 → 1.2.3
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/verse/schema/json.rb +9 -1
- data/lib/verse/schema/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e08ebd7945a9c111a48a90b3a101ec698fad6b9ba9933adf42bf3674e1695a0b
|
|
4
|
+
data.tar.gz: 8d14256bf475aec67e1ff754932c0010b2fce9dbcbd806ab18828e3ccf302a13
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 31fd016c7b6a4a69a1baeca8fe92793ab65b4f253769e9df9bf19a37f11c6380b118518710d07ea93ba99d6c3d681c7669e399109da557197aaa770a1959942e
|
|
7
|
+
data.tar.gz: 3b6a1d075850f0baed39056769dd3c787a07a0cc27f4e373f2841f48de071ee4b10c9dcea981f05c29d3f8d43279c0a92532cd7086315e8d798419227e470141
|
data/Gemfile.lock
CHANGED
data/lib/verse/schema/json.rb
CHANGED
|
@@ -141,6 +141,8 @@ module Verse
|
|
|
141
141
|
{ type: "string", format: "date-time" }
|
|
142
142
|
when NilClass.singleton_class, nil
|
|
143
143
|
{ type: "null" }
|
|
144
|
+
when Array.singleton_class, Set.singleton_class
|
|
145
|
+
{ type: "array" }
|
|
144
146
|
when Array
|
|
145
147
|
case schema.length
|
|
146
148
|
when 0
|
|
@@ -151,7 +153,13 @@ module Verse
|
|
|
151
153
|
{ anyOf: schema.map { |v| _from_schema(v, registry:, definitions:) } }
|
|
152
154
|
end
|
|
153
155
|
else
|
|
154
|
-
|
|
156
|
+
if schema == Object
|
|
157
|
+
{} # any type
|
|
158
|
+
elsif schema.respond_to?(:to_json_schema)
|
|
159
|
+
schema.to_json_schema # custom schema conversion
|
|
160
|
+
else
|
|
161
|
+
raise "Unknown type #{schema.inspect}"
|
|
162
|
+
end
|
|
155
163
|
end
|
|
156
164
|
end
|
|
157
165
|
# rubocop:enable Metrics/MethodLength, Metrics/CyclomaticComplexity, Lint/HashCompareByIdentity
|
data/lib/verse/schema/version.rb
CHANGED