nbformat.v4.schema.json
375 lines
| 14.5 KiB
| application/json
|
JsonLexer
MinRK
|
r18569 | { | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||||
"description": "IPython Notebook v4.0 JSON schema.", | ||||
"type": "object", | ||||
"additionalProperties": false, | ||||
"required": ["metadata", "nbformat_minor", "nbformat", "cells"], | ||||
"properties": { | ||||
"metadata": { | ||||
"description": "Notebook root-level metadata.", | ||||
"type": "object", | ||||
"additionalProperties": true, | ||||
"properties": { | ||||
Min RK
|
r19045 | "kernelspec": { | ||
MinRK
|
r18569 | "description": "Kernel information.", | ||
"type": "object", | ||||
Min RK
|
r19045 | "required": ["name", "display_name"], | ||
MinRK
|
r18569 | "properties": { | ||
"name": { | ||||
"description": "Name of the kernel specification.", | ||||
"type": "string" | ||||
}, | ||||
Min RK
|
r19045 | "display_name": { | ||
"description": "Name to display in UI.", | ||||
MinRK
|
r18569 | "type": "string" | ||
} | ||||
} | ||||
}, | ||||
Min RK
|
r19045 | "language_info": { | ||
"description": "Kernel information.", | ||||
"type": "object", | ||||
"required": ["name"], | ||||
"properties": { | ||||
"name": { | ||||
"description": "The programming language which this kernel runs.", | ||||
"type": "string" | ||||
}, | ||||
"codemirror_mode": { | ||||
"description": "The codemirror mode to use for code in this language.", | ||||
Min RK
|
r19049 | "oneOf": [ | ||
{"type": "string"}, | ||||
{"type": "object"} | ||||
] | ||||
Min RK
|
r19045 | }, | ||
"file_extension": { | ||||
"description": "The file extension for files in this language.", | ||||
"type": "string" | ||||
}, | ||||
"mimetype": { | ||||
"description": "The mimetype corresponding to files in this language.", | ||||
"type": "string" | ||||
}, | ||||
"pygments_lexer": { | ||||
"description": "The pygments lexer to use for code in this language.", | ||||
"type": "string" | ||||
} | ||||
} | ||||
}, | ||||
MinRK
|
r18569 | "signature": { | ||
"description": "Hash of the notebook.", | ||||
"type": "string" | ||||
}, | ||||
"orig_nbformat": { | ||||
MinRK
|
r18581 | "description": "Original notebook format (major number) before converting the notebook between versions. This should never be written to a file.", | ||
MinRK
|
r18569 | "type": "integer", | ||
"minimum": 1 | ||||
} | ||||
} | ||||
}, | ||||
"nbformat_minor": { | ||||
"description": "Notebook format (minor number). Incremented for backward compatible changes to the notebook format.", | ||||
"type": "integer", | ||||
"minimum": 0 | ||||
}, | ||||
"nbformat": { | ||||
"description": "Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.", | ||||
"type": "integer", | ||||
"minimum": 4, | ||||
"maximum": 4 | ||||
}, | ||||
"cells": { | ||||
"description": "Array of cells of the current notebook.", | ||||
"type": "array", | ||||
Min RK
|
r18998 | "items": {"$ref": "#/definitions/cell"} | ||
MinRK
|
r18569 | } | ||
}, | ||||
"definitions": { | ||||
Min RK
|
r18998 | "cell": { | ||
"type": "object", | ||||
"oneOf": [ | ||||
{"$ref": "#/definitions/raw_cell"}, | ||||
{"$ref": "#/definitions/markdown_cell"}, | ||||
{"$ref": "#/definitions/code_cell"} | ||||
] | ||||
}, | ||||
MinRK
|
r18569 | |||
"raw_cell": { | ||||
"description": "Notebook raw nbconvert cell.", | ||||
"type": "object", | ||||
"additionalProperties": false, | ||||
MinRK
|
r18571 | "required": ["cell_type", "metadata", "source"], | ||
MinRK
|
r18569 | "properties": { | ||
"cell_type": { | ||||
"description": "String identifying the type of cell.", | ||||
"enum": ["raw"] | ||||
}, | ||||
"metadata": { | ||||
"description": "Cell-level metadata.", | ||||
"type": "object", | ||||
"additionalProperties": true, | ||||
"properties": { | ||||
"format": { | ||||
"description": "Raw cell metadata format for nbconvert.", | ||||
"type": "string" | ||||
}, | ||||
"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, | ||||
MinRK
|
r18571 | "required": ["cell_type", "metadata", "source"], | ||
MinRK
|
r18569 | "properties": { | ||
"cell_type": { | ||||
"description": "String identifying the type of cell.", | ||||
"enum": ["markdown"] | ||||
}, | ||||
"metadata": { | ||||
"description": "Cell-level metadata.", | ||||
"type": "object", | ||||
"properties": { | ||||
"name": {"$ref": "#/definitions/misc/metadata_name"}, | ||||
"tags": {"$ref": "#/definitions/misc/metadata_tags"} | ||||
}, | ||||
"additionalProperties": true | ||||
}, | ||||
"source": {"$ref": "#/definitions/misc/source"} | ||||
} | ||||
}, | ||||
"code_cell": { | ||||
"description": "Notebook code cell.", | ||||
"type": "object", | ||||
"additionalProperties": false, | ||||
MinRK
|
r18587 | "required": ["cell_type", "metadata", "source", "outputs", "execution_count"], | ||
MinRK
|
r18569 | "properties": { | ||
"cell_type": { | ||||
"description": "String identifying the type of cell.", | ||||
"enum": ["code"] | ||||
}, | ||||
"metadata": { | ||||
"description": "Cell-level metadata.", | ||||
"type": "object", | ||||
"additionalProperties": true, | ||||
"properties": { | ||||
"collapsed": { | ||||
"description": "Whether the cell is collapsed/expanded.", | ||||
"type": "boolean" | ||||
}, | ||||
"autoscroll": { | ||||
"description": "Whether the cell's output is scrolled, unscrolled, or autoscrolled.", | ||||
"enum": [true, false, "auto"] | ||||
}, | ||||
"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", | ||||
MinRK
|
r18570 | "items": {"$ref": "#/definitions/output"} | ||
MinRK
|
r18569 | }, | ||
MinRK
|
r18587 | "execution_count": { | ||
MinRK
|
r18569 | "description": "The code cell's prompt number. Will be null if the cell has not been run.", | ||
"type": ["integer", "null"], | ||||
"minimum": 0 | ||||
} | ||||
} | ||||
}, | ||||
Min RK
|
r18998 | |||
"unrecognized_cell": { | ||||
"description": "Unrecognized cell from a future minor-revision to the notebook format.", | ||||
"type": "object", | ||||
"additionalProperties": true, | ||||
"required": ["cell_type", "metadata"], | ||||
"properties": { | ||||
"cell_type": { | ||||
"description": "String identifying the type of cell.", | ||||
"not" : { | ||||
"enum": ["markdown", "code", "raw"] | ||||
} | ||||
}, | ||||
"metadata": { | ||||
"description": "Cell-level metadata.", | ||||
"type": "object", | ||||
"properties": { | ||||
"name": {"$ref": "#/definitions/misc/metadata_name"}, | ||||
"tags": {"$ref": "#/definitions/misc/metadata_tags"} | ||||
}, | ||||
"additionalProperties": true | ||||
} | ||||
} | ||||
}, | ||||
MinRK
|
r18570 | "output": { | ||
"type": "object", | ||||
"oneOf": [ | ||||
{"$ref": "#/definitions/execute_result"}, | ||||
{"$ref": "#/definitions/display_data"}, | ||||
{"$ref": "#/definitions/stream"}, | ||||
{"$ref": "#/definitions/error"} | ||||
] | ||||
}, | ||||
MinRK
|
r18589 | |||
MinRK
|
r18569 | "execute_result": { | ||
"description": "Result of executing a code cell.", | ||||
"type": "object", | ||||
"additionalProperties": false, | ||||
MinRK
|
r18589 | "required": ["output_type", "data", "metadata", "execution_count"], | ||
MinRK
|
r18569 | "properties": { | ||
"output_type": { | ||||
"description": "Type of cell output.", | ||||
"enum": ["execute_result"] | ||||
}, | ||||
MinRK
|
r18587 | "execution_count": { | ||
MinRK
|
r18569 | "description": "A result's prompt number.", | ||
MinRK
|
r18587 | "type": ["integer", "null"], | ||
MinRK
|
r18569 | "minimum": 0 | ||
}, | ||||
MinRK
|
r18589 | "data": {"$ref": "#/definitions/misc/mimebundle"}, | ||
MinRK
|
r18570 | "metadata": {"$ref": "#/definitions/misc/output_metadata"} | ||
MinRK
|
r18569 | } | ||
}, | ||||
MinRK
|
r18570 | "display_data": { | ||
MinRK
|
r18569 | "description": "Data displayed as a result of code cell execution.", | ||
"type": "object", | ||||
"additionalProperties": false, | ||||
MinRK
|
r18589 | "required": ["output_type", "data", "metadata"], | ||
MinRK
|
r18569 | "properties": { | ||
"output_type": { | ||||
"description": "Type of cell output.", | ||||
"enum": ["display_data"] | ||||
}, | ||||
MinRK
|
r18589 | "data": {"$ref": "#/definitions/misc/mimebundle"}, | ||
MinRK
|
r18569 | "metadata": {"$ref": "#/definitions/misc/output_metadata"} | ||
} | ||||
}, | ||||
MinRK
|
r18570 | "stream": { | ||
MinRK
|
r18569 | "description": "Stream output from a code cell.", | ||
"type": "object", | ||||
"additionalProperties": false, | ||||
MinRK
|
r18590 | "required": ["output_type", "name", "text"], | ||
MinRK
|
r18569 | "properties": { | ||
"output_type": { | ||||
"description": "Type of cell output.", | ||||
"enum": ["stream"] | ||||
}, | ||||
MinRK
|
r18576 | "name": { | ||
"description": "The name of the stream (stdout, stderr).", | ||||
MinRK
|
r18569 | "type": "string" | ||
}, | ||||
"text": { | ||||
"description": "The stream's text output, represented as an array of strings.", | ||||
"$ref": "#/definitions/misc/multiline_string" | ||||
} | ||||
} | ||||
}, | ||||
MinRK
|
r18570 | "error": { | ||
MinRK
|
r18569 | "description": "Output of an error that occurred during code cell execution.", | ||
"type": "object", | ||||
"additionalProperties": false, | ||||
MinRK
|
r18590 | "required": ["output_type", "ename", "evalue", "traceback"], | ||
MinRK
|
r18569 | "properties": { | ||
"output_type": { | ||||
"description": "Type of cell output.", | ||||
"enum": ["error"] | ||||
}, | ||||
"ename": { | ||||
"description": "The name of the error.", | ||||
"type": "string" | ||||
}, | ||||
"evalue": { | ||||
"description": "The value, or message, of the error.", | ||||
"type": "string" | ||||
}, | ||||
"traceback": { | ||||
"description": "The error's traceback, represented as an array of strings.", | ||||
"type": "array", | ||||
"items": {"type": "string"} | ||||
} | ||||
} | ||||
}, | ||||
Min RK
|
r18998 | "unrecognized_output": { | ||
"description": "Unrecognized output from a future minor-revision to the notebook format.", | ||||
"type": "object", | ||||
"additionalProperties": true, | ||||
"required": ["output_type"], | ||||
"properties": { | ||||
"output_type": { | ||||
"description": "Type of cell output.", | ||||
"not": { | ||||
"enum": ["execute_result", "display_data", "stream", "error"] | ||||
} | ||||
} | ||||
} | ||||
}, | ||||
MinRK
|
r18569 | "misc": { | ||
"metadata_name": { | ||||
"description": "The cell's name. If present, must be a non-empty string.", | ||||
"type": "string", | ||||
"pattern": "^.+$" | ||||
}, | ||||
"metadata_tags": { | ||||
"description": "The cell's tags. Tags must be unique, and must not contain commas.", | ||||
"type": "array", | ||||
"uniqueItems": true, | ||||
"items": { | ||||
"type": "string", | ||||
"pattern": "^[^,]+$" | ||||
} | ||||
}, | ||||
"source": { | ||||
"description": "Contents of the cell, represented as an array of lines.", | ||||
"$ref": "#/definitions/misc/multiline_string" | ||||
}, | ||||
MinRK
|
r18587 | "execution_count": { | ||
MinRK
|
r18569 | "description": "The code cell's prompt number. Will be null if the cell has not been run.", | ||
"type": ["integer", "null"], | ||||
"minimum": 0 | ||||
}, | ||||
MinRK
|
r18589 | "mimebundle": { | ||
"description": "A mime-type keyed dictionary of data", | ||||
"type": "object", | ||||
"additionalProperties": false, | ||||
"properties": { | ||||
"application/json": { | ||||
"type": "object" | ||||
} | ||||
}, | ||||
MinRK
|
r18569 | "patternProperties": { | ||
MinRK
|
r18589 | "^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$": { | ||
"description": "mimetype output (e.g. text/plain), represented as either an array of strings or a string.", | ||||
MinRK
|
r18569 | "$ref": "#/definitions/misc/multiline_string" | ||
} | ||||
} | ||||
}, | ||||
"output_metadata": { | ||||
"description": "Cell output metadata.", | ||||
"type": "object", | ||||
"additionalProperties": true | ||||
}, | ||||
"multiline_string": { | ||||
"oneOf" : [ | ||||
{"type": "string"}, | ||||
{ | ||||
"type": "array", | ||||
"items": {"type": "string"} | ||||
} | ||||
] | ||||
} | ||||
} | ||||
} | ||||
} | ||||