json_schemer 0.2.18 → 2.2.1
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 +4 -4
- data/.github/workflows/ci.yml +7 -7
- data/CHANGELOG.md +89 -0
- data/Gemfile.lock +35 -10
- data/README.md +402 -6
- data/bin/hostname_character_classes +42 -0
- data/bin/rake +29 -0
- data/exe/json_schemer +62 -0
- data/json_schemer.gemspec +9 -12
- data/lib/json_schemer/cached_resolver.rb +16 -0
- data/lib/json_schemer/configuration.rb +31 -0
- data/lib/json_schemer/content.rb +18 -0
- data/lib/json_schemer/draft201909/meta.rb +320 -0
- data/lib/json_schemer/draft201909/vocab/applicator.rb +104 -0
- data/lib/json_schemer/draft201909/vocab/core.rb +45 -0
- data/lib/json_schemer/draft201909/vocab.rb +31 -0
- data/lib/json_schemer/draft202012/meta.rb +364 -0
- data/lib/json_schemer/draft202012/vocab/applicator.rb +382 -0
- data/lib/json_schemer/draft202012/vocab/content.rb +52 -0
- data/lib/json_schemer/draft202012/vocab/core.rb +160 -0
- data/lib/json_schemer/draft202012/vocab/format_annotation.rb +23 -0
- data/lib/json_schemer/draft202012/vocab/format_assertion.rb +23 -0
- data/lib/json_schemer/draft202012/vocab/meta_data.rb +30 -0
- data/lib/json_schemer/draft202012/vocab/unevaluated.rb +104 -0
- data/lib/json_schemer/draft202012/vocab/validation.rb +286 -0
- data/lib/json_schemer/draft202012/vocab.rb +105 -0
- data/lib/json_schemer/draft4/meta.rb +161 -0
- data/lib/json_schemer/draft4/vocab/validation.rb +39 -0
- data/lib/json_schemer/draft4/vocab.rb +18 -0
- data/lib/json_schemer/draft6/meta.rb +172 -0
- data/lib/json_schemer/draft6/vocab.rb +16 -0
- data/lib/json_schemer/draft7/meta.rb +183 -0
- data/lib/json_schemer/draft7/vocab/validation.rb +69 -0
- data/lib/json_schemer/draft7/vocab.rb +30 -0
- data/lib/json_schemer/ecma_regexp.rb +51 -0
- data/lib/json_schemer/errors.rb +1 -0
- data/lib/json_schemer/format/duration.rb +23 -0
- data/lib/json_schemer/format/email.rb +56 -0
- data/lib/json_schemer/format/hostname.rb +58 -0
- data/lib/json_schemer/format/json_pointer.rb +18 -0
- data/lib/json_schemer/format/uri_template.rb +34 -0
- data/lib/json_schemer/format.rb +128 -109
- data/lib/json_schemer/keyword.rb +56 -0
- data/lib/json_schemer/location.rb +25 -0
- data/lib/json_schemer/openapi.rb +38 -0
- data/lib/json_schemer/openapi30/document.rb +1672 -0
- data/lib/json_schemer/openapi30/meta.rb +32 -0
- data/lib/json_schemer/openapi30/vocab/base.rb +18 -0
- data/lib/json_schemer/openapi30/vocab.rb +12 -0
- data/lib/json_schemer/openapi31/document.rb +1557 -0
- data/lib/json_schemer/openapi31/meta.rb +136 -0
- data/lib/json_schemer/openapi31/vocab/base.rb +127 -0
- data/lib/json_schemer/openapi31/vocab.rb +18 -0
- data/lib/json_schemer/output.rb +56 -0
- data/lib/json_schemer/result.rb +242 -0
- data/lib/json_schemer/schema.rb +424 -0
- data/lib/json_schemer/version.rb +1 -1
- data/lib/json_schemer.rb +243 -29
- metadata +141 -25
- data/lib/json_schemer/cached_ref_resolver.rb +0 -14
- data/lib/json_schemer/schema/base.rb +0 -658
- data/lib/json_schemer/schema/draft4.rb +0 -44
- data/lib/json_schemer/schema/draft6.rb +0 -25
- data/lib/json_schemer/schema/draft7.rb +0 -32
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module JSONSchemer
|
3
|
+
module Draft201909
|
4
|
+
module Vocab
|
5
|
+
module Core
|
6
|
+
class RecursiveAnchor < Keyword
|
7
|
+
def parse
|
8
|
+
root.resources[:dynamic][schema.base_uri] = schema if value == true
|
9
|
+
value
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class RecursiveRef < Keyword
|
14
|
+
def ref_uri
|
15
|
+
@ref_uri ||= URI.join(schema.base_uri, value)
|
16
|
+
end
|
17
|
+
|
18
|
+
def ref_schema
|
19
|
+
@ref_schema ||= root.resolve_ref(ref_uri)
|
20
|
+
end
|
21
|
+
|
22
|
+
def recursive_anchor
|
23
|
+
return @recursive_anchor if defined?(@recursive_anchor)
|
24
|
+
@recursive_anchor = (ref_schema.parsed['$recursiveAnchor']&.parsed == true)
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate(instance, instance_location, keyword_location, context)
|
28
|
+
schema = ref_schema
|
29
|
+
|
30
|
+
if recursive_anchor
|
31
|
+
context.dynamic_scope.each do |ancestor|
|
32
|
+
if ancestor.root.resources.fetch(:dynamic).key?(ancestor.base_uri)
|
33
|
+
schema = ancestor.root.resources.fetch(:dynamic).fetch(ancestor.base_uri)
|
34
|
+
break
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
schema.validate_instance(instance, instance_location, keyword_location, context)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module JSONSchemer
|
3
|
+
module Draft201909
|
4
|
+
module Vocab
|
5
|
+
CORE = Draft202012::Vocab::CORE.dup
|
6
|
+
CORE.delete('$dynamicAnchor')
|
7
|
+
CORE.delete('$dynamicRef')
|
8
|
+
CORE.merge!(
|
9
|
+
# https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-02#section-8.2.4.2
|
10
|
+
'$recursiveAnchor' => Core::RecursiveAnchor,
|
11
|
+
'$recursiveRef' => Core::RecursiveRef
|
12
|
+
)
|
13
|
+
|
14
|
+
APPLICATOR = Draft202012::Vocab::APPLICATOR.dup
|
15
|
+
APPLICATOR.delete('prefixItems')
|
16
|
+
APPLICATOR.merge!(
|
17
|
+
# https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-02#section-9.3.1
|
18
|
+
'items' => Applicator::Items,
|
19
|
+
'additionalItems' => Applicator::AdditionalItems,
|
20
|
+
'unevaluatedItems' => Applicator::UnevaluatedItems,
|
21
|
+
# https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-02#section-9.3.2.4
|
22
|
+
'unevaluatedProperties' => Draft202012::Vocab::Unevaluated::UnevaluatedProperties
|
23
|
+
)
|
24
|
+
|
25
|
+
VALIDATION = Draft202012::Vocab::VALIDATION
|
26
|
+
FORMAT = Draft202012::Vocab::FORMAT_ANNOTATION
|
27
|
+
CONTENT = Draft202012::Vocab::CONTENT
|
28
|
+
META_DATA = Draft202012::Vocab::META_DATA
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,364 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module JSONSchemer
|
3
|
+
module Draft202012
|
4
|
+
BASE_URI = URI('https://json-schema.org/draft/2020-12/schema')
|
5
|
+
FORMATS = {
|
6
|
+
'date-time' => Format::DATE_TIME,
|
7
|
+
'date' => Format::DATE,
|
8
|
+
'time' => Format::TIME,
|
9
|
+
'duration' => Format::DURATION,
|
10
|
+
'email' => Format::EMAIL,
|
11
|
+
'idn-email' => Format::IDN_EMAIL,
|
12
|
+
'hostname' => Format::HOSTNAME,
|
13
|
+
'idn-hostname' => Format::IDN_HOSTNAME,
|
14
|
+
'ipv4' => Format::IPV4,
|
15
|
+
'ipv6' => Format::IPV6,
|
16
|
+
'uri' => Format::URI,
|
17
|
+
'uri-reference' => Format::URI_REFERENCE,
|
18
|
+
'iri' => Format::IRI,
|
19
|
+
'iri-reference' => Format::IRI_REFERENCE,
|
20
|
+
'uuid' => Format::UUID,
|
21
|
+
'uri-template' => Format::URI_TEMPLATE,
|
22
|
+
'json-pointer' => Format::JSON_POINTER,
|
23
|
+
'relative-json-pointer' => Format::RELATIVE_JSON_POINTER,
|
24
|
+
'regex' => Format::REGEX
|
25
|
+
}
|
26
|
+
CONTENT_ENCODINGS = {
|
27
|
+
'base64' => ContentEncoding::BASE64
|
28
|
+
}
|
29
|
+
CONTENT_MEDIA_TYPES = {
|
30
|
+
'application/json' => ContentMediaType::JSON
|
31
|
+
}
|
32
|
+
SCHEMA = {
|
33
|
+
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
|
34
|
+
'$id' => 'https://json-schema.org/draft/2020-12/schema',
|
35
|
+
'$vocabulary' => {
|
36
|
+
'https://json-schema.org/draft/2020-12/vocab/core' => true,
|
37
|
+
'https://json-schema.org/draft/2020-12/vocab/applicator' => true,
|
38
|
+
'https://json-schema.org/draft/2020-12/vocab/unevaluated' => true,
|
39
|
+
'https://json-schema.org/draft/2020-12/vocab/validation' => true,
|
40
|
+
'https://json-schema.org/draft/2020-12/vocab/meta-data' => true,
|
41
|
+
'https://json-schema.org/draft/2020-12/vocab/format-annotation' => true,
|
42
|
+
'https://json-schema.org/draft/2020-12/vocab/content' => true
|
43
|
+
},
|
44
|
+
'$dynamicAnchor' => 'meta',
|
45
|
+
'title' => 'Core and Validation specifications meta-schema',
|
46
|
+
'allOf' => [
|
47
|
+
{'$ref' => 'meta/core'},
|
48
|
+
{'$ref' => 'meta/applicator'},
|
49
|
+
{'$ref' => 'meta/unevaluated'},
|
50
|
+
{'$ref' => 'meta/validation'},
|
51
|
+
{'$ref' => 'meta/meta-data'},
|
52
|
+
{'$ref' => 'meta/format-annotation'},
|
53
|
+
{'$ref' => 'meta/content'}
|
54
|
+
],
|
55
|
+
'type' => ['object', 'boolean'],
|
56
|
+
'$comment' => 'This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.',
|
57
|
+
'properties' => {
|
58
|
+
'definitions' => {
|
59
|
+
'$comment' => '"definitions" has been replaced by "$defs".',
|
60
|
+
'type' => 'object',
|
61
|
+
'additionalProperties' => { '$dynamicRef' => '#meta' },
|
62
|
+
'deprecated' => true,
|
63
|
+
'default' => {}
|
64
|
+
},
|
65
|
+
'dependencies' => {
|
66
|
+
'$comment' => '"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',
|
67
|
+
'type' => 'object',
|
68
|
+
'additionalProperties' => {
|
69
|
+
'anyOf' => [
|
70
|
+
{ '$dynamicRef' => '#meta' },
|
71
|
+
{ '$ref' => 'meta/validation#/$defs/stringArray' }
|
72
|
+
]
|
73
|
+
},
|
74
|
+
'deprecated' => true,
|
75
|
+
'default' => {}
|
76
|
+
},
|
77
|
+
'$recursiveAnchor' => {
|
78
|
+
'$comment' => '"$recursiveAnchor" has been replaced by "$dynamicAnchor".',
|
79
|
+
'$ref' => 'meta/core#/$defs/anchorString',
|
80
|
+
'deprecated' => true
|
81
|
+
},
|
82
|
+
'$recursiveRef' => {
|
83
|
+
'$comment' => '"$recursiveRef" has been replaced by "$dynamicRef".',
|
84
|
+
'$ref' => 'meta/core#/$defs/uriReferenceString',
|
85
|
+
'deprecated' => true
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
module Meta
|
91
|
+
CORE = {
|
92
|
+
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
|
93
|
+
'$id' => 'https://json-schema.org/draft/2020-12/meta/core',
|
94
|
+
'$dynamicAnchor' => 'meta',
|
95
|
+
'title' => 'Core vocabulary meta-schema',
|
96
|
+
'type' => ['object', 'boolean'],
|
97
|
+
'properties' => {
|
98
|
+
'$id' => {
|
99
|
+
'$ref' => '#/$defs/uriReferenceString',
|
100
|
+
'$comment' => 'Non-empty fragments not allowed.',
|
101
|
+
'pattern' => '^[^#]*#?$'
|
102
|
+
},
|
103
|
+
'$schema' => { '$ref' => '#/$defs/uriString' },
|
104
|
+
'$ref' => { '$ref' => '#/$defs/uriReferenceString' },
|
105
|
+
'$anchor' => { '$ref' => '#/$defs/anchorString' },
|
106
|
+
'$dynamicRef' => { '$ref' => '#/$defs/uriReferenceString' },
|
107
|
+
'$dynamicAnchor' => { '$ref' => '#/$defs/anchorString' },
|
108
|
+
'$vocabulary' => {
|
109
|
+
'type' => 'object',
|
110
|
+
'propertyNames' => { '$ref' => '#/$defs/uriString' },
|
111
|
+
'additionalProperties' => {
|
112
|
+
'type' => 'boolean'
|
113
|
+
}
|
114
|
+
},
|
115
|
+
'$comment' => {
|
116
|
+
'type' => 'string'
|
117
|
+
},
|
118
|
+
'$defs' => {
|
119
|
+
'type' => 'object',
|
120
|
+
'additionalProperties' => { '$dynamicRef' => '#meta' }
|
121
|
+
}
|
122
|
+
},
|
123
|
+
'$defs' => {
|
124
|
+
'anchorString' => {
|
125
|
+
'type' => 'string',
|
126
|
+
'pattern' => '^[A-Za-z_][-A-Za-z0-9._]*$'
|
127
|
+
},
|
128
|
+
'uriString' => {
|
129
|
+
'type' => 'string',
|
130
|
+
'format' => 'uri'
|
131
|
+
},
|
132
|
+
'uriReferenceString' => {
|
133
|
+
'type' => 'string',
|
134
|
+
'format' => 'uri-reference'
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
APPLICATOR = {
|
139
|
+
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
|
140
|
+
'$id' => 'https://json-schema.org/draft/2020-12/meta/applicator',
|
141
|
+
'$dynamicAnchor' => 'meta',
|
142
|
+
'title' => 'Applicator vocabulary meta-schema',
|
143
|
+
'type' => ['object', 'boolean'],
|
144
|
+
'properties' => {
|
145
|
+
'prefixItems' => { '$ref' => '#/$defs/schemaArray' },
|
146
|
+
'items' => { '$dynamicRef' => '#meta' },
|
147
|
+
'contains' => { '$dynamicRef' => '#meta' },
|
148
|
+
'additionalProperties' => { '$dynamicRef' => '#meta' },
|
149
|
+
'properties' => {
|
150
|
+
'type' => 'object',
|
151
|
+
'additionalProperties' => { '$dynamicRef' => '#meta' },
|
152
|
+
'default' => {}
|
153
|
+
},
|
154
|
+
'patternProperties' => {
|
155
|
+
'type' => 'object',
|
156
|
+
'additionalProperties' => { '$dynamicRef' => '#meta' },
|
157
|
+
'propertyNames' => { 'format' => 'regex' },
|
158
|
+
'default' => {}
|
159
|
+
},
|
160
|
+
'dependentSchemas' => {
|
161
|
+
'type' => 'object',
|
162
|
+
'additionalProperties' => { '$dynamicRef' => '#meta' },
|
163
|
+
'default' => {}
|
164
|
+
},
|
165
|
+
'propertyNames' => { '$dynamicRef' => '#meta' },
|
166
|
+
'if' => { '$dynamicRef' => '#meta' },
|
167
|
+
'then' => { '$dynamicRef' => '#meta' },
|
168
|
+
'else' => { '$dynamicRef' => '#meta' },
|
169
|
+
'allOf' => { '$ref' => '#/$defs/schemaArray' },
|
170
|
+
'anyOf' => { '$ref' => '#/$defs/schemaArray' },
|
171
|
+
'oneOf' => { '$ref' => '#/$defs/schemaArray' },
|
172
|
+
'not' => { '$dynamicRef' => '#meta' }
|
173
|
+
},
|
174
|
+
'$defs' => {
|
175
|
+
'schemaArray' => {
|
176
|
+
'type' => 'array',
|
177
|
+
'minItems' => 1,
|
178
|
+
'items' => { '$dynamicRef' => '#meta' }
|
179
|
+
}
|
180
|
+
}
|
181
|
+
}
|
182
|
+
UNEVALUATED = {
|
183
|
+
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
|
184
|
+
'$id' => 'https://json-schema.org/draft/2020-12/meta/unevaluated',
|
185
|
+
'$dynamicAnchor' => 'meta',
|
186
|
+
'title' => 'Unevaluated applicator vocabulary meta-schema',
|
187
|
+
'type' => ['object', 'boolean'],
|
188
|
+
'properties' => {
|
189
|
+
'unevaluatedItems' => { '$dynamicRef' => '#meta' },
|
190
|
+
'unevaluatedProperties' => { '$dynamicRef' => '#meta' }
|
191
|
+
}
|
192
|
+
}
|
193
|
+
VALIDATION = {
|
194
|
+
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
|
195
|
+
'$id' => 'https://json-schema.org/draft/2020-12/meta/validation',
|
196
|
+
'$dynamicAnchor' => 'meta',
|
197
|
+
'title' => 'Validation vocabulary meta-schema',
|
198
|
+
'type' => ['object', 'boolean'],
|
199
|
+
'properties' => {
|
200
|
+
'type' => {
|
201
|
+
'anyOf' => [
|
202
|
+
{ '$ref' => '#/$defs/simpleTypes' },
|
203
|
+
{
|
204
|
+
'type' => 'array',
|
205
|
+
'items' => { '$ref' => '#/$defs/simpleTypes' },
|
206
|
+
'minItems' => 1,
|
207
|
+
'uniqueItems' => true
|
208
|
+
}
|
209
|
+
]
|
210
|
+
},
|
211
|
+
'const' => true,
|
212
|
+
'enum' => {
|
213
|
+
'type' => 'array',
|
214
|
+
'items' => true
|
215
|
+
},
|
216
|
+
'multipleOf' => {
|
217
|
+
'type' => 'number',
|
218
|
+
'exclusiveMinimum' => 0
|
219
|
+
},
|
220
|
+
'maximum' => {
|
221
|
+
'type' => 'number'
|
222
|
+
},
|
223
|
+
'exclusiveMaximum' => {
|
224
|
+
'type' => 'number'
|
225
|
+
},
|
226
|
+
'minimum' => {
|
227
|
+
'type' => 'number'
|
228
|
+
},
|
229
|
+
'exclusiveMinimum' => {
|
230
|
+
'type' => 'number'
|
231
|
+
},
|
232
|
+
'maxLength' => { '$ref' => '#/$defs/nonNegativeInteger' },
|
233
|
+
'minLength' => { '$ref' => '#/$defs/nonNegativeIntegerDefault0' },
|
234
|
+
'pattern' => {
|
235
|
+
'type' => 'string',
|
236
|
+
'format' => 'regex'
|
237
|
+
},
|
238
|
+
'maxItems' => { '$ref' => '#/$defs/nonNegativeInteger' },
|
239
|
+
'minItems' => { '$ref' => '#/$defs/nonNegativeIntegerDefault0' },
|
240
|
+
'uniqueItems' => {
|
241
|
+
'type' => 'boolean',
|
242
|
+
'default' => false
|
243
|
+
},
|
244
|
+
'maxContains' => { '$ref' => '#/$defs/nonNegativeInteger' },
|
245
|
+
'minContains' => {
|
246
|
+
'$ref' => '#/$defs/nonNegativeInteger',
|
247
|
+
'default' => 1
|
248
|
+
},
|
249
|
+
'maxProperties' => { '$ref' => '#/$defs/nonNegativeInteger' },
|
250
|
+
'minProperties' => { '$ref' => '#/$defs/nonNegativeIntegerDefault0' },
|
251
|
+
'required' => { '$ref' => '#/$defs/stringArray' },
|
252
|
+
'dependentRequired' => {
|
253
|
+
'type' => 'object',
|
254
|
+
'additionalProperties' => {
|
255
|
+
'$ref' => '#/$defs/stringArray'
|
256
|
+
}
|
257
|
+
}
|
258
|
+
},
|
259
|
+
'$defs' => {
|
260
|
+
'nonNegativeInteger' => {
|
261
|
+
'type' => 'integer',
|
262
|
+
'minimum' => 0
|
263
|
+
},
|
264
|
+
'nonNegativeIntegerDefault0' => {
|
265
|
+
'$ref' => '#/$defs/nonNegativeInteger',
|
266
|
+
'default' => 0
|
267
|
+
},
|
268
|
+
'simpleTypes' => {
|
269
|
+
'enum' => [
|
270
|
+
'array',
|
271
|
+
'boolean',
|
272
|
+
'integer',
|
273
|
+
'null',
|
274
|
+
'number',
|
275
|
+
'object',
|
276
|
+
'string'
|
277
|
+
]
|
278
|
+
},
|
279
|
+
'stringArray' => {
|
280
|
+
'type' => 'array',
|
281
|
+
'items' => { 'type' => 'string' },
|
282
|
+
'uniqueItems' => true,
|
283
|
+
'default' => []
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
META_DATA = {
|
288
|
+
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
|
289
|
+
'$id' => 'https://json-schema.org/draft/2020-12/meta/meta-data',
|
290
|
+
'$dynamicAnchor' => 'meta',
|
291
|
+
'title' => 'Meta-data vocabulary meta-schema',
|
292
|
+
'type' => ['object', 'boolean'],
|
293
|
+
'properties' => {
|
294
|
+
'title' => {
|
295
|
+
'type' => 'string'
|
296
|
+
},
|
297
|
+
'description' => {
|
298
|
+
'type' => 'string'
|
299
|
+
},
|
300
|
+
'default' => true,
|
301
|
+
'deprecated' => {
|
302
|
+
'type' => 'boolean',
|
303
|
+
'default' => false
|
304
|
+
},
|
305
|
+
'readOnly' => {
|
306
|
+
'type' => 'boolean',
|
307
|
+
'default' => false
|
308
|
+
},
|
309
|
+
'writeOnly' => {
|
310
|
+
'type' => 'boolean',
|
311
|
+
'default' => false
|
312
|
+
},
|
313
|
+
'examples' => {
|
314
|
+
'type' => 'array',
|
315
|
+
'items' => true
|
316
|
+
}
|
317
|
+
}
|
318
|
+
}
|
319
|
+
FORMAT_ANNOTATION = {
|
320
|
+
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
|
321
|
+
'$id' => 'https://json-schema.org/draft/2020-12/meta/format-annotation',
|
322
|
+
'$dynamicAnchor' => 'meta',
|
323
|
+
'title' => 'Format vocabulary meta-schema for annotation results',
|
324
|
+
'type' => ['object', 'boolean'],
|
325
|
+
'properties' => {
|
326
|
+
'format' => { 'type' => 'string' }
|
327
|
+
}
|
328
|
+
}
|
329
|
+
FORMAT_ASSERTION = {
|
330
|
+
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
|
331
|
+
'$id' => 'https://json-schema.org/draft/2020-12/meta/format-assertion',
|
332
|
+
'$dynamicAnchor' => 'meta',
|
333
|
+
'title' => 'Format vocabulary meta-schema for assertion results',
|
334
|
+
'type' => ['object', 'boolean'],
|
335
|
+
'properties' => {
|
336
|
+
'format' => { 'type' => 'string' }
|
337
|
+
}
|
338
|
+
}
|
339
|
+
CONTENT = {
|
340
|
+
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
|
341
|
+
'$id' => 'https://json-schema.org/draft/2020-12/meta/content',
|
342
|
+
'$dynamicAnchor' => 'meta',
|
343
|
+
'title' => 'Content vocabulary meta-schema',
|
344
|
+
'type' => ['object', 'boolean'],
|
345
|
+
'properties' => {
|
346
|
+
'contentEncoding' => { 'type' => 'string' },
|
347
|
+
'contentMediaType' => { 'type' => 'string' },
|
348
|
+
'contentSchema' => { '$dynamicRef' => '#meta' }
|
349
|
+
}
|
350
|
+
}
|
351
|
+
|
352
|
+
SCHEMAS = {
|
353
|
+
URI('https://json-schema.org/draft/2020-12/meta/core') => CORE,
|
354
|
+
URI('https://json-schema.org/draft/2020-12/meta/applicator') => APPLICATOR,
|
355
|
+
URI('https://json-schema.org/draft/2020-12/meta/unevaluated') => UNEVALUATED,
|
356
|
+
URI('https://json-schema.org/draft/2020-12/meta/validation') => VALIDATION,
|
357
|
+
URI('https://json-schema.org/draft/2020-12/meta/meta-data') => META_DATA,
|
358
|
+
URI('https://json-schema.org/draft/2020-12/meta/format-annotation') => FORMAT_ANNOTATION,
|
359
|
+
URI('https://json-schema.org/draft/2020-12/meta/format-assertion') => FORMAT_ASSERTION,
|
360
|
+
URI('https://json-schema.org/draft/2020-12/meta/content') => CONTENT
|
361
|
+
}
|
362
|
+
end
|
363
|
+
end
|
364
|
+
end
|