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 code nodes e.g. `CodeBlock`, `CodeExpression`.",
|
9 | "properties": {
|
10 | "type": {
|
11 | "@id": "schema:type",
|
12 | "description": "The name of the type.",
|
13 | "type": "string",
|
14 | "enum": [
|
15 | "Code",
|
16 | "CodeBlock",
|
17 | "CodeChunk",
|
18 | "CodeExpression",
|
19 | "CodeFragment"
|
20 | ],
|
21 | "default": "Code",
|
22 | "from": "Entity"
|
23 | },
|
24 | "id": {
|
25 | "@id": "schema:id",
|
26 | "description": "The identifier for this item.",
|
27 | "type": "string",
|
28 | "from": "Entity"
|
29 | },
|
30 | "meta": {
|
31 | "@id": "stencila:meta",
|
32 | "description": "Metadata associated with this item.",
|
33 | "type": "object",
|
34 | "from": "Entity"
|
35 | },
|
36 | "programmingLanguage": {
|
37 | "@id": "schema:programmingLanguage",
|
38 | "description": "The programming language of the code.",
|
39 | "type": "string",
|
40 | "from": "Code"
|
41 | },
|
42 | "format": {
|
43 | "@id": "schema:encodingFormat",
|
44 | "aliases": [
|
45 | "encoding",
|
46 | "encodingFormat"
|
47 | ],
|
48 | "description": "Media type, typically expressed using a MIME format, of the code.",
|
49 | "$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",
|
50 | "type": "string",
|
51 | "from": "Code"
|
52 | },
|
53 | "text": {
|
54 | "@id": "schema:text",
|
55 | "description": "The text of the code.",
|
56 | "type": "string",
|
57 | "from": "Code"
|
58 | }
|
59 | },
|
60 | "required": [
|
61 | "type",
|
62 | "text"
|
63 | ],
|
64 | "file": "Code.schema.yaml",
|
65 | "children": [
|
66 | "CodeBlock",
|
67 | "CodeFragment"
|
68 | ],
|
69 | "descendants": [
|
70 | "CodeBlock",
|
71 | "CodeChunk",
|
72 | "CodeExpression",
|
73 | "CodeFragment"
|
74 | ],
|
75 | "$schema": "http://json-schema.org/draft-07/schema#",
|
76 | "$id": "https://schema.stenci.la/v0/Code.schema.json",
|
77 | "source": "https://github.com/stencila/schema/blob/master/Code.schema.yaml",
|
78 | "type": "object",
|
79 | "propertyAliases": {
|
80 | "encoding": "format",
|
81 | "encodingFormat": "format"
|
82 | },
|
83 | "additionalProperties": false
|
84 | }
|