|
1 | 1 | { |
2 | 2 | "$schema": "http://json-schema.org/draft-07/schema#", |
3 | | - "$id": "NWB.schema.json", |
| 3 | + "$id": "nwb.schema.json", |
4 | 4 | "title": "Schema for the NWB language specification", |
5 | | - "description": "A schema for validating NWB YAML files", |
| 5 | + "description": "A schema for validating NWB YAML files and NWB extensions", |
6 | 6 | "version": "2.0.2", |
7 | 7 | "type": "object", |
| 8 | + "additionalProperties": false, |
8 | 9 | "properties": { |
9 | 10 | "groups": {"$ref": "#/definitions/groups"}, |
10 | 11 | "attributes": {"$ref": "#/definitions/attributes"}, |
11 | 12 | "datasets": {"$ref": "#/definitions/datasets"}, |
12 | | - "links": {"$ref": "#/definitions/links"} |
| 13 | + "links": {"$ref": "#/definitions/links"}, |
| 14 | + "namespaces": { |
| 15 | + "type": "array", |
| 16 | + "items": { |
| 17 | + "type": "object", |
| 18 | + "additionalProperties": false, |
| 19 | + "required": [ |
| 20 | + "name", |
| 21 | + "version", |
| 22 | + "author", |
| 23 | + "contact" |
| 24 | + ], |
| 25 | + "properties": { |
| 26 | + "name": {"type": "string"}, |
| 27 | + "version": {"type": "string", "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"}, |
| 28 | + "doc": {"type": "string"}, |
| 29 | + "author": {"type": "array", "items": {"type": "string"}}, |
| 30 | + "contact": {"type": "array", "items": {"type": "string", "format": "email"}}, |
| 31 | + "full_name": {"type": "string"}, |
| 32 | + "date": {"type": "string", "format": "date"}, |
| 33 | + "schema": { |
| 34 | + "type": "array", |
| 35 | + "items": { |
| 36 | + "type": "object", |
| 37 | + "oneOf": [ |
| 38 | + {"required": ["namespace"]}, |
| 39 | + {"required": ["source"]} |
| 40 | + ], |
| 41 | + "properties": { |
| 42 | + "namespace": {"type": "string"}, |
| 43 | + "doc": {"type": "string"}, |
| 44 | + "source": {"type": "string"}, |
| 45 | + "title": {"type": "string"}, |
| 46 | + "neurodata_types": { |
| 47 | + "type": "array", |
| 48 | + "items": { |
| 49 | + "type": "string" |
| 50 | + } |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | + } |
| 55 | + } |
| 56 | + } |
| 57 | + } |
13 | 58 | }, |
14 | 59 | "definitions": { |
15 | 60 | "protectedString": { |
| 61 | + "type": "string", |
16 | 62 | "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" |
17 | 63 | }, |
18 | 64 | "quantity": { |
|
35 | 81 | } |
36 | 82 | ] |
37 | 83 | }, |
38 | | - "dtype": { |
| 84 | + "flat_dtype": { |
39 | 85 | "description": "Required string describing the data type of the attribute", |
40 | 86 | "anyOf": [ |
41 | 87 | { |
|
51 | 97 | "int32", |
52 | 98 | "int16", |
53 | 99 | "int8", |
| 100 | + "uint", |
54 | 101 | "uint32", |
55 | 102 | "uint16", |
56 | 103 | "uint8", |
| 104 | + "uint64", |
57 | 105 | "numeric", |
58 | 106 | "text", |
59 | 107 | "utf", |
60 | 108 | "utf8", |
61 | | - "unt-8", |
| 109 | + "utf-8", |
62 | 110 | "ascii", |
63 | 111 | "bool", |
64 | 112 | "isodatetime" |
65 | 113 | ] |
66 | 114 | }, |
67 | | - { |
68 | | - "$ref": "#/definitions/ref_dtype" |
69 | | - } |
| 115 | + {"$ref": "#/definitions/ref_dtype"} |
| 116 | + ] |
| 117 | + }, |
| 118 | + "dtype": { |
| 119 | + "anyOf": [ |
| 120 | + {"$ref": "#/definitions/flat_dtype"}, |
| 121 | + {"$ref": "#/definitions/compound_dtype"} |
70 | 122 | ] |
71 | 123 | }, |
72 | 124 | "dims": { |
|
107 | 159 | } |
108 | 160 | }, |
109 | 161 | "ref_dtype": { |
| 162 | + "type": "object", |
110 | 163 | "required": ["target_type", "reftype"], |
111 | 164 | "properties": { |
112 | 165 | "target_type": { |
|
120 | 173 | } |
121 | 174 | } |
122 | 175 | }, |
| 176 | + "compound_dtype": { |
| 177 | + "type": "array", |
| 178 | + "items": { |
| 179 | + "type": "object", |
| 180 | + "required": ["name", "doc", "dtype"], |
| 181 | + "properties": { |
| 182 | + "name": {"$ref": "#/definitions/protectedString"}, |
| 183 | + "doc": {"type": "string"}, |
| 184 | + "dtype": {"$ref": "#/definitions/flat_dtype"} |
| 185 | + } |
| 186 | + } |
| 187 | + }, |
123 | 188 | "groups": { |
124 | 189 | "description": "list of groups", |
125 | 190 | "type": "array", |
126 | 191 | "items": { |
| 192 | + "title": "group", |
127 | 193 | "type": "object", |
128 | 194 | "required": ["doc"], |
129 | 195 | "additionalProperties": false, |
|
150 | 216 | "attributes": { |
151 | 217 | "type": "array", |
152 | 218 | "items": { |
| 219 | + "title": "attribute", |
153 | 220 | "type": "object", |
154 | 221 | "required": ["doc"], |
155 | 222 | "additionalProperties": false, |
|
168 | 235 | "links": { |
169 | 236 | "type": "array", |
170 | 237 | "items": { |
| 238 | + "title": "link", |
171 | 239 | "type": "object", |
172 | 240 | "required": ["target_type", "doc"], |
173 | 241 | "additionalProperties": false, |
|
182 | 250 | "datasets": { |
183 | 251 | "type": "array", |
184 | 252 | "items": { |
| 253 | + "title": "dataset", |
185 | 254 | "type": "object", |
186 | 255 | "required": ["doc"], |
187 | 256 | "additionalProperties": false, |
|
0 commit comments