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    "$schema": "http://json-schema.org/draft-04/schema#",
  3    "default": {},
  4    "definitions": {
  5        "positiveInteger": {
  6            "minimum": 0,
  7            "type": "integer"
  8        },
  9        "positiveIntegerDefault0": {
 10            "allOf": [
 11                {
 12                    "$ref": "#/definitions/positiveInteger"
 13                },
 14                {
 15                    "default": 0
 16                }
 17            ]
 18        },
 19        "schemaArray": {
 20            "items": {
 21                "$ref": "#"
 22            },
 23            "minItems": 1,
 24            "type": "array"
 25        },
 26        "simpleTypes": {
 27            "enum": [
 28                "array",
 29                "boolean",
 30                "integer",
 31                "null",
 32                "number",
 33                "object",
 34                "string",
 35                "1darray",
 36                "any",
 37                "bytes",
 38                "class",
 39                "complex",
 40                "float",
 41                "function",
 42                "instance",
 43                "int",
 44                "ndarray",
 45                "obj",
 46                "ply",
 47                "scalar",
 48                "schema",
 49                "uint",
 50                "unicode"
 51            ]
 52        },
 53        "stringArray": {
 54            "items": {
 55                "type": "string"
 56            },
 57            "minItems": 1,
 58            "type": "array",
 59            "uniqueItems": true
 60        }
 61    },
 62    "dependencies": {
 63        "exclusiveMaximum": [
 64            "maximum"
 65        ],
 66        "exclusiveMinimum": [
 67            "minimum"
 68        ]
 69    },
 70    "description": "Core schema meta-schema",
 71    "id": "http://json-schema.org/draft-04/schema#",
 72    "properties": {
 73        "$schema": {
 74            "format": "uri",
 75            "type": "string"
 76        },
 77        "additionalItems": {
 78            "anyOf": [
 79                {
 80                    "type": "boolean"
 81                },
 82                {
 83                    "$ref": "#"
 84                }
 85            ],
 86            "default": {}
 87        },
 88        "additionalProperties": {
 89            "anyOf": [
 90                {
 91                    "type": "boolean"
 92                },
 93                {
 94                    "$ref": "#"
 95                }
 96            ],
 97            "default": {}
 98        },
 99        "allOf": {
100            "$ref": "#/definitions/schemaArray"
101        },
102        "anyOf": {
103            "$ref": "#/definitions/schemaArray"
104        },
105        "args": {
106            "description": "Arguments required to recreate a class instance.",
107            "type": "array"
108        },
109        "class": {
110            "anyOf": [
111                {
112                    "type": "class"
113                },
114                {
115                    "items": {
116                        "type": "class"
117                    },
118                    "minItems": 1,
119                    "type": "array"
120                }
121            ],
122            "description": "One or more classes that the object should be an instance of."
123        },
124        "default": {},
125        "definitions": {
126            "additionalProperties": {
127                "$ref": "#"
128            },
129            "default": {},
130            "type": "object"
131        },
132        "dependencies": {
133            "additionalProperties": {
134                "anyOf": [
135                    {
136                        "$ref": "#"
137                    },
138                    {
139                        "$ref": "#/definitions/stringArray"
140                    }
141                ]
142            },
143            "type": "object"
144        },
145        "description": {
146            "type": "string"
147        },
148        "enum": {
149            "type": "array"
150        },
151        "exclusiveMaximum": {
152            "default": false,
153            "type": "boolean"
154        },
155        "exclusiveMinimum": {
156            "default": false,
157            "type": "boolean"
158        },
159        "format": {
160            "type": "string"
161        },
162        "id": {
163            "format": "uri",
164            "type": "string"
165        },
166        "items": {
167            "anyOf": [
168                {
169                    "$ref": "#"
170                },
171                {
172                    "$ref": "#/definitions/schemaArray"
173                }
174            ],
175            "default": {}
176        },
177        "kwargs": {
178            "description": "Keyword arguments required to recreate a class instance.",
179            "type": "object"
180        },
181        "length": {
182            "description": "Number of elements in the 1D array.",
183            "minimum": 1,
184            "type": "number"
185        },
186        "maxItems": {
187            "$ref": "#/definitions/positiveInteger"
188        },
189        "maxLength": {
190            "$ref": "#/definitions/positiveInteger"
191        },
192        "maxProperties": {
193            "$ref": "#/definitions/positiveInteger"
194        },
195        "maximum": {
196            "type": "number"
197        },
198        "minItems": {
199            "$ref": "#/definitions/positiveIntegerDefault0"
200        },
201        "minLength": {
202            "$ref": "#/definitions/positiveIntegerDefault0"
203        },
204        "minProperties": {
205            "$ref": "#/definitions/positiveIntegerDefault0"
206        },
207        "minimum": {
208            "type": "number"
209        },
210        "multipleOf": {
211            "exclusiveMinimum": true,
212            "minimum": 0,
213            "type": "number"
214        },
215        "not": {
216            "$ref": "#"
217        },
218        "oneOf": {
219            "$ref": "#/definitions/schemaArray"
220        },
221        "pattern": {
222            "format": "regex",
223            "type": "string"
224        },
225        "patternProperties": {
226            "additionalProperties": {
227                "$ref": "#"
228            },
229            "default": {},
230            "type": "object"
231        },
232        "precision": {
233            "description": "The size (in bits) of each item.",
234            "minimum": 1,
235            "type": "number"
236        },
237        "properties": {
238            "additionalProperties": {
239                "$ref": "#"
240            },
241            "default": {},
242            "type": "object"
243        },
244        "required": {
245            "$ref": "#/definitions/stringArray"
246        },
247        "shape": {
248            "description": "Shape of the ND array in each dimension.",
249            "items": {
250                "minimum": 1,
251                "type": "integer"
252            },
253            "type": "array"
254        },
255        "subtype": {
256            "description": "The base type for each item.",
257            "enum": [
258                "bytes",
259                "complex",
260                "float",
261                "int",
262                "uint",
263                "unicode"
264            ],
265            "type": "string"
266        },
267        "temptype": {
268            "description": "The type of the data for a single message.",
269            "type": "schema"
270        },
271        "title": {
272            "type": "string"
273        },
274        "type": {
275            "anyOf": [
276                {
277                    "$ref": "#/definitions/simpleTypes"
278                },
279                {
280                    "items": {
281                        "$ref": "#/definitions/simpleTypes"
282                    },
283                    "minItems": 1,
284                    "type": "array",
285                    "uniqueItems": true
286                }
287            ]
288        },
289        "uniqueItems": {
290            "default": false,
291            "type": "boolean"
292        },
293        "units": {
294            "description": "Physical units.",
295            "type": "string"
296        }
297    },
298    "title": "Ygg meta-schema for data type schemas",
299    "type": "object"
300}