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 | "codeDependencies": {
|
59 | "@id": "stencila:codeDependencies",
|
60 | "description": "The upstream dependencies of the code.",
|
61 | "type": "array",
|
62 | "items": {
|
63 | "anyOf": [
|
64 | {
|
65 | "$ref": "CodeChunk.schema.json"
|
66 | },
|
67 | {
|
68 | "$ref": "Parameter.schema.json"
|
69 | }
|
70 | ]
|
71 | },
|
72 | "$comment": "Note that this excludes `CodeExpression` nodes since they should not have side effects\n(e.g. assigning variables) that would cause another node to be dependent upon them.\n",
|
73 | "from": "CodeExecutable",
|
74 | "isArray": true,
|
75 | "isPlural": true,
|
76 | "aliases": [
|
77 | "codeDependencie"
|
78 | ]
|
79 | },
|
80 | "codeDependents": {
|
81 | "@id": "stencila:codeDependents",
|
82 | "description": "The downstream dependents of the code.",
|
83 | "type": "array",
|
84 | "items": {
|
85 | "anyOf": [
|
86 | {
|
87 | "$ref": "CodeChunk.schema.json"
|
88 | },
|
89 | {
|
90 | "$ref": "CodeExpression.schema.json"
|
91 | }
|
92 | ]
|
93 | },
|
94 | "$comment": "Note that in comparison to `codeDependencies`, this property does not allow for `Parameter`\ndependents (because parameters are never dependent upon others).\n",
|
95 | "from": "CodeExecutable",
|
96 | "isArray": true,
|
97 | "isPlural": true,
|
98 | "aliases": [
|
99 | "codeDependent"
|
100 | ]
|
101 | },
|
102 | "compileDigest": {
|
103 | "@id": "stencila:compileDigest",
|
104 | "description": "A digest of the content, semantics and dependencies of the node.",
|
105 | "type": "string",
|
106 | "from": "CodeExecutable"
|
107 | },
|
108 | "executeCount": {
|
109 | "@id": "stencila:executeCount",
|
110 | "description": "A count of the number of times that the node has been executed.",
|
111 | "type": "integer",
|
112 | "minimum": 0,
|
113 | "$comment": "Intended to increment with each successive execution of the node, including across sessions.\nNote that this differs to the `execution_count` in Jupyter Notebook format which is\nthe \"code cell's prompt number\" and which resets at the start of each new session.\n",
|
114 | "from": "CodeExecutable"
|
115 | },
|
116 | "executeDigest": {
|
117 | "@id": "stencila:executeDigest",
|
118 | "description": "The `compileDigest` of the node when it was last executed.",
|
119 | "type": "string",
|
120 | "from": "CodeExecutable"
|
121 | },
|
122 | "executeRequired": {
|
123 | "@id": "stencila:executeRequired",
|
124 | "description": "Whether, and why, a node requires execution or re-execution.",
|
125 | "enum": [
|
126 | "No",
|
127 | "NeverExecuted",
|
128 | "SemanticsChanged",
|
129 | "DependenciesChanged",
|
130 | "DependenciesFailed"
|
131 | ],
|
132 | "$comment": "Derived from a comparison of `compileDigest` and `executeDigest` and the `executeStatus`\nof dependencies.\n`No`: no re-execution is required, the semantics of the code and its dependencies has not changed\nsince it was last executed.\n`NeverExecuted`: execution is required because the code has never been executed (or any previous\nexecution was not persisted in its state).\n`SemanticsChanged`: re-execution is required because the semantics of the code has changed since it was\nlast executed.\n`DependenciesChanged`: the semantics of one or more dependencies (including transitive dependencies) \nchanged since it was last executed.\n`DependenciesFailed`: one or more dependencies (including transitive dependencies) failed when it was\nlast executed.\n",
|
133 | "from": "CodeExecutable"
|
134 | },
|
135 | "executeStatus": {
|
136 | "@id": "stencila:executeStatus",
|
137 | "description": "Status of the most recent, including any current, execution of the code.",
|
138 | "enum": [
|
139 | "Scheduled",
|
140 | "ScheduledPreviouslyFailed",
|
141 | "Running",
|
142 | "RunningPreviouslyFailed",
|
143 | "Succeeded",
|
144 | "Failed",
|
145 | "Cancelled"
|
146 | ],
|
147 | "from": "CodeExecutable"
|
148 | },
|
149 | "executeEnded": {
|
150 | "@id": "stencila:executeEnded",
|
151 | "description": "The date-time that the the last execution of the code ended.",
|
152 | "$ref": "Date.schema.json",
|
153 | "from": "CodeExecutable"
|
154 | },
|
155 | "executeDuration": {
|
156 | "@id": "stencila:executeDuration",
|
157 | "description": "Duration in seconds of the last execution of the code.",
|
158 | "type": "number",
|
159 | "minimum": 0,
|
160 | "from": "CodeExecutable"
|
161 | },
|
162 | "errors": {
|
163 | "@id": "stencila:errors",
|
164 | "description": "Errors when compiling (e.g. syntax errors) or executing the chunk.",
|
165 | "type": "array",
|
166 | "items": {
|
167 | "$ref": "CodeError.schema.json"
|
168 | },
|
169 | "from": "CodeExecutable",
|
170 | "isArray": true,
|
171 | "isPlural": true,
|
172 | "aliases": [
|
173 | "error"
|
174 | ]
|
175 | }
|
176 | },
|
177 | "required": [
|
178 | "type",
|
179 | "text",
|
180 | "programmingLanguage"
|
181 | ],
|
182 | "file": "CodeExecutable.schema.yaml",
|
183 | "children": [
|
184 | "CodeChunk",
|
185 | "CodeExpression"
|
186 | ],
|
187 | "descendants": [
|
188 | "CodeChunk",
|
189 | "CodeExpression"
|
190 | ],
|
191 | "$schema": "http://json-schema.org/draft-07/schema#",
|
192 | "$id": "https://schema.stenci.la/v1/CodeExecutable.schema.json",
|
193 | "source": "https://github.com/stencila/schema/blob/master/schema/CodeExecutable.schema.yaml",
|
194 | "type": "object",
|
195 | "propertyAliases": {
|
196 | "encodingFormat": "mediaType",
|
197 | "codeDependencie": "codeDependencies",
|
198 | "codeDependent": "codeDependents",
|
199 | "error": "errors"
|
200 | },
|
201 | "additionalProperties": false
|
202 | }
|