##// END OF EJS Templates
Reduce schema duplication by adding more references
Jessica B. Hamrick -
Show More
@@ -1,338 +1,334 b''
1 {
1 {
2 "$schema": "http://json-schema.org/draft-03/schema#",
2 "$schema": "http://json-schema.org/draft-03/schema#",
3 "description": "IPython Notebook v4.0 JSON schema.",
3 "description": "IPython Notebook v4.0 JSON schema.",
4 "type": "object",
4 "type": "object",
5 "additionalProperties": false,
5 "additionalProperties": false,
6 "properties": {
6 "properties": {
7 "metadata": {
7 "metadata": {
8 "description": "Notebook root-level metadata.",
8 "description": "Notebook root-level metadata.",
9 "type": "object",
9 "type": "object",
10 "required": true,
10 "required": true,
11 "additionalProperties": true,
11 "additionalProperties": true,
12 "properties": {
12 "properties": {
13 "language": {
13 "language": {
14 "description": "Language of the notebook's kernel.",
14 "description": "Language of the notebook's kernel.",
15 "type": "string",
15 "type": "string",
16 "required": true
16 "required": true
17 },
17 },
18 "kernel_info": {
18 "kernel_info": {
19 "description": "Other kernel information, to be determined.",
19 "description": "Other kernel information, to be determined.",
20 "type": "object",
20 "type": "object",
21 "required": true,
21 "required": true,
22 "additionalProperties": true
22 "additionalProperties": true
23 },
23 },
24 "signature": {
24 "signature": {
25 "description": "Hash of the notebook.",
25 "description": "Hash of the notebook.",
26 "type": "string",
26 "type": "string",
27 "required": false
27 "required": false
28 }
28 }
29 }
29 }
30 },
30 },
31 "nbformat_minor": {
31 "nbformat_minor": {
32 "description": "Notebook format (minor number). Incremented for slight changes to the notebook format.",
32 "description": "Notebook format (minor number). Incremented for slight changes to the notebook format.",
33 "type": "integer",
33 "type": "integer",
34 "required": true,
34 "required": true,
35 "minimum": 0
35 "minimum": 0
36 },
36 },
37 "nbformat": {
37 "nbformat": {
38 "description": "Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.",
38 "description": "Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.",
39 "type": "integer",
39 "type": "integer",
40 "required": true,
40 "required": true,
41 "minimum": 4,
41 "minimum": 4,
42 "maximum": 4
42 "maximum": 4
43 },
43 },
44 "orig_nbformat": {
44 "orig_nbformat": {
45 "description": "Original notebook format (major number) before converting the notebook between versions.",
45 "description": "Original notebook format (major number) before converting the notebook between versions.",
46 "type": "integer",
46 "type": "integer",
47 "required": false,
47 "required": false,
48 "minimum": 1
48 "minimum": 1
49 },
49 },
50 "cells": {
50 "cells": {
51 "description": "Array of cells of the current notebook.",
51 "description": "Array of cells of the current notebook.",
52 "type": "array",
52 "type": "array",
53 "required": true,
53 "required": true,
54 "items": {
54 "items": {
55 "type": [
55 "type": [
56 {"$ref": "/definitions/raw_cell"},
56 {"$ref": "/definitions/raw_cell"},
57 {"$ref": "/definitions/markdown_cell"},
57 {"$ref": "/definitions/markdown_cell"},
58 {"$ref": "/definitions/heading_cell"},
58 {"$ref": "/definitions/heading_cell"},
59 {"$ref": "/definitions/code_cell"}
59 {"$ref": "/definitions/code_cell"}
60 ]
60 ]
61 }
61 }
62 }
62 }
63 },
63 },
64
64
65 "definitions": {
65 "definitions": {
66
66
67 "cell_metadata_name": {
68 "description": "The cell's name. If present, must be a non-empty string.",
69 "type": "string",
70 "required": false,
71 "pattern": "^.+$"
72 },
73
74 "cell_metadata_tags": {
75 "description": "The cell's tags. Tags must be unique, and must not contain commas.",
76 "type": "array",
77 "required": false,
78 "uniqueItems": true,
79 "items": {
80 "type": "string",
81 "pattern": "^[^,]+$"
82 }
83 },
84
85 "raw_cell": {
67 "raw_cell": {
86 "description": "Notebook raw nbconvert cell.",
68 "description": "Notebook raw nbconvert cell.",
87 "type": "object",
69 "type": "object",
88 "additionalProperties": false,
70 "additionalProperties": false,
89 "properties": {
71 "properties": {
90 "cell_type": {
72 "cell_type": {
91 "description": "String identifying the type of cell.",
73 "description": "String identifying the type of cell.",
92 "enum": ["raw"],
74 "enum": ["raw"],
93 "required": true
75 "required": true
94 },
76 },
95 "metadata": {
77 "metadata": {
96 "description": "Cell-level metadata.",
78 "description": "Cell-level metadata.",
97 "type": "object",
79 "type": "object",
98 "required": true,
80 "required": true,
99 "additionalProperties": true,
81 "additionalProperties": true,
100 "properties": {
82 "properties": {
101 "format": {
83 "format": {
102 "description": "Raw cell metadata format for nbconvert.",
84 "description": "Raw cell metadata format for nbconvert.",
103 "type": "string",
85 "type": "string",
104 "required": false
86 "required": false
105 },
87 },
106 "name": {"$ref": "/definitions/cell_metadata_name"},
88 "name": {"$ref": "/definitions/misc/metadata_name"},
107 "tags": {"$ref": "/definitions/cell_metadata_tags"}
89 "tags": {"$ref": "/definitions/misc/metadata_tags"}
108 }
90 }
109 },
91 },
110 "source": {
92 "source": {"$ref": "/definitions/misc/source"}
111 "description": "Contents of the cell, represented as an array of lines.",
112 "type": "array",
113 "required": true,
114 "items": {"type": "string"}
115 }
116 }
93 }
117 },
94 },
118
95
119 "markdown_cell": {
96 "markdown_cell": {
120 "description": "Notebook markdown cell.",
97 "description": "Notebook markdown cell.",
121 "type": "object",
98 "type": "object",
122 "additionalProperties": false,
99 "additionalProperties": false,
123 "properties": {
100 "properties": {
124 "cell_type": {
101 "cell_type": {
125 "description": "String identifying the type of cell.",
102 "description": "String identifying the type of cell.",
126 "enum": ["markdown"],
103 "enum": ["markdown"],
127 "required": true
104 "required": true
128 },
105 },
129 "metadata": {
106 "metadata": {
130 "description": "Cell-level metadata.",
107 "description": "Cell-level metadata.",
131 "type": "object",
108 "type": "object",
132 "required": true,
109 "required": true,
133 "properties": {
110 "properties": {
134 "name": {"$ref": "/definitions/cell_metadata_name"},
111 "name": {"$ref": "/definitions/misc/metadata_name"},
135 "tags": {"$ref": "/definitions/cell_metadata_tags"}
112 "tags": {"$ref": "/definitions/misc/metadata_tags"}
136 },
113 },
137 "additionalProperties": true
114 "additionalProperties": true
138 },
115 },
139 "source": {
116 "source": {"$ref": "/definitions/misc/source"}
140 "description": "Contents of the cell, represented as an array of lines.",
141 "type": "array",
142 "required": true,
143 "items": {"type": "string"}
144 }
145 }
117 }
146 },
118 },
147
119
148 "heading_cell": {
120 "heading_cell": {
149 "description": "Notebook heading cell.",
121 "description": "Notebook heading cell.",
150 "type": "object",
122 "type": "object",
151 "additionalProperties": false,
123 "additionalProperties": false,
152 "properties": {
124 "properties": {
153 "cell_type": {
125 "cell_type": {
154 "description": "String identifying the type of cell.",
126 "description": "String identifying the type of cell.",
155 "enum": ["heading"],
127 "enum": ["heading"],
156 "required": true
128 "required": true
157 },
129 },
158 "metadata": {
130 "metadata": {
159 "description": "Cell-level metadata.",
131 "description": "Cell-level metadata.",
160 "type": "object",
132 "type": "object",
161 "required": true,
133 "required": true,
162 "properties": {
134 "properties": {
163 "name": {"$ref": "/definitions/cell_metadata_name"},
135 "name": {"$ref": "/definitions/misc/metadata_name"},
164 "tags": {"$ref": "/definitions/cell_metadata_tags"}
136 "tags": {"$ref": "/definitions/misc/metadata_tags"}
165 },
137 },
166 "additionalProperties": true
138 "additionalProperties": true
167 },
139 },
168 "source": {
140 "source": {"$ref": "/definitions/misc/source"},
169 "description": "Contents of the cell, represented as an array of lines.",
170 "type": "array",
171 "required": true,
172 "items": {"type": "string"}
173 },
174 "level": {
141 "level": {
175 "description": "Level of heading cells.",
142 "description": "Level of heading cells.",
176 "type": "integer",
143 "type": "integer",
177 "required": true,
144 "required": true,
178 "minimum": 1,
145 "minimum": 1,
179 "maximum": 6
146 "maximum": 6
180 }
147 }
181 }
148 }
182 },
149 },
183
150
184 "code_cell": {
151 "code_cell": {
185 "description": "Notebook code cell.",
152 "description": "Notebook code cell.",
186 "type": "object",
153 "type": "object",
187 "additionalProperties": false,
154 "additionalProperties": false,
188 "properties": {
155 "properties": {
189 "cell_type": {
156 "cell_type": {
190 "description": "String identifying the type of cell.",
157 "description": "String identifying the type of cell.",
191 "enum": ["code"],
158 "enum": ["code"],
192 "required": true
159 "required": true
193 },
160 },
194 "metadata": {
161 "metadata": {
195 "description": "Cell-level metadata.",
162 "description": "Cell-level metadata.",
196 "type": "object",
163 "type": "object",
197 "required": true,
164 "required": true,
198 "additionalProperties": true,
165 "additionalProperties": true,
199 "properties": {
166 "properties": {
200 "collapsed": {
167 "collapsed": {
201 "description": "Whether the cell is collapsed/expanded.",
168 "description": "Whether the cell is collapsed/expanded.",
202 "type": "boolean",
169 "type": "boolean",
203 "required": true
170 "required": true
204 },
171 },
205 "autoscroll": {
172 "autoscroll": {
206 "description": "Whether the cell's output should autoscroll.",
173 "description": "Whether the cell's output should autoscroll.",
207 "type": "boolean",
174 "type": "boolean",
208 "required": true
175 "required": true
209 },
176 },
210 "name": {"$ref": "/definitions/cell_metadata_name"},
177 "name": {"$ref": "/definitions/misc/metadata_name"},
211 "tags": {"$ref": "/definitions/cell_metadata_tags"}
178 "tags": {"$ref": "/definitions/misc/metadata_tags"}
212 }
179 }
213 },
180 },
214 "source": {
181 "source": {"$ref": "/definitions/misc/source"},
215 "description": "Contents of the cell, represented as an array of lines.",
216 "type": "array",
217 "required": true,
218 "items": {"type": "string"}
219 },
220 "outputs": {
182 "outputs": {
221 "description": "Execution, display, or stream outputs.",
183 "description": "Execution, display, or stream outputs.",
222 "type": "array",
184 "type": "array",
223 "required": true,
185 "required": true,
224 "items": {
186 "items": {
225 "type": [
187 "type": [
226 {"$ref": "/definitions/execute_output"},
188 {"$ref": "/definitions/execute_output"},
189 {"$ref": "/definitions/display_data_output"},
227 {"$ref": "/definitions/stream_output"},
190 {"$ref": "/definitions/stream_output"},
228 {"$ref": "/definitions/error_output"}
191 {"$ref": "/definitions/error_output"}
229 ]
192 ]
230 }
193 }
231 },
194 },
232 "prompt_number": {
195 "prompt_number": {
233 "description": "The code cell's prompt number. Will be null if the cell has not been run.",
196 "description": "The code cell's prompt number. Will be null if the cell has not been run.",
234 "type": ["integer", "null"],
197 "type": ["integer", "null"],
235 "required": true,
198 "required": true,
236 "minimum": 0
199 "minimum": 0
237 }
200 }
238 }
201 }
239 },
202 },
240
203
241 "execute_output": {
204 "execute_output": {
242 "description": "Result of executing a code cell.",
205 "description": "Result of executing a code cell.",
243 "type": "object",
206 "type": "object",
244 "additionalProperties": false,
207 "additionalProperties": false,
245 "properties": {
208 "properties": {
246 "output_type": {
209 "output_type": {
247 "description": "Type of cell output.",
210 "description": "Type of cell output.",
248 "enum": ["execute_output", "display_data"],
211 "enum": ["execute_output"],
249 "required": true
212 "required": true
250 },
213 },
251 "metadata": {
214 "metadata": {"$ref": "/definitions/misc/output_metadata"},
252 "description": "Cell output metadata.",
215 "prompt_number": {"$ref": "/definitions/misc/prompt_number"}
253 "type": "object",
216 },
254 "required": true,
217 "patternProperties": {"$ref": "/definitions/misc/mimetype"}
255 "additionalProperties": true
218 },
219
220 "display_data_output": {
221 "description": "Data displayed as a result of code cell execution.",
222 "type": "object",
223 "additionalProperties": false,
224 "properties": {
225 "output_type": {
226 "description": "Type of cell output.",
227 "enum": ["display_data"],
228 "required": true
256 },
229 },
257 "prompt_number": {
230 "metadata": {"$ref": "/definitions/misc/output_metadata"}
258 "description": "The code cell's prompt number. Will be null if the cell has not been run.",
259 "type": ["integer", "null"],
260 "required": false,
261 "minimum": 0
262 }
263 },
231 },
264 "patternProperties": {
232 "patternProperties": {"$ref": "/definitions/misc/mimetype"}
265 "^[a-zA-Z0-9+-]+/[a-zA-Z0-9+-]+$": {
266 "description": "The cell's mimetype output (e.g. text/plain), represented as either an array of strings or a string.",
267 "type": ["string", "array"],
268 "required": false
269 }
270 }
271 },
233 },
272
234
273 "stream_output": {
235 "stream_output": {
274 "description": "Stream output from a code cell.",
236 "description": "Stream output from a code cell.",
275 "type": "object",
237 "type": "object",
276 "additionalProperties": false,
238 "additionalProperties": false,
277 "properties": {
239 "properties": {
278 "output_type": {
240 "output_type": {
279 "description": "Type of cell output.",
241 "description": "Type of cell output.",
280 "enum": ["stream"],
242 "enum": ["stream"],
281 "required": true
243 "required": true
282 },
244 },
283 "metadata": {
245 "metadata": {"$ref": "/definitions/misc/output_metadata"},
284 "description": "Cell output metadata.",
285 "type": "object",
286 "required": true,
287 "additionalProperties": true
288 },
289 "stream": {
246 "stream": {
290 "description": "The stream type/destination.",
247 "description": "The stream type/destination.",
291 "type": "string",
248 "type": "string",
292 "required": true
249 "required": true
293 },
250 },
294 "text/plain": {
251 "text/plain": {
295 "description": "The stream's text output, represented as an array of strings.",
252 "description": "The stream's text output, represented as an array of strings.",
296 "type": "array",
253 "type": "array",
297 "required": false,
254 "required": false,
298 "items": {"type": "string"}
255 "items": {"type": "string"}
299 }
256 }
300 }
257 }
301 },
258 },
302
259
303 "error_output": {
260 "error_output": {
304 "description": "Output of an error that occurred during code cell execution.",
261 "description": "Output of an error that occurred during code cell execution.",
305 "type": "object",
262 "type": "object",
306 "additionalProperties": false,
263 "additionalProperties": false,
307 "properties": {
264 "properties": {
308 "output_type": {
265 "output_type": {
309 "description": "Type of cell output.",
266 "description": "Type of cell output.",
310 "enum": ["error"],
267 "enum": ["error"],
311 "required": true
268 "required": true
312 },
269 },
313 "metadata": {
270 "metadata": {"$ref": "/definitions/misc/output_metadata"},
314 "description": "Cell output metadata.",
315 "type": "object",
316 "required": true,
317 "additionalProperties": true
318 },
319 "ename": {
271 "ename": {
320 "description": "The name of the error.",
272 "description": "The name of the error.",
321 "type": "string",
273 "type": "string",
322 "required": true
274 "required": true
323 },
275 },
324 "evalue": {
276 "evalue": {
325 "description": "The value, or message, of the error.",
277 "description": "The value, or message, of the error.",
326 "type": "string",
278 "type": "string",
327 "required": true
279 "required": true
328 },
280 },
329 "traceback": {
281 "traceback": {
330 "description": "The error's traceback, represented as an array of strings.",
282 "description": "The error's traceback, represented as an array of strings.",
331 "type": "array",
283 "type": "array",
332 "required": true,
284 "required": true,
333 "items": {"type": "string"}
285 "items": {"type": "string"}
334 }
286 }
335 }
287 }
288 },
289
290 "misc": {
291 "metadata_name": {
292 "description": "The cell's name. If present, must be a non-empty string.",
293 "type": "string",
294 "required": false,
295 "pattern": "^.+$"
296 },
297 "metadata_tags": {
298 "description": "The cell's tags. Tags must be unique, and must not contain commas.",
299 "type": "array",
300 "required": false,
301 "uniqueItems": true,
302 "items": {
303 "type": "string",
304 "pattern": "^[^,]+$"
305 }
306 },
307 "source": {
308 "description": "Contents of the cell, represented as an array of lines.",
309 "type": "array",
310 "required": true,
311 "items": {"type": "string"}
312 },
313 "prompt_number": {
314 "description": "The code cell's prompt number. Will be null if the cell has not been run.",
315 "type": ["integer", "null"],
316 "required": true,
317 "minimum": 0
318 },
319 "mimetype": {
320 "^[a-zA-Z0-9+-]+/[a-zA-Z0-9+-]+$": {
321 "description": "The cell's mimetype output (e.g. text/plain), represented as either an array of strings or a string.",
322 "type": ["string", "array"],
323 "required": false
324 }
325 },
326 "output_metadata": {
327 "description": "Cell output metadata.",
328 "type": "object",
329 "required": true,
330 "additionalProperties": true
331 }
336 }
332 }
337 }
333 }
338 }
334 }
General Comments 0
You need to be logged in to leave comments. Login now