json-schema 6.1.0 → 6.2.0
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 22afd4889333e3c72db735249ce9f628ebf760c343b98bca7dcf44b5d8aedade
|
|
4
|
+
data.tar.gz: cd6abf52a3af173231e02fec990f2ec80084c8d808ca5f98ef95601fe2c87cf7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 626dc61e7da4ecd5984463bc20a3eadd9551ca5a652cfdc60faf7869e09d0f89aa0676aee7e91135738d0fecef5dda298499d196011bfeb1494a2e9cabe3e946
|
|
7
|
+
data.tar.gz: e111b99ff25a98f785a967b91a3d277f5a0236b5a96bf49cd6c88709abaced71377de17d3f23f206c5d037201a85bd3a1b6d44c685c4e25353f3fc12143da541
|
data/README.md
CHANGED
|
@@ -478,6 +478,14 @@ Optionally, the JSON Schema library supports using the MultiJSON library for
|
|
|
478
478
|
selecting JSON backends. If the MultiJSON library is installed, it will be
|
|
479
479
|
autoloaded.
|
|
480
480
|
|
|
481
|
+
**Deprecation notice:** MultiJSON support is deprecated and will be removed in a
|
|
482
|
+
future version. To stop using MultiJSON, add the following to your application's
|
|
483
|
+
initialization code:
|
|
484
|
+
|
|
485
|
+
```ruby
|
|
486
|
+
JSON::Validator.use_multi_json = false
|
|
487
|
+
```
|
|
488
|
+
|
|
481
489
|
Notes
|
|
482
490
|
-----
|
|
483
491
|
|
|
@@ -3,7 +3,7 @@ require 'json-schema/attributes/format'
|
|
|
3
3
|
module JSON
|
|
4
4
|
class Schema
|
|
5
5
|
class DateFormat < FormatAttribute
|
|
6
|
-
REGEXP = /\A\d{4}-\d{2}-\d{2}\z
|
|
6
|
+
REGEXP = /\A\d{4}-\d{2}-\d{2}\z/.freeze
|
|
7
7
|
|
|
8
8
|
def self.validate(current_schema, data, fragments, processor, _validator, options = {})
|
|
9
9
|
if data.is_a?(String)
|
|
@@ -3,7 +3,7 @@ require 'json-schema/attributes/format'
|
|
|
3
3
|
module JSON
|
|
4
4
|
class Schema
|
|
5
5
|
class DateTimeFormat < FormatAttribute
|
|
6
|
-
REGEXP = /\A\d{4}-\d{2}-\d{2}T(\d{2}):(\d{2}):(\d{2})([.,]\d+)?(Z|[+-](\d{2})(:?\d{2})?)?\z
|
|
6
|
+
REGEXP = /\A\d{4}-\d{2}-\d{2}T(\d{2}):(\d{2}):(\d{2})([.,]\d+)?(Z|[+-](\d{2})(:?\d{2})?)?\z/.freeze
|
|
7
7
|
|
|
8
8
|
def self.validate(current_schema, data, fragments, processor, _validator, options = {})
|
|
9
9
|
# Timestamp in restricted ISO-8601 YYYY-MM-DDThh:mm:ssZ with optional decimal fraction of the second
|
|
@@ -3,7 +3,7 @@ require 'json-schema/attributes/format'
|
|
|
3
3
|
module JSON
|
|
4
4
|
class Schema
|
|
5
5
|
class TimeFormat < FormatAttribute
|
|
6
|
-
REGEXP = /\A(\d{2}):(\d{2}):(\d{2})\z
|
|
6
|
+
REGEXP = /\A(\d{2}):(\d{2}):(\d{2})\z/.freeze
|
|
7
7
|
|
|
8
8
|
def self.validate(current_schema, data, fragments, processor, _validator, options = {})
|
|
9
9
|
if data.is_a?(String)
|
|
@@ -38,6 +38,8 @@ module JSON
|
|
|
38
38
|
@@available_json_backends = []
|
|
39
39
|
@@json_backend = nil
|
|
40
40
|
@@serializer = nil
|
|
41
|
+
@@use_multi_json = defined?(MultiJson) ? true : false
|
|
42
|
+
@@multi_json_warned = false
|
|
41
43
|
@@mutex = Mutex.new
|
|
42
44
|
|
|
43
45
|
def initialize(schema_data, opts = {})
|
|
@@ -411,8 +413,20 @@ module JSON
|
|
|
411
413
|
end
|
|
412
414
|
end
|
|
413
415
|
|
|
416
|
+
def use_multi_json?
|
|
417
|
+
@@use_multi_json
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
def use_multi_json=(value)
|
|
421
|
+
@@use_multi_json = value ? true : false
|
|
422
|
+
if use_multi_json? == false
|
|
423
|
+
ensure_ruby_json_backends!
|
|
424
|
+
end
|
|
425
|
+
end
|
|
426
|
+
|
|
414
427
|
def json_backend
|
|
415
|
-
if
|
|
428
|
+
if use_multi_json?
|
|
429
|
+
multi_json_deprecation_warning!
|
|
416
430
|
MultiJson.respond_to?(:adapter) ? MultiJson.adapter : MultiJson.engine
|
|
417
431
|
else
|
|
418
432
|
@@json_backend
|
|
@@ -420,7 +434,8 @@ module JSON
|
|
|
420
434
|
end
|
|
421
435
|
|
|
422
436
|
def json_backend=(backend)
|
|
423
|
-
if
|
|
437
|
+
if use_multi_json?
|
|
438
|
+
multi_json_deprecation_warning!
|
|
424
439
|
backend = 'json_gem' if backend == 'json'
|
|
425
440
|
MultiJson.respond_to?(:use) ? MultiJson.use(backend) : MultiJson.engine = backend
|
|
426
441
|
else
|
|
@@ -434,7 +449,8 @@ module JSON
|
|
|
434
449
|
end
|
|
435
450
|
|
|
436
451
|
def parse(s)
|
|
437
|
-
if
|
|
452
|
+
if use_multi_json?
|
|
453
|
+
multi_json_deprecation_warning!
|
|
438
454
|
begin
|
|
439
455
|
MultiJson.respond_to?(:adapter) ? MultiJson.load(s) : MultiJson.decode(s)
|
|
440
456
|
rescue MultiJson::ParseError => e
|
|
@@ -481,7 +497,11 @@ module JSON
|
|
|
481
497
|
end
|
|
482
498
|
end
|
|
483
499
|
|
|
484
|
-
|
|
500
|
+
def ensure_ruby_json_backends!
|
|
501
|
+
if !@@available_json_backends.empty? || !@@serializer.nil?
|
|
502
|
+
return
|
|
503
|
+
end
|
|
504
|
+
|
|
485
505
|
if Gem::Specification.find_all_by_name('json').any?
|
|
486
506
|
require 'json'
|
|
487
507
|
@@available_json_backends << 'json'
|
|
@@ -510,6 +530,25 @@ module JSON
|
|
|
510
530
|
->(o) { YAML.dump(o) }
|
|
511
531
|
end
|
|
512
532
|
end
|
|
533
|
+
|
|
534
|
+
def multi_json_deprecation_warning!
|
|
535
|
+
unless @@multi_json_warned
|
|
536
|
+
@@multi_json_warned = true
|
|
537
|
+
warn '[DEPRECATION NOTICE] json-schema support for MultiJSON is deprecated and will be removed in a future version. ' \
|
|
538
|
+
'To stop using MultiJSON, add `JSON::Validator.use_multi_json = false` to your application\'s initialization code.'
|
|
539
|
+
end
|
|
540
|
+
end
|
|
541
|
+
|
|
542
|
+
private
|
|
543
|
+
|
|
544
|
+
# for test usage only
|
|
545
|
+
def reset_multi_json_deprecation_warning!
|
|
546
|
+
@@multi_json_warned = false
|
|
547
|
+
end
|
|
548
|
+
end
|
|
549
|
+
|
|
550
|
+
if use_multi_json? == false
|
|
551
|
+
ensure_ruby_json_backends!
|
|
513
552
|
end
|
|
514
553
|
|
|
515
554
|
private
|
|
@@ -523,7 +562,8 @@ module JSON
|
|
|
523
562
|
end
|
|
524
563
|
|
|
525
564
|
def serialize(schema)
|
|
526
|
-
if
|
|
565
|
+
if self.class.use_multi_json?
|
|
566
|
+
self.class.multi_json_deprecation_warning!
|
|
527
567
|
MultiJson.respond_to?(:dump) ? MultiJson.dump(schema) : MultiJson.encode(schema)
|
|
528
568
|
else
|
|
529
569
|
@@serializer.call(schema)
|
data/lib/json-schema.rb
CHANGED
|
@@ -14,5 +14,5 @@ require 'json-schema/schema'
|
|
|
14
14
|
require 'json-schema/schema/reader'
|
|
15
15
|
require 'json-schema/validator'
|
|
16
16
|
|
|
17
|
-
Dir[File.join(File.dirname(__FILE__), 'json-schema/attributes/**/*.rb')].each { |file| require file }
|
|
17
|
+
Dir[File.join(File.dirname(__FILE__), 'json-schema/attributes/**/*.rb')].sort.each { |file| require file }
|
|
18
18
|
Dir[File.join(File.dirname(__FILE__), 'json-schema/validators/*.rb')].sort!.each { |file| require file }
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: json-schema
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kenny Hoxworth
|
|
@@ -10,68 +10,6 @@ bindir: bin
|
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: minitest
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - ">="
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '5.0'
|
|
20
|
-
- - "<"
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: '7'
|
|
23
|
-
type: :development
|
|
24
|
-
prerelease: false
|
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
-
requirements:
|
|
27
|
-
- - ">="
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: '5.0'
|
|
30
|
-
- - "<"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '7'
|
|
33
|
-
- !ruby/object:Gem::Dependency
|
|
34
|
-
name: rake
|
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - "~>"
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '13.0'
|
|
40
|
-
type: :development
|
|
41
|
-
prerelease: false
|
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - "~>"
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '13.0'
|
|
47
|
-
- !ruby/object:Gem::Dependency
|
|
48
|
-
name: voxpupuli-rubocop
|
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - "~>"
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: 5.1.0
|
|
54
|
-
type: :development
|
|
55
|
-
prerelease: false
|
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - "~>"
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: 5.1.0
|
|
61
|
-
- !ruby/object:Gem::Dependency
|
|
62
|
-
name: webmock
|
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - "~>"
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: '3.23'
|
|
68
|
-
type: :development
|
|
69
|
-
prerelease: false
|
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - "~>"
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '3.23'
|
|
75
13
|
- !ruby/object:Gem::Dependency
|
|
76
14
|
name: addressable
|
|
77
15
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -211,14 +149,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
211
149
|
requirements:
|
|
212
150
|
- - ">="
|
|
213
151
|
- !ruby/object:Gem::Version
|
|
214
|
-
version: '
|
|
152
|
+
version: '2.7'
|
|
215
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
154
|
requirements:
|
|
217
155
|
- - ">="
|
|
218
156
|
- !ruby/object:Gem::Version
|
|
219
157
|
version: '0'
|
|
220
158
|
requirements: []
|
|
221
|
-
rubygems_version:
|
|
159
|
+
rubygems_version: 4.0.3
|
|
222
160
|
specification_version: 4
|
|
223
161
|
summary: Ruby JSON Schema Validator
|
|
224
162
|
test_files: []
|