-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmacro.json
More file actions
83 lines (83 loc) · 2.56 KB
/
macro.json
File metadata and controls
83 lines (83 loc) · 2.56 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
{
"id": "http://www.jsonscript.org/schema/macro.json#",
"$schema": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#",
"description": "schema for macro definition",
"type": "object",
"required": [ "name", "description", "rules" ],
"additionalProperties": false,
"properties": {
"name": {
"decription": "macro name",
"$ref": "#nonEmptyString"
},
"description": {
"$ref": "#nonEmptyString"
},
"rules": {
"description": "macro rules",
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": [ "description", "pattern", "script" ],
"additionalProperties": false,
"properties": {
"description": { "$ref": "#nonEmptyString" },
"pattern": {
"type": "object",
"minProperties": 1,
"maxProperties": 1,
"additionalProperties": {
"description": "property itself should be a valid regular expression",
"type": "integer"
}
},
"script": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^\\$[a-z]+$": {
"anyOf": [
{
"description": "this string referes to the partial match in macro pattern",
"type": "string",
"pattern": "^\\$[1-9]$"
},
{
"description": "object with a single property that refers to the match; the value of the property is a substitution map",
"type": "object",
"minProperties": 1,
"maxProperties": 1,
"additionalProperties": false,
"patternProperties": {
"^\\$[1-9]$": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
{
"description": "this number referes to the value in the macro",
"type": "integer"
},
{
"description": "any valid JSONScript"
}
]
}
}
}
}
}
}
},
"definitions": {
"nonEmptyString": {
"id": "#nonEmptyString",
"type": "string",
"minLength": 1
}
}
}