json_schemer 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -6
- data/Gemfile.lock +4 -4
- data/json_schemer.gemspec +1 -1
- data/lib/json_schemer.rb +1 -0
- data/lib/json_schemer/errors.rb +31 -0
- data/lib/json_schemer/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d07c36d5981512e6980d79a12084d309b92db45490d3ea821d02713c71fd5fc
|
4
|
+
data.tar.gz: 20dad8f563ba3ca0dcb7586641cf804aea2f727ed4def911fb105fd7bb14965f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 199c651105b1330a6946d7099d9c9c0d4f74d1922e03cf3855870660f32c81fb6f94d3748555d17cde6fb56b5b2029388099f7bf977f5585df8ec7dd5da726b5
|
7
|
+
data.tar.gz: e2acf5a285a724dc1c5c99fe35e081ab30f934554aa2f02c691926d75f3ac681594c015ef9224b7d2f70be98dd8d39404f8e4b0c3c87285f23314b523111d20e
|
data/.github/workflows/ci.yml
CHANGED
@@ -4,19 +4,14 @@ jobs:
|
|
4
4
|
ruby:
|
5
5
|
strategy:
|
6
6
|
matrix:
|
7
|
-
ruby: [2.
|
7
|
+
ruby: [2.5.x, 2.6.x, 2.7.x]
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
steps:
|
10
10
|
- uses: actions/checkout@v1
|
11
11
|
- uses: actions/setup-ruby@v1
|
12
12
|
with:
|
13
13
|
ruby-version: ${{ matrix.ruby }}
|
14
|
-
- uses: actions/setup-python@v1
|
15
|
-
with:
|
16
|
-
python-version: 3.x
|
17
14
|
- run: |
|
18
|
-
pip install --user Flask
|
19
|
-
./JSON-Schema-Test-Suite/bin/jsonschema_suite serve &
|
20
15
|
gem install bundler
|
21
16
|
bundle install
|
22
17
|
bundle exec rake test
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
json_schemer (0.2.
|
4
|
+
json_schemer (0.2.12)
|
5
5
|
ecma-re-validator (~> 0.2)
|
6
6
|
hana (~> 1.3)
|
7
7
|
regexp_parser (~> 1.5)
|
@@ -10,12 +10,12 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
ecma-re-validator (0.2.
|
13
|
+
ecma-re-validator (0.2.1)
|
14
14
|
regexp_parser (~> 1.2)
|
15
|
-
hana (1.3.
|
15
|
+
hana (1.3.6)
|
16
16
|
minitest (5.11.3)
|
17
17
|
rake (13.0.1)
|
18
|
-
regexp_parser (1.7.
|
18
|
+
regexp_parser (1.7.1)
|
19
19
|
uri_template (0.7.0)
|
20
20
|
|
21
21
|
PLATFORMS
|
data/json_schemer.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.required_ruby_version = '~> 2.
|
23
|
+
spec.required_ruby_version = '~> 2.5'
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 2.0"
|
26
26
|
spec.add_development_dependency "rake", "~> 13.0"
|
data/lib/json_schemer.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Based on code from @robacarp found in issue 48:
|
2
|
+
# https://github.com/davishmcclurg/json_schemer/issues/48
|
3
|
+
#
|
4
|
+
module JSONSchemer
|
5
|
+
module Errors
|
6
|
+
class << self
|
7
|
+
def pretty(error)
|
8
|
+
data_pointer, type, schema = error.values_at('data_pointer', 'type', 'schema')
|
9
|
+
location = data_pointer.empty? ? 'root' : "property '#{data_pointer}'"
|
10
|
+
|
11
|
+
case type
|
12
|
+
when 'required'
|
13
|
+
keys = error.fetch('details').fetch('missing_keys').join(', ')
|
14
|
+
"#{location} is missing required keys: #{keys}"
|
15
|
+
when 'null', 'string', 'boolean', 'integer', 'number', 'array', 'object'
|
16
|
+
"#{location} is not of type: #{type}"
|
17
|
+
when 'pattern'
|
18
|
+
"#{location} does not match pattern: #{schema.fetch('pattern')}"
|
19
|
+
when 'format'
|
20
|
+
"#{location} does not match format: #{schema.fetch('format')}"
|
21
|
+
when 'const'
|
22
|
+
"#{location} is not: #{schema.fetch('const').inspect}"
|
23
|
+
when 'enum'
|
24
|
+
"#{location} is not one of: #{schema.fetch('enum')}"
|
25
|
+
else
|
26
|
+
"#{location} is invalid: error_type=#{type}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
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: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Harsha
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- json_schemer.gemspec
|
128
128
|
- lib/json_schemer.rb
|
129
129
|
- lib/json_schemer/cached_ref_resolver.rb
|
130
|
+
- lib/json_schemer/errors.rb
|
130
131
|
- lib/json_schemer/format.rb
|
131
132
|
- lib/json_schemer/schema/base.rb
|
132
133
|
- lib/json_schemer/schema/draft4.rb
|
@@ -145,14 +146,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
146
|
requirements:
|
146
147
|
- - "~>"
|
147
148
|
- !ruby/object:Gem::Version
|
148
|
-
version: '2.
|
149
|
+
version: '2.5'
|
149
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
151
|
requirements:
|
151
152
|
- - ">="
|
152
153
|
- !ruby/object:Gem::Version
|
153
154
|
version: '0'
|
154
155
|
requirements: []
|
155
|
-
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 2.7.6
|
156
158
|
signing_key:
|
157
159
|
specification_version: 4
|
158
160
|
summary: JSON Schema validator. Supports drafts 4, 6, and 7.
|