wisp-schema 0.16.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/canary-nouns.json +71 -0
- data/canary-wisp.json +379 -0
- data/lib/wisp-schema.rb +30 -2
- data/nouns.json +23 -1
- data/wisp.json +23 -1
- metadata +33 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d0daa69d643e44686ba49c08d4a23d292675cbf8ed8ebcc06edb717baf8a66c7
|
|
4
|
+
data.tar.gz: f2fa4b9202c00dfb4fd283c007fafe1d328902efa3106107d479da48b7a0adc5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b7deb73f4bbb3f4a5ab23b167bda667bb4f1240db0570dc506b1bdff7c102911d1e7c7e505d8214e9d606d0dd7e4e195dccae081746f42f4b2aac5b6c342bc67
|
|
7
|
+
data.tar.gz: 2cab85011f965738c53a294cbc55bddf9369100b8aa110ea7fa6209eb5baabd4db508c566d6da2b7d0f1fd7fff4999dfdcb43a52ca34d805c9d189004a6c6b8c
|
data/canary-nouns.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"definitions": {
|
|
4
|
+
"ui_element": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"title": "UI Element",
|
|
7
|
+
"description": "Any other UI Element",
|
|
8
|
+
"properties": {
|
|
9
|
+
"type": {
|
|
10
|
+
"enum": ["ui_element"]
|
|
11
|
+
},
|
|
12
|
+
"element": {"title": "Element", "type": "string"},
|
|
13
|
+
"focus_x": {"title": "Focus offset for x-axis from top left corner", "type": "integer", "options": {"hidden": true}},
|
|
14
|
+
"focus_y": {"title": "Focus offset for y-axis from top left corner", "type": "integer", "options": {"hidden": true}},
|
|
15
|
+
"match_mode": {
|
|
16
|
+
"enum": ["pixel", "pixel_and_ocr"]
|
|
17
|
+
},
|
|
18
|
+
"ocr_expression": {
|
|
19
|
+
"title": "Expression to use for text matching",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"maxLength": 999
|
|
22
|
+
},
|
|
23
|
+
"ocr_status": {
|
|
24
|
+
"title": "OCR result description",
|
|
25
|
+
"enum": ["SUCCESS", "TOO_MUCH_TEXT", "NO_TEXT"]
|
|
26
|
+
},
|
|
27
|
+
"ocr_box": {
|
|
28
|
+
"title": "Text content bounding box",
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"x": {"type": "integer"},
|
|
32
|
+
"y": {"type": "integer"},
|
|
33
|
+
"w": {"type": "integer"},
|
|
34
|
+
"h": {"type": "integer"}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"required": ["type", "element"]
|
|
40
|
+
},
|
|
41
|
+
"ui_element_reference": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"title": "UI Element Reference",
|
|
44
|
+
"description": "A UI Element stored in the database",
|
|
45
|
+
"properties": {
|
|
46
|
+
"type": {
|
|
47
|
+
"enum": ["ui_element_reference"]
|
|
48
|
+
},
|
|
49
|
+
"id": {"title": "UI Element ID", "type": "integer"}
|
|
50
|
+
},
|
|
51
|
+
"additionalProperties": false,
|
|
52
|
+
"required": ["type", "id"]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"type": "object",
|
|
56
|
+
"title": "Single Wisp Noun",
|
|
57
|
+
"properties": {
|
|
58
|
+
"version": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"title": "Version"
|
|
61
|
+
},
|
|
62
|
+
"noun": {
|
|
63
|
+
"oneOf": [
|
|
64
|
+
{"$ref": "#/definitions/ui_element"},
|
|
65
|
+
{"$ref": "#/definitions/ui_element_reference"}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"additionalProperties": false,
|
|
70
|
+
"required": ["version", "noun"]
|
|
71
|
+
}
|
data/canary-wisp.json
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"definitions": {
|
|
4
|
+
"noun": {
|
|
5
|
+
"title": "Wisp Noun",
|
|
6
|
+
"oneOf": [
|
|
7
|
+
{"$ref": "#/definitions/ui_element"},
|
|
8
|
+
{"$ref": "#/definitions/ui_element_reference"}
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"ui_element": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"title": "UI Element",
|
|
14
|
+
"description": "Any other UI Element",
|
|
15
|
+
"properties": {
|
|
16
|
+
"type": {
|
|
17
|
+
"enum": ["ui_element"]
|
|
18
|
+
},
|
|
19
|
+
"element": {"title": "Element", "type": "string"},
|
|
20
|
+
"focus_x": {"title": "Focus offset for x-axis from top left corner", "type": "integer", "options": {"hidden": true}},
|
|
21
|
+
"focus_y": {"title": "Focus offset for y-axis from top left corner", "type": "integer", "options": {"hidden": true}},
|
|
22
|
+
"match_mode": {
|
|
23
|
+
"enum": ["pixel", "pixel_and_ocr"]
|
|
24
|
+
},
|
|
25
|
+
"ocr_expression": {
|
|
26
|
+
"title": "Expression to use for text matching",
|
|
27
|
+
"type": "string",
|
|
28
|
+
"maxLength": 999
|
|
29
|
+
},
|
|
30
|
+
"ocr_status": {
|
|
31
|
+
"title": "OCR result description",
|
|
32
|
+
"enum": ["SUCCESS", "TOO_MUCH_TEXT", "NO_TEXT"]
|
|
33
|
+
},
|
|
34
|
+
"ocr_box": {
|
|
35
|
+
"title": "Text content bounding box",
|
|
36
|
+
"type": "object",
|
|
37
|
+
"properties": {
|
|
38
|
+
"x": {"type": "integer"},
|
|
39
|
+
"y": {"type": "integer"},
|
|
40
|
+
"w": {"type": "integer"},
|
|
41
|
+
"h": {"type": "integer"}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"required": ["type", "element"]
|
|
47
|
+
},
|
|
48
|
+
"ui_element_reference": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"title": "UI Element Reference",
|
|
51
|
+
"description": "A UI Element stored in the database",
|
|
52
|
+
"properties": {
|
|
53
|
+
"type": {
|
|
54
|
+
"enum": ["ui_element_reference"]
|
|
55
|
+
},
|
|
56
|
+
"id": {"title": "UI Element ID", "type": "integer"}
|
|
57
|
+
},
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"required": ["type", "id"]
|
|
60
|
+
},
|
|
61
|
+
"verb": {
|
|
62
|
+
"title": "Wisp Verb",
|
|
63
|
+
"oneOf": [
|
|
64
|
+
{"$ref": "#/definitions/click"},
|
|
65
|
+
{"$ref": "#/definitions/double_click"},
|
|
66
|
+
{"$ref": "#/definitions/fill"},
|
|
67
|
+
{"$ref": "#/definitions/type"},
|
|
68
|
+
{"$ref": "#/definitions/send_key"},
|
|
69
|
+
{"$ref": "#/definitions/hover"},
|
|
70
|
+
{"$ref": "#/definitions/select"},
|
|
71
|
+
{"$ref": "#/definitions/refresh"},
|
|
72
|
+
{"$ref": "#/definitions/navigate"},
|
|
73
|
+
{"$ref": "#/definitions/close_tab"},
|
|
74
|
+
{"$ref": "#/definitions/scroll"},
|
|
75
|
+
{"$ref": "#/definitions/wait"},
|
|
76
|
+
{"$ref": "#/definitions/drag_and_drop"},
|
|
77
|
+
{"$ref": "#/definitions/tester_instruction"},
|
|
78
|
+
{"$ref": "#/definitions/embedded_test"},
|
|
79
|
+
{"$ref": "#/definitions/observe"},
|
|
80
|
+
{"$ref": "#/definitions/tester_confirmation"}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"click": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"title": "Click",
|
|
86
|
+
"description": "Clicks on the UI element",
|
|
87
|
+
"properties": {
|
|
88
|
+
"action": {
|
|
89
|
+
"enum": ["click"]
|
|
90
|
+
},
|
|
91
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
92
|
+
"target": {
|
|
93
|
+
"title": "Target",
|
|
94
|
+
"$ref": "#/definitions/noun"
|
|
95
|
+
},
|
|
96
|
+
"button": {"title": "Mouse Button", "type": "string", "enum": ["left", "middle", "right"]},
|
|
97
|
+
"hold": {"title": "And Hold", "type": "boolean"},
|
|
98
|
+
"hold_seconds": {"title": "Hold seconds", "type": "integer"}
|
|
99
|
+
},
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"required": ["action", "target", "button", "hold"]
|
|
102
|
+
},
|
|
103
|
+
"double_click": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"title": "Double Click",
|
|
106
|
+
"description": "Double-clicks on the UI element",
|
|
107
|
+
"properties": {
|
|
108
|
+
"action": {
|
|
109
|
+
"enum": ["double_click"]
|
|
110
|
+
},
|
|
111
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
112
|
+
"target": {
|
|
113
|
+
"title": "Target",
|
|
114
|
+
"$ref": "#/definitions/noun"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"additionalProperties": false,
|
|
118
|
+
"required": ["action", "target"]
|
|
119
|
+
},
|
|
120
|
+
"fill": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"title": "Fill",
|
|
123
|
+
"description": "Fills the text field with specified content",
|
|
124
|
+
"properties": {
|
|
125
|
+
"action": {
|
|
126
|
+
"enum": ["fill"]
|
|
127
|
+
},
|
|
128
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
129
|
+
"target": {
|
|
130
|
+
"title": "Target",
|
|
131
|
+
"$ref": "#/definitions/noun"
|
|
132
|
+
},
|
|
133
|
+
"text": {"title": "Text", "type": "string"}
|
|
134
|
+
},
|
|
135
|
+
"additionalProperties": false,
|
|
136
|
+
"required": ["action", "target", "text"]
|
|
137
|
+
},
|
|
138
|
+
"type": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"title": "Type",
|
|
141
|
+
"description": "Types in specified text",
|
|
142
|
+
"properties": {
|
|
143
|
+
"action": {
|
|
144
|
+
"enum": ["type"]
|
|
145
|
+
},
|
|
146
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
147
|
+
"text": {"title": "Text", "type": "string"}
|
|
148
|
+
},
|
|
149
|
+
"additionalProperties": false,
|
|
150
|
+
"required": ["action", "text"]
|
|
151
|
+
},
|
|
152
|
+
"send_key": {
|
|
153
|
+
"type": "object",
|
|
154
|
+
"title": "Press Key",
|
|
155
|
+
"description": "Press specified key or key combination.",
|
|
156
|
+
"properties": {
|
|
157
|
+
"action": {
|
|
158
|
+
"enum": ["send_key"]
|
|
159
|
+
},
|
|
160
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
161
|
+
"key": {"title": "Key", "type": "string"},
|
|
162
|
+
"modifier": {"title": "Modifier", "type": "string"}
|
|
163
|
+
},
|
|
164
|
+
"additionalProperties": false,
|
|
165
|
+
"required": ["action", "key"]
|
|
166
|
+
},
|
|
167
|
+
"hover": {
|
|
168
|
+
"type": "object",
|
|
169
|
+
"title": "Hover",
|
|
170
|
+
"description": "Hovers over specified element",
|
|
171
|
+
"properties": {
|
|
172
|
+
"action": {
|
|
173
|
+
"enum": ["hover"]
|
|
174
|
+
},
|
|
175
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
176
|
+
"target": {
|
|
177
|
+
"title": "Target",
|
|
178
|
+
"$ref": "#/definitions/noun"
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
"additionalProperties": false,
|
|
182
|
+
"required": ["action", "target"]
|
|
183
|
+
},
|
|
184
|
+
"select": {
|
|
185
|
+
"type": "object",
|
|
186
|
+
"title": "Select",
|
|
187
|
+
"description": "Selects specified item from the dropdown",
|
|
188
|
+
"properties": {
|
|
189
|
+
"action": {
|
|
190
|
+
"enum": ["select"]
|
|
191
|
+
},
|
|
192
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
193
|
+
"target": {
|
|
194
|
+
"title": "Target",
|
|
195
|
+
"$ref": "#/definitions/noun"
|
|
196
|
+
},
|
|
197
|
+
"option": {
|
|
198
|
+
"title": "Option",
|
|
199
|
+
"$ref": "#/definitions/noun"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"additionalProperties": false,
|
|
203
|
+
"required": ["action", "target", "option"]
|
|
204
|
+
},
|
|
205
|
+
"refresh": {
|
|
206
|
+
"type": "object",
|
|
207
|
+
"title": "Refresh",
|
|
208
|
+
"description": "Refreshes the webpage",
|
|
209
|
+
"properties": {
|
|
210
|
+
"action": {
|
|
211
|
+
"enum": ["refresh"]
|
|
212
|
+
},
|
|
213
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"}
|
|
214
|
+
},
|
|
215
|
+
"additionalProperties": false,
|
|
216
|
+
"required": ["action"]
|
|
217
|
+
},
|
|
218
|
+
"navigate": {
|
|
219
|
+
"type": "object",
|
|
220
|
+
"title": "Navigate",
|
|
221
|
+
"description": "Navigates to specified URL",
|
|
222
|
+
"properties": {
|
|
223
|
+
"action": {
|
|
224
|
+
"enum": ["navigate"]
|
|
225
|
+
},
|
|
226
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
227
|
+
"url": {"title": "URL", "type": "string"},
|
|
228
|
+
"tab": {"title": "Tab", "type": "string", "enum": ["current", "new", "incognito"]}
|
|
229
|
+
},
|
|
230
|
+
"additionalProperties": false,
|
|
231
|
+
"required": ["action", "url"]
|
|
232
|
+
},
|
|
233
|
+
"close_tab": {
|
|
234
|
+
"type": "object",
|
|
235
|
+
"title": "Close Tab",
|
|
236
|
+
"description": "Closes current browser tab",
|
|
237
|
+
"properties": {
|
|
238
|
+
"action": {
|
|
239
|
+
"enum": ["close_tab"]
|
|
240
|
+
},
|
|
241
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"}
|
|
242
|
+
},
|
|
243
|
+
"additionalProperties": false,
|
|
244
|
+
"required": ["action"]
|
|
245
|
+
},
|
|
246
|
+
"scroll": {
|
|
247
|
+
"type": "object",
|
|
248
|
+
"title": "Scroll",
|
|
249
|
+
"description": "Scrolls the page into specified direction until target is reached",
|
|
250
|
+
"properties": {
|
|
251
|
+
"action": {
|
|
252
|
+
"enum": ["scroll"]
|
|
253
|
+
},
|
|
254
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
255
|
+
"direction": {"title": "Direction", "type": "string", "enum": ["up", "down", "left", "right"]},
|
|
256
|
+
"target": {
|
|
257
|
+
"title": "Target",
|
|
258
|
+
"$ref": "#/definitions/noun"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"additionalProperties": false,
|
|
262
|
+
"required": ["action", "direction", "target"]
|
|
263
|
+
},
|
|
264
|
+
"wait": {
|
|
265
|
+
"type": "object",
|
|
266
|
+
"title": "Wait",
|
|
267
|
+
"description": "Waits for a number of seconds",
|
|
268
|
+
"properties": {
|
|
269
|
+
"action": {
|
|
270
|
+
"enum": ["wait"]
|
|
271
|
+
},
|
|
272
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
273
|
+
"seconds": {"title": "seconds", "type": "integer"}
|
|
274
|
+
},
|
|
275
|
+
"additionalProperties": false,
|
|
276
|
+
"required": ["action", "seconds"]
|
|
277
|
+
},
|
|
278
|
+
"drag_and_drop": {
|
|
279
|
+
"type": "object",
|
|
280
|
+
"title": "Drag and drop",
|
|
281
|
+
"description": "Drag and drop",
|
|
282
|
+
"properties": {
|
|
283
|
+
"action": {
|
|
284
|
+
"enum": ["drag_and_drop"]
|
|
285
|
+
},
|
|
286
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
287
|
+
"object": {
|
|
288
|
+
"title": "Object",
|
|
289
|
+
"$ref": "#/definitions/noun"
|
|
290
|
+
},
|
|
291
|
+
"target": {
|
|
292
|
+
"title": "Target",
|
|
293
|
+
"$ref": "#/definitions/noun"
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"additionalProperties": false,
|
|
297
|
+
"required": ["action", "target", "object"]
|
|
298
|
+
},
|
|
299
|
+
"embedded_test": {
|
|
300
|
+
"type": "object",
|
|
301
|
+
"title": "Embedded Test",
|
|
302
|
+
"description": "Embeds a Test",
|
|
303
|
+
"properties": {
|
|
304
|
+
"action": {
|
|
305
|
+
"enum": ["embedded_test"]
|
|
306
|
+
},
|
|
307
|
+
"test_id": {
|
|
308
|
+
"title": "Test ID",
|
|
309
|
+
"type": "integer"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"additionalProperties": false,
|
|
313
|
+
"required": ["action", "test_id"]
|
|
314
|
+
},
|
|
315
|
+
"tester_instruction": {
|
|
316
|
+
"type": "object",
|
|
317
|
+
"title": "Tester Instruction",
|
|
318
|
+
"description": "Allows to fallback to english",
|
|
319
|
+
"properties": {
|
|
320
|
+
"action": {
|
|
321
|
+
"enum": ["tester_instruction"]
|
|
322
|
+
},
|
|
323
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
324
|
+
"instruction": {"title": "Instruction", "type": "string"}
|
|
325
|
+
},
|
|
326
|
+
"additionalProperties": false,
|
|
327
|
+
"required": ["action", "instruction"]
|
|
328
|
+
},
|
|
329
|
+
"observe": {
|
|
330
|
+
"type": "object",
|
|
331
|
+
"title": "Observe",
|
|
332
|
+
"description": "Checks if element of the UI is visible or not",
|
|
333
|
+
"properties": {
|
|
334
|
+
"assertion": {
|
|
335
|
+
"enum": ["observe"]
|
|
336
|
+
},
|
|
337
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
338
|
+
"object": {
|
|
339
|
+
"title": "Object",
|
|
340
|
+
"$ref": "#/definitions/noun"
|
|
341
|
+
},
|
|
342
|
+
"visiblity": {"title": "Is the element visible?", "type": "boolean"}
|
|
343
|
+
},
|
|
344
|
+
"additionalProperties": false,
|
|
345
|
+
"required": ["assertion", "object"]
|
|
346
|
+
},
|
|
347
|
+
"tester_confirmation": {
|
|
348
|
+
"type": "object",
|
|
349
|
+
"title": "Tester Confirmation",
|
|
350
|
+
"description": "Allows to fallback to english",
|
|
351
|
+
"properties": {
|
|
352
|
+
"assertion": {
|
|
353
|
+
"enum": ["tester_confirmation"]
|
|
354
|
+
},
|
|
355
|
+
"embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
|
|
356
|
+
"confirmation": {"title": "confirmation", "type": "string"}
|
|
357
|
+
},
|
|
358
|
+
"additionalProperties": false,
|
|
359
|
+
"required": ["assertion", "confirmation"]
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
"type": "object",
|
|
363
|
+
"title": "Wisp Test",
|
|
364
|
+
"properties": {
|
|
365
|
+
"version": {
|
|
366
|
+
"type": "string",
|
|
367
|
+
"title": "Version"
|
|
368
|
+
},
|
|
369
|
+
"verbs": {
|
|
370
|
+
"type": "array",
|
|
371
|
+
"title": "Verbs",
|
|
372
|
+
"items": {
|
|
373
|
+
"$ref": "#/definitions/verb"
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
"additionalProperties": false,
|
|
378
|
+
"required": ["version", "verbs"]
|
|
379
|
+
}
|
data/lib/wisp-schema.rb
CHANGED
|
@@ -1,8 +1,36 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
require 'json_schemer'
|
|
3
|
+
require 'semantic'
|
|
4
|
+
require_relative 'version'
|
|
2
5
|
|
|
3
6
|
module Wisp
|
|
4
|
-
VERSION = '0.16.0'
|
|
5
|
-
|
|
6
7
|
SCHEMA_PATH = File.expand_path('../wisp.json', __dir__)
|
|
7
8
|
NOUNS_PATH = File.expand_path('../nouns.json', __dir__)
|
|
9
|
+
|
|
10
|
+
CANARY_SCHEMA_PATH = File.expand_path('../canary-wisp.json', __dir__)
|
|
11
|
+
CANARY_NOUNS_PATH = File.expand_path('../canary-nouns.json', __dir__)
|
|
12
|
+
|
|
13
|
+
SEMANTIC_STABLE_VERSION = Semantic::Version.new(STABLE_VERSION)
|
|
14
|
+
|
|
15
|
+
def wisp_schemer(raw_version)
|
|
16
|
+
version = Semantic::Version.new(raw_version)
|
|
17
|
+
|
|
18
|
+
if version > SEMANTIC_STABLE_VERSION
|
|
19
|
+
JSONSchemer.schema(Pathname.new(Wisp::CANARY_SCHEMA_PATH))
|
|
20
|
+
else
|
|
21
|
+
JSONSchemer.schema(Pathname.new(Wisp::SCHEMA_PATH))
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
module_function :wisp_schemer
|
|
25
|
+
|
|
26
|
+
def nouns_schemer(raw_version)
|
|
27
|
+
version = Semantic::Version.new(raw_version)
|
|
28
|
+
|
|
29
|
+
if version > SEMANTIC_STABLE_VERSION
|
|
30
|
+
JSONSchemer.schema(Pathname.new(Wisp::CANARY_NOUNS_PATH))
|
|
31
|
+
else
|
|
32
|
+
JSONSchemer.schema(Pathname.new(Wisp::NOUNS_PATH))
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
module_function :nouns_schemer
|
|
8
36
|
end
|
data/nouns.json
CHANGED
|
@@ -11,7 +11,29 @@
|
|
|
11
11
|
},
|
|
12
12
|
"element": {"title": "Element", "type": "string"},
|
|
13
13
|
"focus_x": {"title": "Focus offset for x-axis from top left corner", "type": "integer", "options": {"hidden": true}},
|
|
14
|
-
"focus_y": {"title": "Focus offset for y-axis from top left corner", "type": "integer", "options": {"hidden": true}}
|
|
14
|
+
"focus_y": {"title": "Focus offset for y-axis from top left corner", "type": "integer", "options": {"hidden": true}},
|
|
15
|
+
"match_mode": {
|
|
16
|
+
"enum": ["pixel", "pixel_and_ocr"]
|
|
17
|
+
},
|
|
18
|
+
"ocr_expression": {
|
|
19
|
+
"title": "Expression to use for text matching",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"maxLength": 999
|
|
22
|
+
},
|
|
23
|
+
"ocr_status": {
|
|
24
|
+
"title": "OCR result description",
|
|
25
|
+
"enum": ["SUCCESS", "TOO_MUCH_TEXT", "NO_TEXT"]
|
|
26
|
+
},
|
|
27
|
+
"ocr_box": {
|
|
28
|
+
"title": "Text content bounding box",
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"x": {"type": "integer"},
|
|
32
|
+
"y": {"type": "integer"},
|
|
33
|
+
"w": {"type": "integer"},
|
|
34
|
+
"h": {"type": "integer"}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
15
37
|
},
|
|
16
38
|
"additionalProperties": false,
|
|
17
39
|
"required": ["type", "element"]
|
data/wisp.json
CHANGED
|
@@ -18,7 +18,29 @@
|
|
|
18
18
|
},
|
|
19
19
|
"element": {"title": "Element", "type": "string"},
|
|
20
20
|
"focus_x": {"title": "Focus offset for x-axis from top left corner", "type": "integer", "options": {"hidden": true}},
|
|
21
|
-
"focus_y": {"title": "Focus offset for y-axis from top left corner", "type": "integer", "options": {"hidden": true}}
|
|
21
|
+
"focus_y": {"title": "Focus offset for y-axis from top left corner", "type": "integer", "options": {"hidden": true}},
|
|
22
|
+
"match_mode": {
|
|
23
|
+
"enum": ["pixel", "pixel_and_ocr"]
|
|
24
|
+
},
|
|
25
|
+
"ocr_expression": {
|
|
26
|
+
"title": "Expression to use for text matching",
|
|
27
|
+
"type": "string",
|
|
28
|
+
"maxLength": 999
|
|
29
|
+
},
|
|
30
|
+
"ocr_status": {
|
|
31
|
+
"title": "OCR result description",
|
|
32
|
+
"enum": ["SUCCESS", "TOO_MUCH_TEXT", "NO_TEXT"]
|
|
33
|
+
},
|
|
34
|
+
"ocr_box": {
|
|
35
|
+
"title": "Text content bounding box",
|
|
36
|
+
"type": "object",
|
|
37
|
+
"properties": {
|
|
38
|
+
"x": {"type": "integer"},
|
|
39
|
+
"y": {"type": "integer"},
|
|
40
|
+
"w": {"type": "integer"},
|
|
41
|
+
"h": {"type": "integer"}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
22
44
|
},
|
|
23
45
|
"additionalProperties": false,
|
|
24
46
|
"required": ["type", "element"]
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wisp-schema
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Grodowski
|
|
@@ -11,13 +11,43 @@ autorequire:
|
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
13
|
date: 2018-11-15 00:00:00.000000000 Z
|
|
14
|
-
dependencies:
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: json_schemer
|
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
|
+
requirements:
|
|
19
|
+
- - "~>"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 0.2.17
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - "~>"
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: 0.2.17
|
|
29
|
+
- !ruby/object:Gem::Dependency
|
|
30
|
+
name: semantic
|
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
|
32
|
+
requirements:
|
|
33
|
+
- - "~>"
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: '1.6'
|
|
36
|
+
type: :runtime
|
|
37
|
+
prerelease: false
|
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
39
|
+
requirements:
|
|
40
|
+
- - "~>"
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: '1.6'
|
|
15
43
|
description: This gem contains Wisp's JSON schema definition
|
|
16
44
|
email:
|
|
17
45
|
executables: []
|
|
18
46
|
extensions: []
|
|
19
47
|
extra_rdoc_files: []
|
|
20
48
|
files:
|
|
49
|
+
- canary-nouns.json
|
|
50
|
+
- canary-wisp.json
|
|
21
51
|
- lib/wisp-schema.rb
|
|
22
52
|
- nouns.json
|
|
23
53
|
- wisp.json
|
|
@@ -40,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
40
70
|
- !ruby/object:Gem::Version
|
|
41
71
|
version: '0'
|
|
42
72
|
requirements: []
|
|
43
|
-
rubygems_version: 3.
|
|
73
|
+
rubygems_version: 3.2.3
|
|
44
74
|
signing_key:
|
|
45
75
|
specification_version: 4
|
|
46
76
|
summary: Wisp's schema
|