-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinstruction.json
More file actions
85 lines (85 loc) · 2.55 KB
/
instruction.json
File metadata and controls
85 lines (85 loc) · 2.55 KB
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
85
{
"id": "http://www.jsonscript.org/schema/instruction.json#",
"$schema": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#",
"description": "schema for instruction definition",
"type": "object",
"required": [ "name", "description", "keywords", "required", "evaluate" ],
"additionalProperties": false,
"properties": {
"name": {
"decription": "instruction name, should be the same as the main instruction keyword",
"$ref": "#scriptKeyword"
},
"description": {
"type": "string",
"minLength": 1
},
"keywords": {
"desription": "all allowed instruction keywords",
"allOf": [
{ "$ref": "#keywordsArray" },
{ "contains": { "constant": { "$data": "2/name" } } }
]
},
"required": {
"desription": "required instruction keywords",
"allOf": [
{ "$ref": "#keywordsArray" },
{ "contains": { "constant": { "$data": "2/name" } } }
]
},
"evaluate": {
"type": "object",
"required": [ "validatorKeyword" ],
"properties": {
"keywords": {
"description": "keywords that should be evaluated before validator keyword is called. If this property is absent, all keywords will be evaluated (in parallel)",
"anyOf": [
{ "$ref": "#keywordsArray" },
{ "$ref": "#emptyArray" }
]
},
"validatorKeyword": {
"description": "the custom 'validation' keyword that should be defined in the validator that evaluates the script",
"type": "string",
"minLength": 1,
"pattern": "^[a-z_$][a-z0-9_$]*$"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
}
}
},
"schema": {
"description": "the schemas for evaluated values of instruction keywords",
"type": "object",
"patternProperties": {
"^\\$[a-z]": { "$ref": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#" }
},
"additionalProperties": false
}
},
"definitions": {
"scriptKeyword": {
"id": "#scriptKeyword",
"description": "$ character + lowercase identifier",
"type": "string",
"pattern": "^\\$[a-z]+$"
},
"keywordsArray": {
"id": "#keywordsArray",
"type": "array",
"items": { "$ref": "#scriptKeyword" },
"minItems": 1,
"uniqueItems": true
},
"emptyArray": {
"id": "#emptyArray",
"type": "array",
"maxItems": 0
}
}
}