JSON MetaschemaΒΆ
yggdrasil uses this JSON metaschema
(shown below) for evaluating schemas including
type definitions. This metaschema is an expansion of the default metaschema defined by
JSON schema with the addition of several more
specific simpleTypes
that allow validation of more complex/specific data types.
Data types in the yggdrasil metaschema that are not part of the JSON schema metaschema include:
- 1darray:
One dimensional arrays with elements of uniform size that are contiguous in memory.
- bytes:
Raw bytes (to allow encoding of bytes objects in Python 3.6).
- complex:
Complex numbers.
- float:
Floating point number with support for numpy floats in addition to the Python built-in.
- function:
Python callable.
- int:
Integer number with support for numpy ints in addition to the Python built-in.
- ndarray:
Multi-dimensional arrays with elements of uniform size that are continguous in memory in C order.
- obj:
Wavefront OBJ representation of a 3D geometry.
- ply:
Polygon File Format representation of a 3D geometry.
- scalar:
Generic scalar that has an optional subtype.
- schema:
A JSON schema.
- uint:
Unsigned integer number with support for numpy uints.
- unicode:
Unicode objects that will be encoded as bytes using utf-8 encoding.
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": {
10 "$ref": "#"
11 }
12 },
13 "positiveInteger": {
14 "type": "integer",
15 "minimum": 0
16 },
17 "positiveIntegerDefault0": {
18 "allOf": [
19 {
20 "$ref": "#/definitions/positiveInteger"
21 },
22 {
23 "default": 0
24 }
25 ]
26 },
27 "simpleTypes": {
28 "enum": [
29 "array",
30 "boolean",
31 "integer",
32 "null",
33 "number",
34 "object",
35 "string",
36 "1darray",
37 "any",
38 "bytes",
39 "class",
40 "complex",
41 "float",
42 "function",
43 "instance",
44 "int",
45 "ndarray",
46 "obj",
47 "ply",
48 "scalar",
49 "schema",
50 "uint",
51 "unicode"
52 ]
53 },
54 "stringArray": {
55 "type": "array",
56 "items": {
57 "type": "string"
58 },
59 "minItems": 1,
60 "uniqueItems": true
61 }
62 },
63 "type": "object",
64 "properties": {
65 "id": {
66 "type": "string"
67 },
68 "$schema": {
69 "type": "string"
70 },
71 "title": {
72 "type": "string"
73 },
74 "description": {
75 "type": "string"
76 },
77 "default": {},
78 "multipleOf": {
79 "type": "number",
80 "minimum": 0,
81 "exclusiveMinimum": true
82 },
83 "maximum": {
84 "type": "number"
85 },
86 "exclusiveMaximum": {
87 "type": "boolean",
88 "default": false
89 },
90 "minimum": {
91 "type": "number"
92 },
93 "exclusiveMinimum": {
94 "type": "boolean",
95 "default": false
96 },
97 "maxLength": {
98 "$ref": "#/definitions/positiveInteger"
99 },
100 "minLength": {
101 "$ref": "#/definitions/positiveIntegerDefault0"
102 },
103 "pattern": {
104 "type": "string",
105 "format": "regex"
106 },
107 "additionalItems": {
108 "anyOf": [
109 {
110 "type": "boolean"
111 },
112 {
113 "$ref": "#"
114 }
115 ],
116 "default": {}
117 },
118 "items": {
119 "anyOf": [
120 {
121 "$ref": "#"
122 },
123 {
124 "$ref": "#/definitions/schemaArray"
125 }
126 ],
127 "default": {}
128 },
129 "maxItems": {
130 "$ref": "#/definitions/positiveInteger"
131 },
132 "minItems": {
133 "$ref": "#/definitions/positiveIntegerDefault0"
134 },
135 "uniqueItems": {
136 "type": "boolean",
137 "default": false
138 },
139 "maxProperties": {
140 "$ref": "#/definitions/positiveInteger"
141 },
142 "minProperties": {
143 "$ref": "#/definitions/positiveIntegerDefault0"
144 },
145 "required": {
146 "$ref": "#/definitions/stringArray"
147 },
148 "additionalProperties": {
149 "anyOf": [
150 {
151 "type": "boolean"
152 },
153 {
154 "$ref": "#"
155 }
156 ],
157 "default": {}
158 },
159 "definitions": {
160 "type": "object",
161 "additionalProperties": {
162 "$ref": "#"
163 },
164 "default": {}
165 },
166 "properties": {
167 "type": "object",
168 "additionalProperties": {
169 "$ref": "#"
170 },
171 "default": {}
172 },
173 "patternProperties": {
174 "type": "object",
175 "additionalProperties": {
176 "$ref": "#"
177 },
178 "default": {}
179 },
180 "dependencies": {
181 "type": "object",
182 "additionalProperties": {
183 "anyOf": [
184 {
185 "$ref": "#"
186 },
187 {
188 "$ref": "#/definitions/stringArray"
189 }
190 ]
191 }
192 },
193 "enum": {
194 "type": "array",
195 "minItems": 1,
196 "uniqueItems": true
197 },
198 "type": {
199 "anyOf": [
200 {
201 "$ref": "#/definitions/simpleTypes"
202 },
203 {
204 "type": "array",
205 "items": {
206 "$ref": "#/definitions/simpleTypes"
207 },
208 "minItems": 1,
209 "uniqueItems": true
210 }
211 ]
212 },
213 "format": {
214 "type": "string"
215 },
216 "allOf": {
217 "$ref": "#/definitions/schemaArray"
218 },
219 "anyOf": {
220 "$ref": "#/definitions/schemaArray"
221 },
222 "oneOf": {
223 "$ref": "#/definitions/schemaArray"
224 },
225 "not": {
226 "$ref": "#"
227 },
228 "args": {
229 "description": "Arguments required to recreate a class instance.",
230 "type": "array"
231 },
232 "class": {
233 "anyOf": [
234 {
235 "type": "class"
236 },
237 {
238 "items": {
239 "type": "class"
240 },
241 "minItems": 1,
242 "type": "array"
243 }
244 ],
245 "description": "One or more classes that the object should be an instance of."
246 },
247 "kwargs": {
248 "description": "Keyword arguments required to recreate a class instance.",
249 "type": "object"
250 },
251 "length": {
252 "description": "Number of elements in the 1D array.",
253 "minimum": 1,
254 "type": "number"
255 },
256 "precision": {
257 "description": "The size (in bits) of each item.",
258 "minimum": 1,
259 "type": "number"
260 },
261 "encoding": {
262 "description": "The encoding of string elements",
263 "enum": [
264 "UTF8",
265 "UTF16",
266 "UTF32",
267 "ASCII",
268 "UCS4"
269 ]
270 },
271 "shape": {
272 "description": "Shape of the ND array in each dimension.",
273 "items": {
274 "minimum": 1,
275 "type": "integer"
276 },
277 "type": "array"
278 },
279 "ndim": {
280 "description": "Number of dimensions in the ND array.",
281 "minimum": 1,
282 "type": "integer"
283 },
284 "subtype": {
285 "description": "The base type for each item.",
286 "enum": [
287 "string",
288 "complex",
289 "float",
290 "int",
291 "uint",
292 "bytes",
293 "unicode"
294 ],
295 "type": "string"
296 },
297 "units": {
298 "description": "Physical units.",
299 "type": "string"
300 },
301 "aliases": {
302 "description": "Aliases for a property that also be used.",
303 "type": "array",
304 "items": {
305 "type": "string"
306 }
307 },
308 "allowSingular": {
309 "description": "If true, the value may only contain an element matching the schema for 1) all array items, 2) the only array item in a 1-element long array, 3) the first required object property, 4) the only object property in a 1-element long object. Only valid for array & object schemas.",
310 "type": [
311 "boolean",
312 "string"
313 ],
314 "default": false
315 },
316 "allowWrapped": {
317 "description": "If true, the value may be wrapped in an array. If a string, the value may be wrapped in an object at the property specified by the string.",
318 "type": [
319 "boolean",
320 "string"
321 ],
322 "default": false
323 },
324 "deprecated": {
325 "description": "Message about the deprecation of a schema property that will be displayed during validation. If true, a generic warning will be displayed.",
326 "type": [
327 "boolean",
328 "string"
329 ]
330 },
331 "pullProperties": {
332 "description": "Pull properties from another location in the provided JSON document. If true, any missing local properties will be pulled from the parent object. If an array of property names is provided, only those local properties in the array will be pulled from the parent object. If an object is provided, the keys should be relative or absolute paths to objects in the JSON document that properties will be pulled from with the values specifying which properties should be pulled (true for all properties and an array or a select subset).",
333 "oneOf": [
334 {
335 "type": "boolean"
336 },
337 {
338 "type": "array",
339 "items": {
340 "type": "string"
341 }
342 },
343 {
344 "type": "object",
345 "additionalProperties": {
346 "oneOf": [
347 {
348 "type": "boolean"
349 },
350 {
351 "type": "array",
352 "items": {
353 "type": "string"
354 }
355 }
356 ]
357 }
358 }
359 ],
360 "default": false
361 },
362 "pushProperties": {
363 "description": "Push properties to another location in the provided JSON document. If true, any properties missing from the parent will be pushed to the parent object. If an array of property names is provided, only those parent properties in the array will be pushed to the parent object. If an object is provided, the keys should be relative or absolute paths to objects in the JSON document that properties will be pushed to with the values specifying which properties should be pushed (true for all missing destination properties and an array or a select subset).",
364 "oneOf": [
365 {
366 "type": "boolean"
367 },
368 {
369 "type": "array",
370 "items": {
371 "type": "string"
372 }
373 },
374 {
375 "type": "object",
376 "additionalProperties": {
377 "oneOf": [
378 {
379 "type": "boolean"
380 },
381 {
382 "type": "array",
383 "items": {
384 "type": "string"
385 }
386 }
387 ]
388 }
389 }
390 ],
391 "default": false
392 }
393 },
394 "dependencies": {
395 "exclusiveMaximum": [
396 "maximum"
397 ],
398 "exclusiveMinimum": [
399 "minimum"
400 ]
401 },
402 "default": {},
403 "title": "Ygg meta-schema for data type schemas"
404}