##// END OF EJS Templates
Conform better to JSON schema version 3
Jessica B. Hamrick -
Show More
@@ -1,156 +1,171 b''
1 {
1 {
2 "description": "custom json structure with references to generate notebook schema",
2 "$schema": "http://json-schema.org/draft-03/schema#",
3 "notebook": {
3 "description": "IPython Notebook v4.0 JSON schema.",
4 "type": "object",
4 "type": "object",
5 "description": "notebook v4.0 root schema",
6 "$schema": "http://json-schema.org/draft-03/schema",
7 "id": "#notebook",
8 "required": true,
9 "additionalProperties": false,
5 "additionalProperties": false,
10 "properties": {
6 "properties": {
11 "metadata": {
7 "metadata": {
8 "description": "Notebook root-level metadata.",
12 "type": "object",
9 "type": "object",
13 "id": "metadata",
14 "required": true,
10 "required": true,
15 "description": "the metadata atribute can contain any additionnal information",
16 "additionalProperties": true,
11 "additionalProperties": true,
17 "properties": {
12 "properties": {
18 "language": {
13 "language": {
14 "description": "Language of the notebook's kernel.",
19 "type": "string",
15 "type": "string",
20 "required": true
16 "required": true
21 },
17 },
22 "kernel_info": {
18 "kernel_info": {
19 "description": "Other kernel information, to be determined."
23 "type": "object",
20 "type": "object",
24 "required": true,
21 "required": true,
25 "description": "kernel information, to be determined"
22 "additionalProperties": true
26 }
23 }
27 }
24 }
28 },
25 },
29 "nbformat_minor": {
26 "nbformat_minor": {
30 "description": "Notebook format, minor number. Incremented for slight variation of notebook format.",
27 "description": "Notebook format (minor number). Incremented for slight changes to the notebook format.",
31 "type": "integer",
28 "type": "integer",
32 "minimum": 0,
29 "required": true,
33 "id": "nbformat_minor",
30 "minimum": 0
34 "required": true
35 },
31 },
36 "nbformat": {
32 "nbformat": {
37 "description": "Notebook format, major number. Incremented between backward incompatible change is introduced.",
33 "description": "Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.",
38 "type": "integer",
34 "type": "integer",
39 "minimum": 4,
35 "required": true,
40 "id": "nbformat",
36 "minimum": 4
41 "required": true
42 },
37 },
43 "orig_nbformat": {
38 "orig_nbformat": {
44 "description": "Original notebook format, major number.",
39 "description": "Original notebook format (major number) before converting the notebook between versions.",
45 "type": "integer",
40 "type": "integer",
46 "minimum": 1,
41 "required": false,
47 "id": "orig_nbformat",
42 "minimum": 1
48 "required": false
49 },
43 },
50 "cells": {
44 "cells": {
51 "$schema": "http://json-schema.org/draft-03/schema",
52 "description": "array of cells of the current notebook",
45 "description": "array of cells of the current notebook",
53 "type": "array",
46 "type": "array",
54 "id": "#cells",
55 "required": true,
47 "required": true,
56 "items": {"$ref": "/any_cell"}
48 "items": {
49 "type": [
50 {"$ref": "#/definitions/text_cell"},
51 {"$ref": "#/definitions/heading_cell"},
52 {"$ref": "#/definitions/code_cell"}
53 ]
57 }
54 }
58 }
55 }
59 },
56 },
60
57
58 "definitions": {
59
61 "text_cell": {
60 "text_cell": {
61 "description": "Notebook text cell",
62 "type": "object",
62 "type": "object",
63 "description": "scheme for text cel and childrenm (level only optionnal argument for HEader cell)",
64 "$schema": "http://json-schema.org/draft-03/schema",
65 "id": "#cell",
66 "required": true,
67 "additionalProperties": false,
63 "additionalProperties": false,
68 "properties": {
64 "properties": {
69 "cell_type": {
65 "cell_type": {
70 "type": "string",
66 "description": "String identifying the type of cell",
71 "id": "cell_type",
67 "enum": ["markdown", "raw"],
72 "required": true
68 "required": true
73 },
69 },
74 "level": {
75 "type": "integer",
76 "minimum": 1,
77 "maximum": 6,
78 "id": "level",
79 "required": false
80 },
81 "metadata": {
70 "metadata": {
71 "description": "Cell-level metadata",
82 "type": "object",
72 "type": "object",
83 "id": "metadata",
73 "required": true,
84 "required": false
74 "additionalProperties": true
85 },
75 },
86 "source": {
76 "source": {
87 "description": "source text of the cell",
77 "description": "Contents of the cell, represented as an array of lines (each terminated by \n)",
88 "type": "array",
78 "type": "array",
89 "id": "source",
90 "required": true,
79 "required": true,
91 "items": {
80 "items": {
92 "type": "string",
81 "type": "string",
93 "description": "each item represents one line of cell, terminated by \n",
82 "pattern": "^.*\n$"
94 "required": true
95 }
83 }
96 }
84 }
97 }
85 }
98
99 },
86 },
100
87
101 "any_cell": {
88 "heading_cell": {
102 "description": "Meta cell type that match any cell type",
89 "description": "Notebook heading cell",
103 "type": [{"$ref": "/text_cell"}, {"$ref":"/code_cell"}],
104 "$schema": "http://json-schema.org/draft-03/schema"
105 },
106
107 "code_cell": {
108 "type": "object",
90 "type": "object",
109 "$schema": "http://json-schema.org/draft-03/schema",
110 "description": "Cell used to execute code",
111 "id": "#cell",
112 "required": true,
113 "additionalProperties": false,
91 "additionalProperties": false,
114 "properties": {
92 "properties": {
115 "cell_type": {
93 "cell_type": {
116 "type": "string",
94 "description": "String identifying the type of cell",
117 "id": "cell_type",
95 "enum": ["heading"],
118 "required": true
96 "required": true
119 },
97 },
120 "metadata": {
98 "metadata": {
99 "description": "Cell-level metadata",
121 "type": "object",
100 "type": "object",
122 "id": "metadata",
101 "required": true,
123 "required": false
102 "additionalProperties": true
124 },
103 },
125 "collapsed": {
104 "source": {
126 "type": "boolean",
105 "description": "Contents of the cell, represented as an array of lines (each terminated by \n)",
127 "required": true
106 "type": "array",
107 "required": true,
108 "items": {
109 "type": "string",
110 "pattern": "^.*\n$"
111 }
128 },
112 },
129 "autoscroll": {
113 "level": {
130 "type": "boolean",
114 "description": "Level of heading cells",
115 "type": "integer",
116 "required": false,
117 "minimum": 1,
118 "maximum": 6
119 }
120 }
121 },
122
123 "code_cell": {
124 "description": "Notebook code cell",
125 "type": "object",
126 "additionalProperties": false,
127 "properties": {
128 "cell_type": {
129 "description": "String identifying the type of cell",
130 "enum": ["code"],
131 "required": true
131 "required": true
132 },
132 },
133 "metadata": {
134 "description": "Cell-level metadata",
135 "type": "object",
136 "required": true,
137 "additionalProperties": true
138 },
133 "source": {
139 "source": {
134 "description": "for code cell source code",
140 "description": "Contents of the cell, represented as an array of lines (each terminated by \n)",
135 "type": "array",
141 "type": "array",
136 "id": "source",
137 "required": true,
142 "required": true,
138 "items": {
143 "items": {
139 "type": "string",
144 "type": "string",
140 "description": "each item represents one line of the source code written, terminated by \n",
145 "pattern": "^.*\n$"
141 "required": true
142 }
146 }
143 }
147 }
144 "outputs": {
148 "outputs": {
145 "description": "output for code cell, to be definied",
149 "description": "Outputs of cell, to be defined",
146 "required": true,
150 "type": "array",
147 "type": "array"
151 "required": true
152 },
153 "collapsed": {
154 "description": "Whether the cell is collapsed/expanded",
155 "type": "boolean",
156 "required": true
157 },
158 "autoscroll": {
159 "description": "Whether the cell's output should autoscroll",
160 "type": "boolean",
161 "required": true
148 },
162 },
149 "prompt_number": {
163 "prompt_number": {
150 "type": ["integer", "null"],
164 "type": ["integer", "null"],
151 "required": false,
165 "required": true,
152 "minimum": 0
166 "minimum": 0
153 }
167 }
154 }
168 }
155 }
169 }
156 }
170 }
171 }
General Comments 0
You need to be logged in to leave comments. Login now