44 "description" : " schema with custom keywords that evaluates JSON script. It assumes that the script is valid" ,
55 "switch" : [
66 {
7- "if" : { "type" : " object" },
7+ "if" : {
8+ "type" : " object"
9+ },
810 "then" : {
911 "title" : " parallel execution or script command" ,
1012 "description" : " evaluates all properties in parallel or executes script command (its keywords are evaluated in parallel too)" ,
11- "allOf" :[
13+ "allOf" : [
1214 {
1315 "title" : " evaluate properties" ,
1416 "description" : " evaluates all properties using the same schema, properties-scripts are replaced with returned data or 'promise'" ,
15- "additionalProperties" : { "$ref" : " #" }
17+ "additionalProperties" : {
18+ "$ref" : " #"
19+ }
1620 },
1721 {
18- "title" : " validate keywords" ,
19- "description" : " validates script keyword values or chains promises to validate resolved values of keywords" ,
20- "properties" : {
21- "$func" : { "thenValue" : { "$ref" : " #uuidOrIdentifier" } },
22- "$object" : { "thenValue" : { "$ref" : " #uuidOrIdentifier" } },
23- "$method" : { "thenValue" : { "$ref" : " #identifier" } },
24- "$ref" : { "thenValue" : { "$ref" : " #jsonPointer" } },
25- "$data" : { "thenValue" : { "$ref" : " #anyJsonPointer" } }
26- }
22+ "title" : " object to promise" ,
23+ "description" : " merge object properties into a single promise" ,
24+ "objectToPromise" : true
2725 },
2826 {
29- "title" : " execute command" ,
30- "description" : " executes supported script commands" ,
31- "switch" : [
32- {
33- "if" : { "required" : [ " $func" ] },
34- "then" : { "callFunc" : true }
35- },
36- {
37- "if" : { "required" : [ " $method" ] },
38- "then" : { "callMethod" : true }
39- },
40- {
41- "if" : { "required" : [ " $ref" ] },
42- "then" : { "getRef" : true }
43- },
44- {
45- "if" : { "required" : [ " $data" ] },
46- "then" : { "getData" : true }
47- }
48- ]
27+ "title" : " execute instruction" ,
28+ "description" : " executes supported script instructions" ,
29+ "thenValue" : {
30+ "switch" : [
31+ {
32+ "if" : {
33+ "required" : [
34+ " $exec"
35+ ]
36+ },
37+ "then" : {
38+ "allOf" : [
39+ {
40+ "description" : " valdate evaluated instruction keywords" ,
41+ "properties" : {
42+ "$exec" : {
43+ "type" : " string" ,
44+ "anyOf" : [
45+ {
46+ "format" : " js-identifier"
47+ },
48+ {
49+ "format" : " uuid"
50+ }
51+ ]
52+ },
53+ "$method" : {
54+ "type" : " string" ,
55+ "format" : " js-identifier"
56+ }
57+ }
58+ },
59+ {
60+ "description" : " execute instruction using custom keyword" ,
61+ "callExec" : true
62+ }
63+ ]
64+ }
65+ },
66+ {
67+ "if" : {
68+ "required" : [
69+ " $ref"
70+ ]
71+ },
72+ "then" : {
73+ "allOf" : [
74+ {
75+ "description" : " valdate evaluated instruction keywords" ,
76+ "properties" : {
77+ "$ref" : {
78+ "type" : " string" ,
79+ "format" : " json-pointer"
80+ }
81+ }
82+ },
83+ {
84+ "description" : " execute instruction using custom keyword" ,
85+ "getRef" : true
86+ }
87+ ]
88+ }
89+ },
90+ {
91+ "if" : {
92+ "required" : [
93+ " $data"
94+ ]
95+ },
96+ "then" : {
97+ "allOf" : [
98+ {
99+ "description" : " valdate evaluated instruction keywords" ,
100+ "properties" : {
101+ "$data" : {
102+ "type" : " string" ,
103+ "anyOf" : [
104+ {
105+ "format" : " json-pointer"
106+ },
107+ {
108+ "format" : " relative-json-pointer"
109+ }
110+ ]
111+ }
112+ }
113+ },
114+ {
115+ "description" : " execute instruction using custom keyword" ,
116+ "getData" : true
117+ }
118+ ]
119+ }
120+ }
121+ ]
122+ }
49123 }
50124 ]
51125 }
52126 },
53127 {
54- "if" : { "type" : " array" },
128+ "if" : {
129+ "type" : " array"
130+ },
55131 "then" : {
56132 "title" : " sequential execution" ,
57133 "description" : " queues items so that the next promise is created only after the previous one is resolved" ,
58134 "queueItems" : true
59135 }
60136 }
61- ],
62- "definitions" : {
63- "identifier" : {
64- "id" : " #identifier" ,
65- "type" : " string" ,
66- "pattern" : " ^[A-Za-z$_][A-Za-z$_0-9]*$"
67- },
68- "uuidOrIdentifier" : {
69- "id" : " #uuidOrIdentifier" ,
70- "type" : " string" ,
71- "anyOf" : [
72- { "pattern" : " ^[A-Za-z$_][A-Za-z$_0-9]*$" },
73- { "format" : " uuid" }
74- ]
75- },
76- "jsonPointer" : {
77- "id" : " #jsonPointer" ,
78- "type" : " string" ,
79- "format" : " json-pointer"
80- },
81- "anyJsonPointer" : {
82- "id" : " #anyJsonPointer" ,
83- "type" : " string" ,
84- "anyOf" : [
85- { "format" : " json-pointer" },
86- { "format" : " relative-json-pointer" }
87- ]
88- }
89- }
90- }
137+ ]
138+ }
0 commit comments