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