UNPKG

2.63 kBJSONView Raw
1{
2 "title": "Code",
3 "@id": "stencila:Code",
4 "extends": "Entity",
5 "role": "base",
6 "status": "stable",
7 "category": "code",
8 "description": "Base type for non-executable (e.g. `CodeBlock`) and executable (e.g. `CodeExpression`) code nodes.",
9 "$comment": "The most important, and only required, property of a `Code` node is `text`, a `string` of the source code.\nThere are no restrictions on the length or content of `text` and it is possible for it to be syntactically\ninvalid for the specified `programmingLanguage`.\n",
10 "properties": {
11 "type": {
12 "@id": "schema:type",
13 "description": "The name of the type.",
14 "type": "string",
15 "enum": [
16 "Code",
17 "CodeBlock",
18 "CodeChunk",
19 "CodeExecutable",
20 "CodeExpression",
21 "CodeFragment"
22 ],
23 "default": "Code",
24 "from": "Entity"
25 },
26 "id": {
27 "@id": "schema:id",
28 "description": "The identifier for this item.",
29 "type": "string",
30 "from": "Entity"
31 },
32 "meta": {
33 "@id": "stencila:meta",
34 "description": "Metadata associated with this item.",
35 "type": "object",
36 "from": "Entity"
37 },
38 "text": {
39 "@id": "schema:text",
40 "description": "The text of the code.",
41 "type": "string",
42 "from": "Code"
43 },
44 "programmingLanguage": {
45 "@id": "schema:programmingLanguage",
46 "description": "The programming language of the code.",
47 "type": "string",
48 "from": "Code"
49 },
50 "mediaType": {
51 "@id": "schema:encodingFormat",
52 "aliases": [
53 "encodingFormat"
54 ],
55 "description": "Media type, typically expressed using a MIME format, of the code.",
56 "$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",
57 "type": "string",
58 "from": "Code"
59 }
60 },
61 "required": [
62 "type",
63 "text"
64 ],
65 "file": "Code.schema.yaml",
66 "children": [
67 "CodeBlock",
68 "CodeExecutable",
69 "CodeFragment"
70 ],
71 "descendants": [
72 "CodeBlock",
73 "CodeChunk",
74 "CodeExecutable",
75 "CodeExpression",
76 "CodeFragment"
77 ],
78 "$schema": "http://json-schema.org/draft-07/schema#",
79 "$id": "https://schema.stenci.la/v1/Code.schema.json",
80 "source": "https://github.com/stencila/schema/blob/master/schema/Code.schema.yaml",
81 "type": "object",
82 "propertyAliases": {
83 "encodingFormat": "mediaType"
84 },
85 "additionalProperties": false
86}