1 | {
|
2 | "title": "Function",
|
3 | "@id": "stencila:Function",
|
4 | "extends": "Entity",
|
5 | "role": "secondary",
|
6 | "status": "unstable",
|
7 | "category": "code",
|
8 | "description": "A function with a name, which might take Parameters and return a value of a certain type.",
|
9 | "properties": {
|
10 | "type": {
|
11 | "@id": "schema:type",
|
12 | "description": "The name of the type.",
|
13 | "type": "string",
|
14 | "enum": [
|
15 | "Function"
|
16 | ],
|
17 | "default": "Function",
|
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 | "name": {
|
33 | "@id": "schema:name",
|
34 | "description": "The name of the function.",
|
35 | "type": "string",
|
36 | "pattern": "[a-z_][A-z0-9_]*",
|
37 | "$comment": "The name property is not required; this allows for anonymous functions\n(although these are not yet implemented in Stencila interpreters).\nThe regex allows for snake_case and camelCase names but excludes\nPascalCase for parameter names.\n",
|
38 | "from": "Function"
|
39 | },
|
40 | "parameters": {
|
41 | "@id": "stencila:parameters",
|
42 | "description": "The parameters of the function.",
|
43 | "type": "array",
|
44 | "items": [
|
45 | {
|
46 | "$ref": "Parameter.schema.json"
|
47 | }
|
48 | ],
|
49 | "from": "Function",
|
50 | "isArray": true,
|
51 | "isPlural": true,
|
52 | "aliases": [
|
53 | "parameter"
|
54 | ]
|
55 | },
|
56 | "returns": {
|
57 | "@id": "stencila:returns",
|
58 | "description": "The return type of the function.",
|
59 | "anyOf": [
|
60 | {
|
61 | "$ref": "ValidatorTypes.schema.json"
|
62 | }
|
63 | ],
|
64 | "from": "Function"
|
65 | }
|
66 | },
|
67 | "file": "Function.schema.yaml",
|
68 | "children": [],
|
69 | "descendants": [],
|
70 | "$schema": "http://json-schema.org/draft-07/schema#",
|
71 | "$id": "https://schema.stenci.la/v0/Function.schema.json",
|
72 | "source": "https://github.com/stencila/schema/blob/master/Function.schema.yaml",
|
73 | "type": "object",
|
74 | "propertyAliases": {
|
75 | "parameter": "parameters"
|
76 | },
|
77 | "additionalProperties": false,
|
78 | "required": [
|
79 | "type"
|
80 | ]
|
81 | }
|