json-schema 2.7.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +70 -12
  3. data/lib/json-schema/attribute.rb +10 -0
  4. data/lib/json-schema/attributes/allof.rb +1 -1
  5. data/lib/json-schema/attributes/anyof.rb +1 -1
  6. data/lib/json-schema/attributes/const.rb +15 -0
  7. data/lib/json-schema/attributes/dependencies.rb +0 -6
  8. data/lib/json-schema/attributes/dependencies_v4.rb +11 -0
  9. data/lib/json-schema/attributes/divisibleby.rb +1 -1
  10. data/lib/json-schema/attributes/formats/custom.rb +1 -1
  11. data/lib/json-schema/attributes/formats/date.rb +1 -1
  12. data/lib/json-schema/attributes/formats/date_time.rb +1 -1
  13. data/lib/json-schema/attributes/formats/date_time_v4.rb +1 -1
  14. data/lib/json-schema/attributes/formats/ip.rb +1 -1
  15. data/lib/json-schema/attributes/formats/time.rb +1 -1
  16. data/lib/json-schema/attributes/formats/uri.rb +1 -1
  17. data/lib/json-schema/attributes/limit.rb +0 -127
  18. data/lib/json-schema/attributes/limits/items.rb +15 -0
  19. data/lib/json-schema/attributes/limits/length.rb +15 -0
  20. data/lib/json-schema/attributes/limits/max_items.rb +15 -0
  21. data/lib/json-schema/attributes/limits/max_length.rb +15 -0
  22. data/lib/json-schema/attributes/limits/max_properties.rb +15 -0
  23. data/lib/json-schema/attributes/limits/maximum.rb +15 -0
  24. data/lib/json-schema/attributes/limits/maximum_inclusive.rb +11 -0
  25. data/lib/json-schema/attributes/limits/min_items.rb +15 -0
  26. data/lib/json-schema/attributes/limits/min_length.rb +15 -0
  27. data/lib/json-schema/attributes/limits/min_properties.rb +15 -0
  28. data/lib/json-schema/attributes/limits/minimum.rb +15 -0
  29. data/lib/json-schema/attributes/limits/minimum_inclusive.rb +11 -0
  30. data/lib/json-schema/attributes/limits/numeric.rb +16 -0
  31. data/lib/json-schema/attributes/limits/properties.rb +15 -0
  32. data/lib/json-schema/attributes/not.rb +1 -1
  33. data/lib/json-schema/attributes/oneof.rb +2 -2
  34. data/lib/json-schema/attributes/properties.rb +0 -8
  35. data/lib/json-schema/attributes/properties_v4.rb +13 -0
  36. data/lib/json-schema/attributes/ref.rb +1 -17
  37. data/lib/json-schema/attributes/type.rb +0 -10
  38. data/lib/json-schema/attributes/type_v4.rb +1 -1
  39. data/lib/json-schema/schema/reader.rb +1 -1
  40. data/lib/json-schema/schema/validator.rb +2 -1
  41. data/lib/json-schema/schema.rb +2 -2
  42. data/lib/json-schema/util/array_set.rb +4 -4
  43. data/lib/json-schema/util/uri.rb +42 -0
  44. data/lib/json-schema/util/uuid.rb +0 -1
  45. data/lib/json-schema/validator.rb +72 -88
  46. data/lib/json-schema/validators/draft6.rb +57 -0
  47. data/lib/json-schema/validators/hyper-draft3.rb +13 -0
  48. data/lib/json-schema/validators/hyper-draft6.rb +13 -0
  49. data/lib/json-schema.rb +1 -2
  50. data/resources/draft-03.json +173 -173
  51. data/resources/draft-06.json +150 -0
  52. metadata +31 -10
@@ -1,174 +1,174 @@
1
1
  {
2
- "$schema" : "http://json-schema.org/draft-03/schema#",
3
- "id" : "http://json-schema.org/draft-03/schema#",
4
- "type" : "object",
5
-
6
- "properties" : {
7
- "type" : {
8
- "type" : ["string", "array"],
9
- "items" : {
10
- "type" : ["string", {"$ref" : "#"}]
11
- },
12
- "uniqueItems" : true,
13
- "default" : "any"
14
- },
15
-
16
- "properties" : {
17
- "type" : "object",
18
- "additionalProperties" : {"$ref" : "#"},
19
- "default" : {}
20
- },
21
-
22
- "patternProperties" : {
23
- "type" : "object",
24
- "additionalProperties" : {"$ref" : "#"},
25
- "default" : {}
26
- },
27
-
28
- "additionalProperties" : {
29
- "type" : [{"$ref" : "#"}, "boolean"],
30
- "default" : {}
31
- },
32
-
33
- "items" : {
34
- "type" : [{"$ref" : "#"}, "array"],
35
- "items" : {"$ref" : "#"},
36
- "default" : {}
37
- },
38
-
39
- "additionalItems" : {
40
- "type" : [{"$ref" : "#"}, "boolean"],
41
- "default" : {}
42
- },
43
-
44
- "required" : {
45
- "type" : "boolean",
46
- "default" : false
47
- },
48
-
49
- "dependencies" : {
50
- "type" : "object",
51
- "additionalProperties" : {
52
- "type" : ["string", "array", {"$ref" : "#"}],
53
- "items" : {
54
- "type" : "string"
55
- }
56
- },
57
- "default" : {}
58
- },
59
-
60
- "minimum" : {
61
- "type" : "number"
62
- },
63
-
64
- "maximum" : {
65
- "type" : "number"
66
- },
67
-
68
- "exclusiveMinimum" : {
69
- "type" : "boolean",
70
- "default" : false
71
- },
72
-
73
- "exclusiveMaximum" : {
74
- "type" : "boolean",
75
- "default" : false
76
- },
77
-
78
- "minItems" : {
79
- "type" : "integer",
80
- "minimum" : 0,
81
- "default" : 0
82
- },
83
-
84
- "maxItems" : {
85
- "type" : "integer",
86
- "minimum" : 0
87
- },
88
-
89
- "uniqueItems" : {
90
- "type" : "boolean",
91
- "default" : false
92
- },
93
-
94
- "pattern" : {
95
- "type" : "string",
96
- "format" : "regex"
97
- },
98
-
99
- "minLength" : {
100
- "type" : "integer",
101
- "minimum" : 0,
102
- "default" : 0
103
- },
104
-
105
- "maxLength" : {
106
- "type" : "integer"
107
- },
108
-
109
- "enum" : {
110
- "type" : "array",
111
- "minItems" : 1,
112
- "uniqueItems" : true
113
- },
114
-
115
- "default" : {
116
- "type" : "any"
117
- },
118
-
119
- "title" : {
120
- "type" : "string"
121
- },
122
-
123
- "description" : {
124
- "type" : "string"
125
- },
126
-
127
- "format" : {
128
- "type" : "string"
129
- },
130
-
131
- "divisibleBy" : {
132
- "type" : "number",
133
- "minimum" : 0,
134
- "exclusiveMinimum" : true,
135
- "default" : 1
136
- },
137
-
138
- "disallow" : {
139
- "type" : ["string", "array"],
140
- "items" : {
141
- "type" : ["string", {"$ref" : "#"}]
142
- },
143
- "uniqueItems" : true
144
- },
145
-
146
- "extends" : {
147
- "type" : [{"$ref" : "#"}, "array"],
148
- "items" : {"$ref" : "#"},
149
- "default" : {}
150
- },
151
-
152
- "id" : {
153
- "type" : "string",
154
- "format" : "uri"
155
- },
156
-
157
- "$ref" : {
158
- "type" : "string",
159
- "format" : "uri"
160
- },
161
-
162
- "$schema" : {
163
- "type" : "string",
164
- "format" : "uri"
165
- }
166
- },
167
-
168
- "dependencies" : {
169
- "exclusiveMinimum" : "minimum",
170
- "exclusiveMaximum" : "maximum"
171
- },
172
-
173
- "default" : {}
174
- }
2
+ "$schema": "http://json-schema.org/draft-03/schema#",
3
+ "id": "http://json-schema.org/draft-03/schema#",
4
+ "type": "object",
5
+
6
+ "properties": {
7
+ "type": {
8
+ "type": [ "string", "array" ],
9
+ "items": {
10
+ "type": [ "string", { "$ref": "#" } ]
11
+ },
12
+ "uniqueItems": true,
13
+ "default": "any"
14
+ },
15
+
16
+ "properties": {
17
+ "type": "object",
18
+ "additionalProperties": { "$ref": "#" },
19
+ "default": {}
20
+ },
21
+
22
+ "patternProperties": {
23
+ "type": "object",
24
+ "additionalProperties": { "$ref": "#" },
25
+ "default": {}
26
+ },
27
+
28
+ "additionalProperties": {
29
+ "type": [ { "$ref": "#" }, "boolean" ],
30
+ "default": {}
31
+ },
32
+
33
+ "items": {
34
+ "type": [ { "$ref": "#" }, "array" ],
35
+ "items": { "$ref": "#" },
36
+ "default": {}
37
+ },
38
+
39
+ "additionalItems": {
40
+ "type": [ { "$ref": "#" }, "boolean" ],
41
+ "default": {}
42
+ },
43
+
44
+ "required": {
45
+ "type": "boolean",
46
+ "default": false
47
+ },
48
+
49
+ "dependencies": {
50
+ "type": "object",
51
+ "additionalProperties": {
52
+ "type": [ "string", "array", { "$ref": "#" } ],
53
+ "items": {
54
+ "type": "string"
55
+ }
56
+ },
57
+ "default": {}
58
+ },
59
+
60
+ "minimum": {
61
+ "type": "number"
62
+ },
63
+
64
+ "maximum": {
65
+ "type": "number"
66
+ },
67
+
68
+ "exclusiveMinimum": {
69
+ "type": "boolean",
70
+ "default": false
71
+ },
72
+
73
+ "exclusiveMaximum": {
74
+ "type": "boolean",
75
+ "default": false
76
+ },
77
+
78
+ "minItems": {
79
+ "type": "integer",
80
+ "minimum": 0,
81
+ "default": 0
82
+ },
83
+
84
+ "maxItems": {
85
+ "type": "integer",
86
+ "minimum": 0
87
+ },
88
+
89
+ "uniqueItems": {
90
+ "type": "boolean",
91
+ "default": false
92
+ },
93
+
94
+ "pattern": {
95
+ "type": "string",
96
+ "format": "regex"
97
+ },
98
+
99
+ "minLength": {
100
+ "type": "integer",
101
+ "minimum": 0,
102
+ "default": 0
103
+ },
104
+
105
+ "maxLength": {
106
+ "type": "integer"
107
+ },
108
+
109
+ "enum": {
110
+ "type": "array",
111
+ "minItems": 1,
112
+ "uniqueItems": true
113
+ },
114
+
115
+ "default": {
116
+ "type": "any"
117
+ },
118
+
119
+ "title": {
120
+ "type": "string"
121
+ },
122
+
123
+ "description": {
124
+ "type": "string"
125
+ },
126
+
127
+ "format": {
128
+ "type": "string"
129
+ },
130
+
131
+ "divisibleBy": {
132
+ "type": "number",
133
+ "minimum": 0,
134
+ "exclusiveMinimum": true,
135
+ "default": 1
136
+ },
137
+
138
+ "disallow": {
139
+ "type": [ "string", "array" ],
140
+ "items": {
141
+ "type": [ "string", { "$ref": "#" } ]
142
+ },
143
+ "uniqueItems": true
144
+ },
145
+
146
+ "extends": {
147
+ "type": [ { "$ref": "#" }, "array" ],
148
+ "items": { "$ref": "#" },
149
+ "default": {}
150
+ },
151
+
152
+ "id": {
153
+ "type": "string",
154
+ "format": "uri"
155
+ },
156
+
157
+ "$ref": {
158
+ "type": "string",
159
+ "format": "uri"
160
+ },
161
+
162
+ "$schema": {
163
+ "type": "string",
164
+ "format": "uri"
165
+ }
166
+ },
167
+
168
+ "dependencies": {
169
+ "exclusiveMinimum": "minimum",
170
+ "exclusiveMaximum": "maximum"
171
+ },
172
+
173
+ "default": {}
174
+ }
@@ -0,0 +1,150 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft/schema#",
3
+ "$id": "http://json-schema.org/draft/schema#",
4
+ "title": "Core schema meta-schema",
5
+ "definitions": {
6
+ "schemaArray": {
7
+ "type": "array",
8
+ "minItems": 1,
9
+ "items": { "$ref": "#" }
10
+ },
11
+ "positiveInteger": {
12
+ "type": "integer",
13
+ "minimum": 0
14
+ },
15
+ "positiveIntegerDefault0": {
16
+ "allOf": [
17
+ { "$ref": "#/definitions/positiveInteger" },
18
+ { "default": 0 }
19
+ ]
20
+ },
21
+ "simpleTypes": {
22
+ "enum": [
23
+ "array",
24
+ "boolean",
25
+ "integer",
26
+ "null",
27
+ "number",
28
+ "object",
29
+ "string"
30
+ ]
31
+ },
32
+ "stringArray": {
33
+ "type": "array",
34
+ "items": { "type": "string" },
35
+ "uniqueItems": true,
36
+ "defaultItems": []
37
+ }
38
+ },
39
+ "type": ["object", "boolean"],
40
+ "properties": {
41
+ "$id": {
42
+ "type": "string",
43
+ "format": "uri-reference"
44
+ },
45
+ "$schema": {
46
+ "type": "string",
47
+ "format": "uri"
48
+ },
49
+ "$ref": {
50
+ "type": "string",
51
+ "format": "uri-reference"
52
+ },
53
+ "title": {
54
+ "type": "string"
55
+ },
56
+ "description": {
57
+ "type": "string"
58
+ },
59
+ "default": {},
60
+ "multipleOf": {
61
+ "type": "number",
62
+ "exclusiveMinimum": 0
63
+ },
64
+ "maximum": {
65
+ "type": "number"
66
+ },
67
+ "exclusiveMaximum": {
68
+ "type": "number"
69
+ },
70
+ "minimum": {
71
+ "type": "number"
72
+ },
73
+ "exclusiveMinimum": {
74
+ "type": "number"
75
+ },
76
+ "maxLength": { "$ref": "#/definitions/positiveInteger" },
77
+ "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
78
+ "pattern": {
79
+ "type": "string",
80
+ "format": "regex"
81
+ },
82
+ "additionalItems": { "$ref": "#" },
83
+ "items": {
84
+ "anyOf": [
85
+ { "$ref": "#" },
86
+ { "$ref": "#/definitions/schemaArray" }
87
+ ],
88
+ "default": {}
89
+ },
90
+ "maxItems": { "$ref": "#/definitions/positiveInteger" },
91
+ "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
92
+ "uniqueItems": {
93
+ "type": "boolean",
94
+ "default": false
95
+ },
96
+ "contains": { "$ref": "#" },
97
+ "maxProperties": { "$ref": "#/definitions/positiveInteger" },
98
+ "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
99
+ "required": { "$ref": "#/definitions/stringArray" },
100
+ "additionalProperties": { "$ref": "#" },
101
+ "definitions": {
102
+ "type": "object",
103
+ "additionalProperties": { "$ref": "#" },
104
+ "default": {}
105
+ },
106
+ "properties": {
107
+ "type": "object",
108
+ "additionalProperties": { "$ref": "#" },
109
+ "default": {}
110
+ },
111
+ "patternProperties": {
112
+ "type": "object",
113
+ "additionalProperties": { "$ref": "#" },
114
+ "default": {}
115
+ },
116
+ "dependencies": {
117
+ "type": "object",
118
+ "additionalProperties": {
119
+ "anyOf": [
120
+ { "$ref": "#" },
121
+ { "$ref": "#/definitions/stringArray" }
122
+ ]
123
+ }
124
+ },
125
+ "propertyNames": { "$ref": "#" },
126
+ "const": {},
127
+ "enum": {
128
+ "type": "array",
129
+ "minItems": 1,
130
+ "uniqueItems": true
131
+ },
132
+ "type": {
133
+ "anyOf": [
134
+ { "$ref": "#/definitions/simpleTypes" },
135
+ {
136
+ "type": "array",
137
+ "items": { "$ref": "#/definitions/simpleTypes" },
138
+ "minItems": 1,
139
+ "uniqueItems": true
140
+ }
141
+ ]
142
+ },
143
+ "format": { "type": "string" },
144
+ "allOf": { "$ref": "#/definitions/schemaArray" },
145
+ "anyOf": { "$ref": "#/definitions/schemaArray" },
146
+ "oneOf": { "$ref": "#/definitions/schemaArray" },
147
+ "not": { "$ref": "#" }
148
+ },
149
+ "default": {}
150
+ }
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenny Hoxworth
8
+ - Vox Pupuli
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-09-29 00:00:00.000000000 Z
12
+ date: 2022-05-03 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
@@ -72,16 +73,16 @@ dependencies:
72
73
  requirements:
73
74
  - - ">="
74
75
  - !ruby/object:Gem::Version
75
- version: '2.4'
76
+ version: '2.8'
76
77
  type: :runtime
77
78
  prerelease: false
78
79
  version_requirements: !ruby/object:Gem::Requirement
79
80
  requirements:
80
81
  - - ">="
81
82
  - !ruby/object:Gem::Version
82
- version: '2.4'
83
+ version: '2.8'
83
84
  description:
84
- email: hoxworth@gmail.com
85
+ email: voxpupuli@groups.io
85
86
  executables: []
86
87
  extensions: []
87
88
  extra_rdoc_files:
@@ -96,7 +97,9 @@ files:
96
97
  - lib/json-schema/attributes/additionalproperties.rb
97
98
  - lib/json-schema/attributes/allof.rb
98
99
  - lib/json-schema/attributes/anyof.rb
100
+ - lib/json-schema/attributes/const.rb
99
101
  - lib/json-schema/attributes/dependencies.rb
102
+ - lib/json-schema/attributes/dependencies_v4.rb
100
103
  - lib/json-schema/attributes/disallow.rb
101
104
  - lib/json-schema/attributes/divisibleby.rb
102
105
  - lib/json-schema/attributes/enum.rb
@@ -111,6 +114,20 @@ files:
111
114
  - lib/json-schema/attributes/formats/uri.rb
112
115
  - lib/json-schema/attributes/items.rb
113
116
  - lib/json-schema/attributes/limit.rb
117
+ - lib/json-schema/attributes/limits/items.rb
118
+ - lib/json-schema/attributes/limits/length.rb
119
+ - lib/json-schema/attributes/limits/max_items.rb
120
+ - lib/json-schema/attributes/limits/max_length.rb
121
+ - lib/json-schema/attributes/limits/max_properties.rb
122
+ - lib/json-schema/attributes/limits/maximum.rb
123
+ - lib/json-schema/attributes/limits/maximum_inclusive.rb
124
+ - lib/json-schema/attributes/limits/min_items.rb
125
+ - lib/json-schema/attributes/limits/min_length.rb
126
+ - lib/json-schema/attributes/limits/min_properties.rb
127
+ - lib/json-schema/attributes/limits/minimum.rb
128
+ - lib/json-schema/attributes/limits/minimum_inclusive.rb
129
+ - lib/json-schema/attributes/limits/numeric.rb
130
+ - lib/json-schema/attributes/limits/properties.rb
114
131
  - lib/json-schema/attributes/maxdecimal.rb
115
132
  - lib/json-schema/attributes/multipleof.rb
116
133
  - lib/json-schema/attributes/not.rb
@@ -119,6 +136,7 @@ files:
119
136
  - lib/json-schema/attributes/patternproperties.rb
120
137
  - lib/json-schema/attributes/properties.rb
121
138
  - lib/json-schema/attributes/properties_optional.rb
139
+ - lib/json-schema/attributes/properties_v4.rb
122
140
  - lib/json-schema/attributes/ref.rb
123
141
  - lib/json-schema/attributes/required.rb
124
142
  - lib/json-schema/attributes/type.rb
@@ -142,14 +160,18 @@ files:
142
160
  - lib/json-schema/validators/draft2.rb
143
161
  - lib/json-schema/validators/draft3.rb
144
162
  - lib/json-schema/validators/draft4.rb
163
+ - lib/json-schema/validators/draft6.rb
145
164
  - lib/json-schema/validators/hyper-draft1.rb
146
165
  - lib/json-schema/validators/hyper-draft2.rb
166
+ - lib/json-schema/validators/hyper-draft3.rb
147
167
  - lib/json-schema/validators/hyper-draft4.rb
168
+ - lib/json-schema/validators/hyper-draft6.rb
148
169
  - resources/draft-01.json
149
170
  - resources/draft-02.json
150
171
  - resources/draft-03.json
151
172
  - resources/draft-04.json
152
- homepage: http://github.com/ruby-json-schema/json-schema/tree/master
173
+ - resources/draft-06.json
174
+ homepage: http://github.com/voxpupuli/json-schema/
153
175
  licenses:
154
176
  - MIT
155
177
  metadata: {}
@@ -161,15 +183,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
183
  requirements:
162
184
  - - ">="
163
185
  - !ruby/object:Gem::Version
164
- version: '1.9'
186
+ version: '2.5'
165
187
  required_rubygems_version: !ruby/object:Gem::Requirement
166
188
  requirements:
167
189
  - - ">="
168
190
  - !ruby/object:Gem::Version
169
- version: '1.8'
191
+ version: '2.5'
170
192
  requirements: []
171
- rubyforge_project:
172
- rubygems_version: 2.5.1
193
+ rubygems_version: 3.3.7
173
194
  signing_key:
174
195
  specification_version: 4
175
196
  summary: Ruby JSON Schema Validator