jsi 0.4.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/CHANGELOG.md +33 -0
- data/LICENSE.md +1 -1
- data/README.md +114 -42
- data/jsi.gemspec +14 -12
- data/lib/jsi/base/node.rb +183 -0
- data/lib/jsi/base.rb +388 -220
- data/lib/jsi/jsi_coder.rb +8 -7
- data/lib/jsi/metaschema.rb +0 -1
- data/lib/jsi/metaschema_node/bootstrap_schema.rb +101 -0
- data/lib/jsi/metaschema_node.rb +159 -135
- data/lib/jsi/ptr.rb +303 -0
- data/lib/jsi/schema/application/child_application/contains.rb +25 -0
- data/lib/jsi/schema/application/child_application/draft04.rb +22 -0
- data/lib/jsi/schema/application/child_application/draft06.rb +29 -0
- data/lib/jsi/schema/application/child_application/draft07.rb +29 -0
- data/lib/jsi/schema/application/child_application/items.rb +18 -0
- data/lib/jsi/schema/application/child_application/properties.rb +25 -0
- data/lib/jsi/schema/application/child_application.rb +38 -0
- data/lib/jsi/schema/application/draft04.rb +8 -0
- data/lib/jsi/schema/application/draft06.rb +8 -0
- data/lib/jsi/schema/application/draft07.rb +8 -0
- data/lib/jsi/schema/application/inplace_application/dependencies.rb +28 -0
- data/lib/jsi/schema/application/inplace_application/draft04.rb +26 -0
- data/lib/jsi/schema/application/inplace_application/draft06.rb +27 -0
- data/lib/jsi/schema/application/inplace_application/draft07.rb +33 -0
- data/lib/jsi/schema/application/inplace_application/ifthenelse.rb +20 -0
- data/lib/jsi/schema/application/inplace_application/ref.rb +18 -0
- data/lib/jsi/schema/application/inplace_application/someof.rb +44 -0
- data/lib/jsi/schema/application/inplace_application.rb +41 -0
- data/lib/jsi/schema/application.rb +12 -0
- data/lib/jsi/schema/draft04.rb +14 -0
- data/lib/jsi/schema/draft06.rb +14 -0
- data/lib/jsi/schema/draft07.rb +14 -0
- data/lib/jsi/schema/issue.rb +36 -0
- data/lib/jsi/schema/ref.rb +160 -0
- data/lib/jsi/schema/schema_ancestor_node.rb +113 -0
- data/lib/jsi/schema/validation/array.rb +69 -0
- data/lib/jsi/schema/validation/const.rb +20 -0
- data/lib/jsi/schema/validation/contains.rb +25 -0
- data/lib/jsi/schema/validation/core.rb +39 -0
- data/lib/jsi/schema/validation/dependencies.rb +49 -0
- data/lib/jsi/schema/validation/draft04/minmax.rb +91 -0
- data/lib/jsi/schema/validation/draft04.rb +112 -0
- data/lib/jsi/schema/validation/draft06.rb +122 -0
- data/lib/jsi/schema/validation/draft07.rb +159 -0
- data/lib/jsi/schema/validation/enum.rb +25 -0
- data/lib/jsi/schema/validation/ifthenelse.rb +46 -0
- data/lib/jsi/schema/validation/items.rb +54 -0
- data/lib/jsi/schema/validation/not.rb +20 -0
- data/lib/jsi/schema/validation/numeric.rb +121 -0
- data/lib/jsi/schema/validation/object.rb +45 -0
- data/lib/jsi/schema/validation/pattern.rb +34 -0
- data/lib/jsi/schema/validation/properties.rb +101 -0
- data/lib/jsi/schema/validation/property_names.rb +32 -0
- data/lib/jsi/schema/validation/ref.rb +40 -0
- data/lib/jsi/schema/validation/required.rb +27 -0
- data/lib/jsi/schema/validation/someof.rb +90 -0
- data/lib/jsi/schema/validation/string.rb +47 -0
- data/lib/jsi/schema/validation/type.rb +49 -0
- data/lib/jsi/schema/validation.rb +51 -0
- data/lib/jsi/schema.rb +508 -149
- data/lib/jsi/schema_classes.rb +199 -59
- data/lib/jsi/schema_registry.rb +151 -0
- data/lib/jsi/schema_set.rb +181 -0
- data/lib/jsi/simple_wrap.rb +23 -4
- data/lib/jsi/util/private/attr_struct.rb +127 -0
- data/lib/jsi/util/private.rb +204 -0
- data/lib/jsi/util/typelike.rb +229 -0
- data/lib/jsi/util.rb +89 -53
- data/lib/jsi/validation/error.rb +34 -0
- data/lib/jsi/validation/result.rb +210 -0
- data/lib/jsi/validation.rb +15 -0
- data/lib/jsi/version.rb +3 -1
- data/lib/jsi.rb +44 -14
- data/lib/schemas/json-schema.org/draft-04/schema.rb +10 -3
- data/lib/schemas/json-schema.org/draft-06/schema.rb +10 -3
- data/lib/schemas/json-schema.org/draft-07/schema.rb +14 -0
- data/readme.rb +138 -0
- data/{resources}/schemas/json-schema.org/draft-04/schema.json +149 -0
- data/{resources}/schemas/json-schema.org/draft-06/schema.json +154 -0
- data/{resources}/schemas/json-schema.org/draft-07/schema.json +168 -0
- metadata +75 -122
- data/.simplecov +0 -3
- data/Rakefile.rb +0 -9
- data/lib/jsi/base/to_rb.rb +0 -128
- data/lib/jsi/json/node.rb +0 -203
- data/lib/jsi/json/pointer.rb +0 -419
- data/lib/jsi/json-schema-fragments.rb +0 -61
- data/lib/jsi/json.rb +0 -10
- data/lib/jsi/pathed_node.rb +0 -118
- data/lib/jsi/typelike_modules.rb +0 -240
- data/resources/icons/AGPL-3.0.png +0 -0
- data/test/base_array_test.rb +0 -323
- data/test/base_hash_test.rb +0 -337
- data/test/base_test.rb +0 -486
- data/test/jsi_coder_test.rb +0 -85
- data/test/jsi_json_arraynode_test.rb +0 -150
- data/test/jsi_json_hashnode_test.rb +0 -132
- data/test/jsi_json_node_test.rb +0 -257
- data/test/jsi_json_pointer_test.rb +0 -102
- data/test/jsi_test.rb +0 -11
- data/test/jsi_typelike_as_json_test.rb +0 -53
- data/test/metaschema_node_test.rb +0 -19
- data/test/schema_module_test.rb +0 -21
- data/test/schema_test.rb +0 -208
- data/test/spreedly_openapi_test.rb +0 -8
- data/test/test_helper.rb +0 -97
- data/test/util_test.rb +0 -62
data/readme.rb
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# a small script following the code samples in the README
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
7
|
+
require 'jsi'
|
8
|
+
|
9
|
+
puts "creating a schema and assigning its schema module to a constant"
|
10
|
+
puts
|
11
|
+
|
12
|
+
contact_schema = JSI.new_schema({
|
13
|
+
"$schema" => "http://json-schema.org/draft-07/schema",
|
14
|
+
"description" => "A Contact",
|
15
|
+
"type" => "object",
|
16
|
+
"properties" => {
|
17
|
+
"name" => {
|
18
|
+
"type" => "string",
|
19
|
+
},
|
20
|
+
"phone" => {
|
21
|
+
"type" => "array",
|
22
|
+
"items" => {
|
23
|
+
"type" => "object",
|
24
|
+
"properties" => {
|
25
|
+
"location" => {
|
26
|
+
"type" => "string",
|
27
|
+
},
|
28
|
+
"number" => {
|
29
|
+
"type" => "string",
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
})
|
36
|
+
|
37
|
+
print 'contact_schema: '
|
38
|
+
pp contact_schema
|
39
|
+
|
40
|
+
print 'contact_schema.jsi_schema_module: '
|
41
|
+
pp contact_schema.jsi_schema_module
|
42
|
+
|
43
|
+
puts "constant assignment: Contact = contact_schema.jsi_schema_module"
|
44
|
+
Contact = contact_schema.jsi_schema_module
|
45
|
+
|
46
|
+
print 'contact_schema.jsi_schema_module: '
|
47
|
+
pp contact_schema.jsi_schema_module
|
48
|
+
|
49
|
+
puts
|
50
|
+
puts "creating and using an instance described by the schema"
|
51
|
+
puts
|
52
|
+
|
53
|
+
bill = Contact.new_jsi({
|
54
|
+
"name" => "bill",
|
55
|
+
"phone" => [
|
56
|
+
{
|
57
|
+
"location" => "home",
|
58
|
+
"number" => "555",
|
59
|
+
}
|
60
|
+
],
|
61
|
+
"nickname" => "big b",
|
62
|
+
})
|
63
|
+
|
64
|
+
print 'bill: '
|
65
|
+
pp bill
|
66
|
+
|
67
|
+
print 'bill.name: '
|
68
|
+
pp bill.name
|
69
|
+
|
70
|
+
print 'bill.phone.map(&:location): '
|
71
|
+
pp bill.phone.map(&:location)
|
72
|
+
|
73
|
+
print 'bill.jsi_valid?: '
|
74
|
+
pp bill.jsi_valid?
|
75
|
+
|
76
|
+
bad = Contact.new_jsi({'phone' => [{'number' => [5, 5, 5]}]})
|
77
|
+
|
78
|
+
print 'bad: '
|
79
|
+
pp bad
|
80
|
+
|
81
|
+
print 'bad.phone.jsi_validate: '
|
82
|
+
pp bad.phone.jsi_validate
|
83
|
+
|
84
|
+
print 'bill.transform_values(&:size): '
|
85
|
+
pp bill.transform_values(&:size)
|
86
|
+
|
87
|
+
print "bill['nickname']: "
|
88
|
+
pp bill['nickname']
|
89
|
+
|
90
|
+
puts
|
91
|
+
puts "OOP: application-defined methods on schema modules apply to their instances"
|
92
|
+
puts
|
93
|
+
|
94
|
+
module Contact
|
95
|
+
def phone_numbers
|
96
|
+
phone.map(&:number)
|
97
|
+
end
|
98
|
+
def name
|
99
|
+
super + ' esq.'
|
100
|
+
end
|
101
|
+
def name=(name)
|
102
|
+
super(name.chomp(' esq.'))
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
print 'bill.name: '
|
107
|
+
pp bill.name
|
108
|
+
|
109
|
+
puts "bill.name = 'rob esq.'"
|
110
|
+
bill.name = 'rob esq.'
|
111
|
+
|
112
|
+
print "bill['name']: "
|
113
|
+
pp bill['name']
|
114
|
+
|
115
|
+
print 'bill.phone_numbers: '
|
116
|
+
pp bill.phone_numbers
|
117
|
+
|
118
|
+
puts
|
119
|
+
puts "OOP on subschemas"
|
120
|
+
puts
|
121
|
+
|
122
|
+
print "Contact.properties['phone'].items: "
|
123
|
+
pp Contact.properties['phone'].items
|
124
|
+
|
125
|
+
module Contact
|
126
|
+
Phone = properties['phone'].items
|
127
|
+
module Phone
|
128
|
+
def number_with_dashes
|
129
|
+
number.split(//).join('-')
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
print "Contact.properties['phone'].items: "
|
135
|
+
pp Contact.properties['phone'].items
|
136
|
+
|
137
|
+
print 'bill.phone.first.number_with_dashes: '
|
138
|
+
pp bill.phone.first.number_with_dashes
|
@@ -0,0 +1,149 @@
|
|
1
|
+
{
|
2
|
+
"id": "http://json-schema.org/draft-04/schema#",
|
3
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
4
|
+
"description": "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": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
|
17
|
+
},
|
18
|
+
"simpleTypes": {
|
19
|
+
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
|
20
|
+
},
|
21
|
+
"stringArray": {
|
22
|
+
"type": "array",
|
23
|
+
"items": { "type": "string" },
|
24
|
+
"minItems": 1,
|
25
|
+
"uniqueItems": true
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"type": "object",
|
29
|
+
"properties": {
|
30
|
+
"id": {
|
31
|
+
"type": "string"
|
32
|
+
},
|
33
|
+
"$schema": {
|
34
|
+
"type": "string"
|
35
|
+
},
|
36
|
+
"title": {
|
37
|
+
"type": "string"
|
38
|
+
},
|
39
|
+
"description": {
|
40
|
+
"type": "string"
|
41
|
+
},
|
42
|
+
"default": {},
|
43
|
+
"multipleOf": {
|
44
|
+
"type": "number",
|
45
|
+
"minimum": 0,
|
46
|
+
"exclusiveMinimum": true
|
47
|
+
},
|
48
|
+
"maximum": {
|
49
|
+
"type": "number"
|
50
|
+
},
|
51
|
+
"exclusiveMaximum": {
|
52
|
+
"type": "boolean",
|
53
|
+
"default": false
|
54
|
+
},
|
55
|
+
"minimum": {
|
56
|
+
"type": "number"
|
57
|
+
},
|
58
|
+
"exclusiveMinimum": {
|
59
|
+
"type": "boolean",
|
60
|
+
"default": false
|
61
|
+
},
|
62
|
+
"maxLength": { "$ref": "#/definitions/positiveInteger" },
|
63
|
+
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
64
|
+
"pattern": {
|
65
|
+
"type": "string",
|
66
|
+
"format": "regex"
|
67
|
+
},
|
68
|
+
"additionalItems": {
|
69
|
+
"anyOf": [
|
70
|
+
{ "type": "boolean" },
|
71
|
+
{ "$ref": "#" }
|
72
|
+
],
|
73
|
+
"default": {}
|
74
|
+
},
|
75
|
+
"items": {
|
76
|
+
"anyOf": [
|
77
|
+
{ "$ref": "#" },
|
78
|
+
{ "$ref": "#/definitions/schemaArray" }
|
79
|
+
],
|
80
|
+
"default": {}
|
81
|
+
},
|
82
|
+
"maxItems": { "$ref": "#/definitions/positiveInteger" },
|
83
|
+
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
84
|
+
"uniqueItems": {
|
85
|
+
"type": "boolean",
|
86
|
+
"default": false
|
87
|
+
},
|
88
|
+
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
|
89
|
+
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
90
|
+
"required": { "$ref": "#/definitions/stringArray" },
|
91
|
+
"additionalProperties": {
|
92
|
+
"anyOf": [
|
93
|
+
{ "type": "boolean" },
|
94
|
+
{ "$ref": "#" }
|
95
|
+
],
|
96
|
+
"default": {}
|
97
|
+
},
|
98
|
+
"definitions": {
|
99
|
+
"type": "object",
|
100
|
+
"additionalProperties": { "$ref": "#" },
|
101
|
+
"default": {}
|
102
|
+
},
|
103
|
+
"properties": {
|
104
|
+
"type": "object",
|
105
|
+
"additionalProperties": { "$ref": "#" },
|
106
|
+
"default": {}
|
107
|
+
},
|
108
|
+
"patternProperties": {
|
109
|
+
"type": "object",
|
110
|
+
"additionalProperties": { "$ref": "#" },
|
111
|
+
"default": {}
|
112
|
+
},
|
113
|
+
"dependencies": {
|
114
|
+
"type": "object",
|
115
|
+
"additionalProperties": {
|
116
|
+
"anyOf": [
|
117
|
+
{ "$ref": "#" },
|
118
|
+
{ "$ref": "#/definitions/stringArray" }
|
119
|
+
]
|
120
|
+
}
|
121
|
+
},
|
122
|
+
"enum": {
|
123
|
+
"type": "array",
|
124
|
+
"minItems": 1,
|
125
|
+
"uniqueItems": true
|
126
|
+
},
|
127
|
+
"type": {
|
128
|
+
"anyOf": [
|
129
|
+
{ "$ref": "#/definitions/simpleTypes" },
|
130
|
+
{
|
131
|
+
"type": "array",
|
132
|
+
"items": { "$ref": "#/definitions/simpleTypes" },
|
133
|
+
"minItems": 1,
|
134
|
+
"uniqueItems": true
|
135
|
+
}
|
136
|
+
]
|
137
|
+
},
|
138
|
+
"format": { "type": "string" },
|
139
|
+
"allOf": { "$ref": "#/definitions/schemaArray" },
|
140
|
+
"anyOf": { "$ref": "#/definitions/schemaArray" },
|
141
|
+
"oneOf": { "$ref": "#/definitions/schemaArray" },
|
142
|
+
"not": { "$ref": "#" }
|
143
|
+
},
|
144
|
+
"dependencies": {
|
145
|
+
"exclusiveMaximum": [ "maximum" ],
|
146
|
+
"exclusiveMinimum": [ "minimum" ]
|
147
|
+
},
|
148
|
+
"default": {}
|
149
|
+
}
|
@@ -0,0 +1,154 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-06/schema#",
|
3
|
+
"$id": "http://json-schema.org/draft-06/schema#",
|
4
|
+
"title": "Core schema meta-schema",
|
5
|
+
"definitions": {
|
6
|
+
"schemaArray": {
|
7
|
+
"type": "array",
|
8
|
+
"minItems": 1,
|
9
|
+
"items": { "$ref": "#" }
|
10
|
+
},
|
11
|
+
"nonNegativeInteger": {
|
12
|
+
"type": "integer",
|
13
|
+
"minimum": 0
|
14
|
+
},
|
15
|
+
"nonNegativeIntegerDefault0": {
|
16
|
+
"allOf": [
|
17
|
+
{ "$ref": "#/definitions/nonNegativeInteger" },
|
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
|
+
"default": []
|
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
|
+
"examples": {
|
61
|
+
"type": "array",
|
62
|
+
"items": {}
|
63
|
+
},
|
64
|
+
"multipleOf": {
|
65
|
+
"type": "number",
|
66
|
+
"exclusiveMinimum": 0
|
67
|
+
},
|
68
|
+
"maximum": {
|
69
|
+
"type": "number"
|
70
|
+
},
|
71
|
+
"exclusiveMaximum": {
|
72
|
+
"type": "number"
|
73
|
+
},
|
74
|
+
"minimum": {
|
75
|
+
"type": "number"
|
76
|
+
},
|
77
|
+
"exclusiveMinimum": {
|
78
|
+
"type": "number"
|
79
|
+
},
|
80
|
+
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
|
81
|
+
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
82
|
+
"pattern": {
|
83
|
+
"type": "string",
|
84
|
+
"format": "regex"
|
85
|
+
},
|
86
|
+
"additionalItems": { "$ref": "#" },
|
87
|
+
"items": {
|
88
|
+
"anyOf": [
|
89
|
+
{ "$ref": "#" },
|
90
|
+
{ "$ref": "#/definitions/schemaArray" }
|
91
|
+
],
|
92
|
+
"default": {}
|
93
|
+
},
|
94
|
+
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
|
95
|
+
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
96
|
+
"uniqueItems": {
|
97
|
+
"type": "boolean",
|
98
|
+
"default": false
|
99
|
+
},
|
100
|
+
"contains": { "$ref": "#" },
|
101
|
+
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
|
102
|
+
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
103
|
+
"required": { "$ref": "#/definitions/stringArray" },
|
104
|
+
"additionalProperties": { "$ref": "#" },
|
105
|
+
"definitions": {
|
106
|
+
"type": "object",
|
107
|
+
"additionalProperties": { "$ref": "#" },
|
108
|
+
"default": {}
|
109
|
+
},
|
110
|
+
"properties": {
|
111
|
+
"type": "object",
|
112
|
+
"additionalProperties": { "$ref": "#" },
|
113
|
+
"default": {}
|
114
|
+
},
|
115
|
+
"patternProperties": {
|
116
|
+
"type": "object",
|
117
|
+
"additionalProperties": { "$ref": "#" },
|
118
|
+
"default": {}
|
119
|
+
},
|
120
|
+
"dependencies": {
|
121
|
+
"type": "object",
|
122
|
+
"additionalProperties": {
|
123
|
+
"anyOf": [
|
124
|
+
{ "$ref": "#" },
|
125
|
+
{ "$ref": "#/definitions/stringArray" }
|
126
|
+
]
|
127
|
+
}
|
128
|
+
},
|
129
|
+
"propertyNames": { "$ref": "#" },
|
130
|
+
"const": {},
|
131
|
+
"enum": {
|
132
|
+
"type": "array",
|
133
|
+
"minItems": 1,
|
134
|
+
"uniqueItems": true
|
135
|
+
},
|
136
|
+
"type": {
|
137
|
+
"anyOf": [
|
138
|
+
{ "$ref": "#/definitions/simpleTypes" },
|
139
|
+
{
|
140
|
+
"type": "array",
|
141
|
+
"items": { "$ref": "#/definitions/simpleTypes" },
|
142
|
+
"minItems": 1,
|
143
|
+
"uniqueItems": true
|
144
|
+
}
|
145
|
+
]
|
146
|
+
},
|
147
|
+
"format": { "type": "string" },
|
148
|
+
"allOf": { "$ref": "#/definitions/schemaArray" },
|
149
|
+
"anyOf": { "$ref": "#/definitions/schemaArray" },
|
150
|
+
"oneOf": { "$ref": "#/definitions/schemaArray" },
|
151
|
+
"not": { "$ref": "#" }
|
152
|
+
},
|
153
|
+
"default": {}
|
154
|
+
}
|
@@ -0,0 +1,168 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
3
|
+
"$id": "http://json-schema.org/draft-07/schema#",
|
4
|
+
"title": "Core schema meta-schema",
|
5
|
+
"definitions": {
|
6
|
+
"schemaArray": {
|
7
|
+
"type": "array",
|
8
|
+
"minItems": 1,
|
9
|
+
"items": { "$ref": "#" }
|
10
|
+
},
|
11
|
+
"nonNegativeInteger": {
|
12
|
+
"type": "integer",
|
13
|
+
"minimum": 0
|
14
|
+
},
|
15
|
+
"nonNegativeIntegerDefault0": {
|
16
|
+
"allOf": [
|
17
|
+
{ "$ref": "#/definitions/nonNegativeInteger" },
|
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
|
+
"default": []
|
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
|
+
"$comment": {
|
54
|
+
"type": "string"
|
55
|
+
},
|
56
|
+
"title": {
|
57
|
+
"type": "string"
|
58
|
+
},
|
59
|
+
"description": {
|
60
|
+
"type": "string"
|
61
|
+
},
|
62
|
+
"default": true,
|
63
|
+
"readOnly": {
|
64
|
+
"type": "boolean",
|
65
|
+
"default": false
|
66
|
+
},
|
67
|
+
"examples": {
|
68
|
+
"type": "array",
|
69
|
+
"items": true
|
70
|
+
},
|
71
|
+
"multipleOf": {
|
72
|
+
"type": "number",
|
73
|
+
"exclusiveMinimum": 0
|
74
|
+
},
|
75
|
+
"maximum": {
|
76
|
+
"type": "number"
|
77
|
+
},
|
78
|
+
"exclusiveMaximum": {
|
79
|
+
"type": "number"
|
80
|
+
},
|
81
|
+
"minimum": {
|
82
|
+
"type": "number"
|
83
|
+
},
|
84
|
+
"exclusiveMinimum": {
|
85
|
+
"type": "number"
|
86
|
+
},
|
87
|
+
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
|
88
|
+
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
89
|
+
"pattern": {
|
90
|
+
"type": "string",
|
91
|
+
"format": "regex"
|
92
|
+
},
|
93
|
+
"additionalItems": { "$ref": "#" },
|
94
|
+
"items": {
|
95
|
+
"anyOf": [
|
96
|
+
{ "$ref": "#" },
|
97
|
+
{ "$ref": "#/definitions/schemaArray" }
|
98
|
+
],
|
99
|
+
"default": true
|
100
|
+
},
|
101
|
+
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
|
102
|
+
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
103
|
+
"uniqueItems": {
|
104
|
+
"type": "boolean",
|
105
|
+
"default": false
|
106
|
+
},
|
107
|
+
"contains": { "$ref": "#" },
|
108
|
+
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
|
109
|
+
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
110
|
+
"required": { "$ref": "#/definitions/stringArray" },
|
111
|
+
"additionalProperties": { "$ref": "#" },
|
112
|
+
"definitions": {
|
113
|
+
"type": "object",
|
114
|
+
"additionalProperties": { "$ref": "#" },
|
115
|
+
"default": {}
|
116
|
+
},
|
117
|
+
"properties": {
|
118
|
+
"type": "object",
|
119
|
+
"additionalProperties": { "$ref": "#" },
|
120
|
+
"default": {}
|
121
|
+
},
|
122
|
+
"patternProperties": {
|
123
|
+
"type": "object",
|
124
|
+
"additionalProperties": { "$ref": "#" },
|
125
|
+
"propertyNames": { "format": "regex" },
|
126
|
+
"default": {}
|
127
|
+
},
|
128
|
+
"dependencies": {
|
129
|
+
"type": "object",
|
130
|
+
"additionalProperties": {
|
131
|
+
"anyOf": [
|
132
|
+
{ "$ref": "#" },
|
133
|
+
{ "$ref": "#/definitions/stringArray" }
|
134
|
+
]
|
135
|
+
}
|
136
|
+
},
|
137
|
+
"propertyNames": { "$ref": "#" },
|
138
|
+
"const": true,
|
139
|
+
"enum": {
|
140
|
+
"type": "array",
|
141
|
+
"items": true,
|
142
|
+
"minItems": 1,
|
143
|
+
"uniqueItems": true
|
144
|
+
},
|
145
|
+
"type": {
|
146
|
+
"anyOf": [
|
147
|
+
{ "$ref": "#/definitions/simpleTypes" },
|
148
|
+
{
|
149
|
+
"type": "array",
|
150
|
+
"items": { "$ref": "#/definitions/simpleTypes" },
|
151
|
+
"minItems": 1,
|
152
|
+
"uniqueItems": true
|
153
|
+
}
|
154
|
+
]
|
155
|
+
},
|
156
|
+
"format": { "type": "string" },
|
157
|
+
"contentMediaType": { "type": "string" },
|
158
|
+
"contentEncoding": { "type": "string" },
|
159
|
+
"if": { "$ref": "#" },
|
160
|
+
"then": { "$ref": "#" },
|
161
|
+
"else": { "$ref": "#" },
|
162
|
+
"allOf": { "$ref": "#/definitions/schemaArray" },
|
163
|
+
"anyOf": { "$ref": "#/definitions/schemaArray" },
|
164
|
+
"oneOf": { "$ref": "#/definitions/schemaArray" },
|
165
|
+
"not": { "$ref": "#" }
|
166
|
+
},
|
167
|
+
"default": true
|
168
|
+
}
|