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