openc-json_schema 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +5 -0
- data/lib/openc/json_schema/date_converter.rb +5 -5
- data/lib/openc/json_schema/version.rb +1 -1
- data/openc-json_schema.gemspec +2 -1
- metadata +37 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 35aa66d33975566ea5439d018d5b4463631568a8b95564b42f5ae5160632af54
|
4
|
+
data.tar.gz: 115abca9866e4495514336a1e4ae4ffe6614c517550bbdaaedf632fd01451771
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e3d4962a784834ecf8e4dfe7df46680979f3b0c050169d8baabcc39215fefea43a28138b17fffb69013c539945a769cf9205612621225015f6229b9140112f5
|
7
|
+
data.tar.gz: 2215a26c49377402c58ca418ae5bc0922f3335fe0b3793bd390703cfdfbe3ea19444760f8847466f1d4dc0e0dee4cfb77860b11c78ccdbbf9365b601d1e0cf41
|
data/README.md
CHANGED
@@ -21,4 +21,9 @@ In [morph](https://github.com/sebbacon/morph), run:
|
|
21
21
|
bundle update openc-json_schema
|
22
22
|
git commit Gemfile.lock -m 'Bump openc-json_schema' && git push
|
23
23
|
|
24
|
+
Bear in mind that a morph deploy doesn't restart the resque workers;
|
25
|
+
you'll need to do this explicitly with:
|
26
|
+
|
27
|
+
cap production resque:restart
|
28
|
+
|
24
29
|
Finally, [rebuild the Docker image](https://github.com/openc/morph-docker-ruby#readme) and deploy [morph](https://github.com/sebbacon/morph).
|
@@ -6,14 +6,14 @@ module Openc
|
|
6
6
|
def convert_dates(schema_path, record)
|
7
7
|
validator = Utils.load_validator(schema_path, record)
|
8
8
|
json_schema = Utils.extract_json_schema(validator)
|
9
|
-
_convert_dates(record,
|
9
|
+
_convert_dates(record, json_schema, json_schema.schema)
|
10
10
|
end
|
11
11
|
|
12
|
-
def _convert_dates(record,
|
12
|
+
def _convert_dates(record, json_schema, schema)
|
13
13
|
return record if schema.nil?
|
14
14
|
|
15
15
|
if (ref = schema['$ref'])
|
16
|
-
schema_uri =
|
16
|
+
schema_uri = JSON::Util::URI.absolutize_ref(ref, json_schema.uri)
|
17
17
|
json_schema = JSON::Validator.schema_reader.read(schema_uri)
|
18
18
|
schema = json_schema.schema
|
19
19
|
end
|
@@ -25,12 +25,12 @@ module Openc
|
|
25
25
|
if properties.nil?
|
26
26
|
[k, v]
|
27
27
|
else
|
28
|
-
[k, _convert_dates(v,
|
28
|
+
[k, _convert_dates(v, json_schema, properties[k])]
|
29
29
|
end
|
30
30
|
end
|
31
31
|
Hash[pairs]
|
32
32
|
when Array
|
33
|
-
record.map {|e| _convert_dates(e,
|
33
|
+
record.map {|e| _convert_dates(e, json_schema, schema['items'])}
|
34
34
|
else
|
35
35
|
if schema['format'] == 'date'
|
36
36
|
begin
|
data/openc-json_schema.gemspec
CHANGED
@@ -15,7 +15,8 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
16
|
gem.require_paths = ["lib"]
|
17
17
|
|
18
|
-
gem.add_dependency "json
|
18
|
+
gem.add_dependency "json", "<= 2.1"
|
19
|
+
gem.add_dependency "json-schema", "~> 2.8"
|
19
20
|
gem.add_dependency "json-pointer"
|
20
21
|
gem.add_dependency "openc_json_schema_formats"
|
21
22
|
gem.add_dependency "json_validation"
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openc-json_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenCorporates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "<="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "<="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: json-schema
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
33
|
+
version: '2.8'
|
20
34
|
type: :runtime
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
40
|
+
version: '2.8'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: json-pointer
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,10 +178,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
178
|
- !ruby/object:Gem::Version
|
165
179
|
version: '0'
|
166
180
|
requirements: []
|
167
|
-
|
168
|
-
rubygems_version: 2.4.5
|
181
|
+
rubygems_version: 3.0.8
|
169
182
|
signing_key:
|
170
183
|
specification_version: 4
|
171
184
|
summary: Utilities for validating JSON
|
172
|
-
test_files:
|
173
|
-
|
185
|
+
test_files:
|
186
|
+
- spec/openc_json_schema_spec.rb
|
187
|
+
- spec/schemas/aaa.json
|
188
|
+
- spec/schemas/ccc.json
|
189
|
+
- spec/schemas/fff.json
|
190
|
+
- spec/schemas/iii.json
|
191
|
+
- spec/schemas/includes/bbb.json
|
192
|
+
- spec/schemas/includes/ddd.json
|
193
|
+
- spec/schemas/includes/eee.json
|
194
|
+
- spec/schemas/includes/ggg.json
|
195
|
+
- spec/schemas/includes/hhh.json
|
196
|
+
- spec/schemas/includes/jjj.json
|
197
|
+
- spec/schemas/includes/mmm.json
|
198
|
+
- spec/schemas/includes/zzz.json
|
199
|
+
- spec/schemas/kkk.json
|
200
|
+
- spec/schemas/lll.json
|
201
|
+
- spec/schemas/yyy.json
|
202
|
+
- spec/spec_helper.rb
|