UNPKG

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