@stencila/schema
Version:
Stencila schema and other specifications
85 lines (84 loc) • 2.27 kB
JSON
{
"title": "Code",
"@id": "stencila:Code",
"extends": "Entity",
"role": "base",
"status": "stable",
"category": "code",
"description": "Base type for code nodes e.g. `CodeBlock`, `CodeExpression`.",
"properties": {
"type": {
"@id": "schema:type",
"description": "The name of the type.",
"type": "string",
"enum": [
"Code",
"CodeBlock",
"CodeChunk",
"CodeExpression",
"CodeFragment"
],
"default": "Code",
"from": "Entity"
},
"id": {
"@id": "schema:id",
"description": "The identifier for this item.",
"type": "string",
"from": "Entity"
},
"meta": {
"@id": "stencila:meta",
"description": "Metadata associated with this item.",
"type": "object",
"from": "Entity"
},
"programmingLanguage": {
"@id": "schema:programmingLanguage",
"description": "The programming language of the code.",
"type": "string",
"from": "Code"
},
"format": {
"@id": "schema:encodingFormat",
"aliases": [
"encoding",
"encodingFormat"
],
"description": "Media type, typically expressed using a MIME format, of the code.",
"$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",
"type": "string",
"from": "Code"
},
"text": {
"@id": "schema:text",
"description": "The text of the code.",
"type": "string",
"from": "Code"
}
},
"required": [
"type",
"text"
],
"file": "Code.schema.yaml",
"children": [
"CodeBlock",
"CodeFragment"
],
"descendants": [
"CodeBlock",
"CodeChunk",
"CodeExpression",
"CodeFragment"
],
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schema.stenci.la/v0/Code.schema.json",
"source": "https://github.com/stencila/schema/blob/master/Code.schema.yaml",
"type": "object",
"propertyAliases": {
"encoding": "format",
"encodingFormat": "format"
},
"additionalProperties": false
}