1 | {
|
2 | "title": "CodeExecutable",
|
3 | "@id": "stencila:CodeExecutable",
|
4 | "extends": "Code",
|
5 | "role": "base",
|
6 | "status": "stable",
|
7 | "category": "code",
|
8 | "description": "Base type for executable code nodes (i.e. `CodeChunk` and `CodeExpression`).",
|
9 | "$comment": "Adds properties to the base `Code` node type that are necessary, or useful, for executable code.\nAlso makes the `programmingLanguage` property required since that is necessary to be able to execute it.\n",
|
10 | "properties": {
|
11 | "type": {
|
12 | "@id": "schema:type",
|
13 | "description": "The name of the type.",
|
14 | "type": "string",
|
15 | "enum": [
|
16 | "CodeExecutable",
|
17 | "CodeChunk",
|
18 | "CodeExpression"
|
19 | ],
|
20 | "default": "CodeExecutable",
|
21 | "from": "Entity"
|
22 | },
|
23 | "id": {
|
24 | "@id": "schema:id",
|
25 | "description": "The identifier for this item.",
|
26 | "type": "string",
|
27 | "from": "Entity"
|
28 | },
|
29 | "meta": {
|
30 | "@id": "stencila:meta",
|
31 | "description": "Metadata associated with this item.",
|
32 | "type": "object",
|
33 | "from": "Entity"
|
34 | },
|
35 | "text": {
|
36 | "@id": "schema:text",
|
37 | "description": "The text of the code.",
|
38 | "type": "string",
|
39 | "from": "Code"
|
40 | },
|
41 | "programmingLanguage": {
|
42 | "@id": "schema:programmingLanguage",
|
43 | "description": "The programming language of the code.",
|
44 | "type": "string",
|
45 | "from": "Code",
|
46 | "isOverride": true
|
47 | },
|
48 | "mediaType": {
|
49 | "@id": "schema:encodingFormat",
|
50 | "aliases": [
|
51 | "encodingFormat"
|
52 | ],
|
53 | "description": "Media type, typically expressed using a MIME format, of the code.",
|
54 | "$comment": "This property allows the differentiation of formats using the same programming language\nor variants of a programming language. An example is using `programmingLanguage` \"json\" and\n`encodingFormat` \"application/ld+json\" for JSON-LD code examples.\n",
|
55 | "type": "string",
|
56 | "from": "Code"
|
57 | },
|
58 | "compileDigest": {
|
59 | "@id": "stencila:compileDigest",
|
60 | "description": "The SHA-256 digest of the `text`, `programmingLanguage` and `mediaType` properties the last time the node was compiled.",
|
61 | "type": "string",
|
62 | "$comment": "Used to determine whether it is necessary to re-compile the node (i.e. to semantically analyse it\nfor dependencies).\n",
|
63 | "from": "CodeExecutable"
|
64 | },
|
65 | "executeDigest": {
|
66 | "@id": "stencila:executeDigest",
|
67 | "description": "The SHA-256 digest of `compileDigest` and the `executeDigest`s of all dependencies, the last time the node was executed.",
|
68 | "type": "string",
|
69 | "$comment": "Used to determine whether it is necessary to re-execute the code.\n",
|
70 | "from": "CodeExecutable"
|
71 | },
|
72 | "errors": {
|
73 | "@id": "stencila:errors",
|
74 | "description": "Errors when compiling (e.g. syntax errors) or executing the chunk.",
|
75 | "type": "array",
|
76 | "items": {
|
77 | "$ref": "CodeError.schema.json"
|
78 | },
|
79 | "from": "CodeExecutable",
|
80 | "isArray": true,
|
81 | "isPlural": true,
|
82 | "aliases": [
|
83 | "error"
|
84 | ]
|
85 | },
|
86 | "duration": {
|
87 | "@id": "stencila:duration",
|
88 | "description": "Duration in seconds of the last execution of the code.",
|
89 | "type": "number",
|
90 | "minimum": 0,
|
91 | "from": "CodeExecutable"
|
92 | }
|
93 | },
|
94 | "required": [
|
95 | "type",
|
96 | "text",
|
97 | "programmingLanguage"
|
98 | ],
|
99 | "file": "CodeExecutable.schema.yaml",
|
100 | "children": [
|
101 | "CodeChunk",
|
102 | "CodeExpression"
|
103 | ],
|
104 | "descendants": [
|
105 | "CodeChunk",
|
106 | "CodeExpression"
|
107 | ],
|
108 | "$schema": "http://json-schema.org/draft-07/schema#",
|
109 | "$id": "https://schema.stenci.la/v1/CodeExecutable.schema.json",
|
110 | "source": "https://github.com/stencila/schema/blob/master/schema/CodeExecutable.schema.yaml",
|
111 | "type": "object",
|
112 | "propertyAliases": {
|
113 | "encodingFormat": "mediaType",
|
114 | "error": "errors"
|
115 | },
|
116 | "additionalProperties": false
|
117 | }
|