-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.jaspr
84 lines (82 loc) · 2.1 KB
/
schema.jaspr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// JSON schema for Jaspr modules
// Author: Adam Nelson <adam@nels.onl>
id: "http://adam.nels.onl/schema/jaspr/module"
$schema: "http://json-schema.org/draft-06/schema#"
title: "Jaspr Module"
description: "A module in the Jaspr programming language"
type: object
properties: {
$module: {
description: "Module name"
type: string
}
$main: {
description: "
If present, this module is an executable script.
The value of this property is the script's main function."
type: {$ref: "#/definitions/expr"}
}
$import: {$ref: "#/definitions/imports"}
$imports: {$ref: "#/definitions/imports"}
$export: {$ref: "#/definitions/names"}
$exports: {$ref: "#/definitions/names"}
$doc: {
description: "Documentation for the module, in Markdown format"
type: string
}
$author: {
description: "Name (and, optionally, email address) of the module's author"
type: string
}
patternProperties: {
"^(macro[.])?[^.,:`~'\"()\\[\\]{}\\s]+$": {$ref: "#/definitions/expr"}
"^doc[.][^.,:`~'\"()\\[\\]{}\\s]+$": {type: string}
}
additionalProperties: false
}
not: [
{required: [$import, $imports]}
{required: [$export, $exports]}
]
anyOf: [
{required: [$module, $export]}
{required: [$module, $exports]}
{required: [$script]}
]
definitions: {
expr: {
description: "A Jaspr expression"
}
name: {
description: "A valid Jaspr identifier"
type: string
pattern: "^[^.,:`~'\"()\\[\\]{}\\s]+$"
}
names: {
description: "A list of names imported/exported from a module"
anyOf: [{
type: array
items: {$ref: "#/definitions/name"}
}, {
type: object
patternProperties: {
"^[^.,:`~'\"()\\[\\]{}\\s]+$": {$ref: "#/definitions/name"}
}
additionalProperties: false
}]
}
imports: {
description: "A list or object specifying the modules that this module depends on"
anyOf: [{
type: array
items: {type: string}
}, {
type: object
additionalProperties: {anyOf: [
{type: boolean}
{$ref: "#/definitions/name"}
{$ref: "#/definitions/names"}
]}
}]
}
}