json_schemer 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -4
- data/Gemfile.lock +3 -3
- data/json_schemer.gemspec +2 -2
- data/lib/json_schemer/format.rb +7 -7
- data/lib/json_schemer/schema/base.rb +2 -8
- data/lib/json_schemer/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd79033e749c1e3077636935feed34452d51b528b89acef5e35d07871f6ab9c0
|
4
|
+
data.tar.gz: 355a3bb6aae3ea6c29047c69d0f64d3481bfa265453b6a495788d4a963715abd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fce9c0f1ceb00466f7da2a1692fb1fb78382c5d82f8bc6995bb81af0c6a1f362e5602b2574fbe4429e661b29c89f6af16cf8871cba8893f5439c1a5079126887
|
7
|
+
data.tar.gz: fdc5f5968f05fa551939c22c0dfe66226e2cec18bcdc53aa567287b89b1fc00f8599d8cb5a3e8a19c2822ebe6601aea47a0a9b97a82529f3a1fb3e0c601c9673
|
data/.travis.yml
CHANGED
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.5)
|
5
5
|
ecma-re-validator (~> 0.2)
|
6
6
|
hana (~> 1.3)
|
7
7
|
regexp_parser (~> 1.5)
|
@@ -22,10 +22,10 @@ PLATFORMS
|
|
22
22
|
ruby
|
23
23
|
|
24
24
|
DEPENDENCIES
|
25
|
-
bundler (~>
|
25
|
+
bundler (~> 2.0)
|
26
26
|
json_schemer!
|
27
27
|
minitest (~> 5.0)
|
28
28
|
rake (~> 10.0)
|
29
29
|
|
30
30
|
BUNDLED WITH
|
31
|
-
|
31
|
+
2.0.2
|
data/json_schemer.gemspec
CHANGED
@@ -20,9 +20,9 @@ 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.4'
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler", "~>
|
25
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
27
|
spec.add_development_dependency "minitest", "~> 5.0"
|
28
28
|
|
data/lib/json_schemer/format.rb
CHANGED
@@ -108,18 +108,18 @@ module JSONSchemer
|
|
108
108
|
|
109
109
|
def valid_date_time?(data)
|
110
110
|
DateTime.rfc3339(data)
|
111
|
-
|
111
|
+
DATE_TIME_OFFSET_REGEX.match?(data)
|
112
112
|
rescue ArgumentError => e
|
113
113
|
raise e unless e.message == 'invalid date'
|
114
114
|
false
|
115
115
|
end
|
116
116
|
|
117
117
|
def valid_email?(data)
|
118
|
-
|
118
|
+
EMAIL_REGEX.match?(data)
|
119
119
|
end
|
120
120
|
|
121
121
|
def valid_hostname?(data)
|
122
|
-
|
122
|
+
HOSTNAME_REGEX.match?(data) && data.split('.').all? { |label| label.size <= 63 }
|
123
123
|
end
|
124
124
|
|
125
125
|
def valid_ip?(data, type)
|
@@ -130,11 +130,11 @@ module JSONSchemer
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def valid_iri?(data)
|
133
|
-
|
133
|
+
IRI.match?(data)
|
134
134
|
end
|
135
135
|
|
136
136
|
def valid_iri_reference?(data)
|
137
|
-
|
137
|
+
IRELATIVE_REF.match?(data)
|
138
138
|
end
|
139
139
|
|
140
140
|
def valid_uri_template?(data)
|
@@ -145,11 +145,11 @@ module JSONSchemer
|
|
145
145
|
end
|
146
146
|
|
147
147
|
def valid_json_pointer?(data)
|
148
|
-
|
148
|
+
JSON_POINTER_REGEX.match?(data)
|
149
149
|
end
|
150
150
|
|
151
151
|
def valid_relative_json_pointer?(data)
|
152
|
-
|
152
|
+
RELATIVE_JSON_POINTER_REGEX.match?(data)
|
153
153
|
end
|
154
154
|
end
|
155
155
|
end
|
@@ -470,13 +470,7 @@ module JSONSchemer
|
|
470
470
|
if insert_property_defaults?
|
471
471
|
properties.each do |property, property_schema|
|
472
472
|
if !data.key?(property) && property_schema.key?('default')
|
473
|
-
|
474
|
-
data[property] = case default
|
475
|
-
when Numeric, Symbol, true, false, nil
|
476
|
-
default
|
477
|
-
else
|
478
|
-
default.clone
|
479
|
-
end
|
473
|
+
data[property] = property_schema.fetch('default').clone
|
480
474
|
end
|
481
475
|
end
|
482
476
|
end
|
@@ -526,7 +520,7 @@ module JSONSchemer
|
|
526
520
|
[pattern, ecma_262_regex(pattern), property_schema]
|
527
521
|
end
|
528
522
|
regex_pattern_properties.each do |pattern, regex, property_schema|
|
529
|
-
if regex
|
523
|
+
if regex.match?(key)
|
530
524
|
subinstance = instance.merge(
|
531
525
|
data: value,
|
532
526
|
data_pointer: "#{instance.data_pointer}/#{key}",
|
data/lib/json_schemer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Harsha
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
146
|
requirements:
|
147
147
|
- - "~>"
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: '2.
|
149
|
+
version: '2.4'
|
150
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
152
|
- - ">="
|