json_schemer 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/json_schemer/format.rb +1 -1
- data/lib/json_schemer/schema/base.rb +9 -7
- data/lib/json_schemer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57b910832ad52857f782a9e0c9d17247b3d298493e2876d4d87dcc7bd72c623e
|
4
|
+
data.tar.gz: 4f36b7e698c0de3b9cac3d5fc54572dfd2288f28e0e29c7475f162cf5e878c95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb5d43a92de555b7fb72febcd305990b94ed7764bfb300a158ec3ee864e4d7c9944afa4ff4726ce30e57af0325a8bb9e295e281b4b981cc459f44ddd3e507da
|
7
|
+
data.tar.gz: f41eab50d37542486c230fcbe14a57c7dbb6564acac9815a3ff4b9977a7683a9703162d59650e34c3dc640693fa919c6b607403e575b233c77468fcc39f0703b
|
data/Gemfile.lock
CHANGED
data/lib/json_schemer/format.rb
CHANGED
@@ -66,7 +66,7 @@ module JSONSchemer
|
|
66
66
|
def valid_date_time?(data)
|
67
67
|
return false if HOUR_24_REGEX.match?(data)
|
68
68
|
datetime = DateTime.rfc3339(data)
|
69
|
-
return false if LEAP_SECOND_REGEX.match?(data) && datetime.
|
69
|
+
return false if LEAP_SECOND_REGEX.match?(data) && datetime.new_offset.strftime('%H:%M') != '23:59'
|
70
70
|
DATE_TIME_OFFSET_REGEX.match?(data)
|
71
71
|
rescue ArgumentError
|
72
72
|
false
|
@@ -330,10 +330,10 @@ module JSONSchemer
|
|
330
330
|
child(resolve_ref(ref_uri), base_uri: ref_uri)
|
331
331
|
end
|
332
332
|
|
333
|
-
ref_schema, ref_schema_pointer = ref_object.ids[ref_uri] || [ref_object.root, '']
|
333
|
+
ref_schema, ref_schema_pointer, ref_parent_base_uri = ref_object.ids[ref_uri] || [ref_object.root, '', ref_uri]
|
334
334
|
|
335
335
|
ref_uri_pointer_parts = Hana::Pointer.parse(URI.decode_www_form_component(ref_uri_pointer))
|
336
|
-
schema, base_uri = ref_uri_pointer_parts.reduce([ref_schema,
|
336
|
+
schema, base_uri = ref_uri_pointer_parts.reduce([ref_schema, ref_parent_base_uri]) do |(obj, uri), token|
|
337
337
|
if obj.is_a?(Array)
|
338
338
|
[obj.fetch(token.to_i), uri]
|
339
339
|
else
|
@@ -646,16 +646,18 @@ module JSONSchemer
|
|
646
646
|
if schema.is_a?(Array)
|
647
647
|
schema.each_with_index { |subschema, index| resolve_ids(subschema, ids, base_uri, "#{pointer}/#{index}") }
|
648
648
|
elsif schema.is_a?(Hash)
|
649
|
-
|
649
|
+
if schema.key?(id_keyword)
|
650
|
+
parent_base_uri = base_uri
|
651
|
+
base_uri = join_uri(base_uri, schema[id_keyword])
|
652
|
+
ids[base_uri] ||= [schema, pointer, parent_base_uri]
|
653
|
+
end
|
650
654
|
schema.each do |key, value|
|
651
655
|
case key
|
652
|
-
when id_keyword
|
653
|
-
ids[uri] ||= [schema, pointer]
|
654
656
|
when 'items', 'allOf', 'anyOf', 'oneOf', 'additionalItems', 'contains', 'additionalProperties', 'propertyNames', 'if', 'then', 'else', 'not'
|
655
|
-
resolve_ids(value, ids,
|
657
|
+
resolve_ids(value, ids, base_uri, "#{pointer}/#{key}")
|
656
658
|
when 'properties', 'patternProperties', 'definitions', 'dependencies'
|
657
659
|
value.each do |subkey, subvalue|
|
658
|
-
resolve_ids(subvalue, ids,
|
660
|
+
resolve_ids(subvalue, ids, base_uri, "#{pointer}/#{key}/#{subkey}")
|
659
661
|
end
|
660
662
|
end
|
661
663
|
end
|
data/lib/json_schemer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_schemer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Harsha
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|