{ "$schema": "http://json-schema.org/draft-03/schema#", "description": "IPython Notebook v4.0 JSON schema.", "type": "object", "additionalProperties": false, "properties": { "metadata": { "description": "Notebook root-level metadata.", "type": "object", "required": true, "additionalProperties": true, "properties": { "kernel_info": { "description": "Kernel information.", "type": "object", "required": false, "properties": { "name": { "description": "Name of the kernel specification.", "type": "string", "required": true }, "language": { "description": "The programming language which this kernel runs.", "type": "string", "required": true }, "codemirror_mode": { "description": "The codemirror mode to use for code in this language.", "type": "string", "required": false } } }, "signature": { "description": "Hash of the notebook.", "type": "string", "required": false }, "orig_nbformat": { "description": "Original notebook format (major number) before converting the notebook between versions.", "type": "integer", "required": false, "minimum": 1 } } }, "nbformat_minor": { "description": "Notebook format (minor number). Incremented for backward compatible changes to the notebook format.", "type": "integer", "required": true, "minimum": 0 }, "nbformat": { "description": "Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.", "type": "integer", "required": true, "minimum": 4, "maximum": 4 }, "cells": { "description": "Array of cells of the current notebook.", "type": "array", "required": true, "items": { "type": [ {"$ref": "/definitions/raw_cell"}, {"$ref": "/definitions/markdown_cell"}, {"$ref": "/definitions/heading_cell"}, {"$ref": "/definitions/code_cell"} ] } } }, "definitions": { "raw_cell": { "description": "Notebook raw nbconvert cell.", "type": "object", "additionalProperties": false, "properties": { "cell_type": { "description": "String identifying the type of cell.", "enum": ["raw"], "required": true }, "metadata": { "description": "Cell-level metadata.", "type": "object", "required": true, "additionalProperties": true, "properties": { "format": { "description": "Raw cell metadata format for nbconvert.", "type": "string", "required": false }, "name": {"$ref": "/definitions/misc/metadata_name"}, "tags": {"$ref": "/definitions/misc/metadata_tags"} } }, "source": {"$ref": "/definitions/misc/source"} } }, "markdown_cell": { "description": "Notebook markdown cell.", "type": "object", "additionalProperties": false, "properties": { "cell_type": { "description": "String identifying the type of cell.", "enum": ["markdown"], "required": true }, "metadata": { "description": "Cell-level metadata.", "type": "object", "required": true, "properties": { "name": {"$ref": "/definitions/misc/metadata_name"}, "tags": {"$ref": "/definitions/misc/metadata_tags"} }, "additionalProperties": true }, "source": {"$ref": "/definitions/misc/source"} } }, "heading_cell": { "description": "Notebook heading cell.", "type": "object", "additionalProperties": false, "properties": { "cell_type": { "description": "String identifying the type of cell.", "enum": ["heading"], "required": true }, "metadata": { "description": "Cell-level metadata.", "type": "object", "required": true, "properties": { "name": {"$ref": "/definitions/misc/metadata_name"}, "tags": {"$ref": "/definitions/misc/metadata_tags"} }, "additionalProperties": true }, "source": {"$ref": "/definitions/misc/source"}, "level": { "description": "Level of heading cells.", "type": "integer", "required": true, "minimum": 1, "maximum": 6 } } }, "code_cell": { "description": "Notebook code cell.", "type": "object", "additionalProperties": false, "properties": { "cell_type": { "description": "String identifying the type of cell.", "enum": ["code"], "required": true }, "metadata": { "description": "Cell-level metadata.", "type": "object", "required": true, "additionalProperties": true, "properties": { "collapsed": { "description": "Whether the cell is collapsed/expanded.", "type": "boolean", "required": false }, "autoscroll": { "description": "Whether the cell's output is scrolled, unscrolled, or autoscrolled.", "enum": [true, false, "auto"], "required": false }, "name": {"$ref": "/definitions/misc/metadata_name"}, "tags": {"$ref": "/definitions/misc/metadata_tags"} } }, "source": {"$ref": "/definitions/misc/source"}, "outputs": { "description": "Execution, display, or stream outputs.", "type": "array", "required": true, "items": { "type": [ {"$ref": "/definitions/execute_result"}, {"$ref": "/definitions/display_data_output"}, {"$ref": "/definitions/stream_output"}, {"$ref": "/definitions/error_output"} ] } }, "prompt_number": { "description": "The code cell's prompt number. Will be null if the cell has not been run.", "type": ["integer", "null"], "required": true, "minimum": 0 } } }, "execute_result": { "description": "Result of executing a code cell.", "type": "object", "additionalProperties": false, "properties": { "output_type": { "description": "Type of cell output.", "enum": ["execute_result"], "required": true }, "metadata": {"$ref": "/definitions/misc/output_metadata"}, "prompt_number": {"$ref": "/definitions/misc/prompt_number"} }, "patternProperties": {"$ref": "/definitions/misc/mimetype"} }, "display_data_output": { "description": "Data displayed as a result of code cell execution.", "type": "object", "additionalProperties": false, "properties": { "output_type": { "description": "Type of cell output.", "enum": ["display_data"], "required": true }, "metadata": {"$ref": "/definitions/misc/output_metadata"} }, "patternProperties": {"$ref": "/definitions/misc/mimetype"} }, "stream_output": { "description": "Stream output from a code cell.", "type": "object", "additionalProperties": false, "properties": { "output_type": { "description": "Type of cell output.", "enum": ["stream"], "required": true }, "metadata": {"$ref": "/definitions/misc/output_metadata"}, "stream": { "description": "The stream type/destination.", "type": "string", "required": true }, "text/plain": { "description": "The stream's text output, represented as an array of strings.", "type": ["string", "array"], "required": false } } }, "error_output": { "description": "Output of an error that occurred during code cell execution.", "type": "object", "additionalProperties": false, "properties": { "output_type": { "description": "Type of cell output.", "enum": ["error"], "required": true }, "metadata": {"$ref": "/definitions/misc/output_metadata"}, "ename": { "description": "The name of the error.", "type": "string", "required": true }, "evalue": { "description": "The value, or message, of the error.", "type": "string", "required": true }, "traceback": { "description": "The error's traceback, represented as an array of strings.", "type": "array", "items": {"type": "string"}, "required": true } } }, "misc": { "metadata_name": { "description": "The cell's name. If present, must be a non-empty string.", "type": "string", "required": false, "pattern": "^.+$" }, "metadata_tags": { "description": "The cell's tags. Tags must be unique, and must not contain commas.", "type": "array", "required": false, "uniqueItems": true, "items": { "type": "string", "pattern": "^[^,]+$" } }, "source": { "description": "Contents of the cell, represented as an array of lines.", "type": ["string", "array"], "required": true }, "prompt_number": { "description": "The code cell's prompt number. Will be null if the cell has not been run.", "type": ["integer", "null"], "required": true, "minimum": 0 }, "mimetype": { "^[a-zA-Z0-9+-]+/[a-zA-Z0-9+-]+$": { "description": "The cell's mimetype output (e.g. text/plain), represented as either an array of strings or a string.", "type": ["string", "array"], "required": false } }, "output_metadata": { "description": "Cell output metadata.", "type": "object", "required": true, "additionalProperties": true } } } }