"description": "Schema with custom keywords that evaluates JSON script. It assumes that the script is valid",
"allOf": [
{
"switch": [
{
"if": { "type": "object" },
"then": {
"switch": [
{{~ it.instructions:inst }}
{
"if": { "required": [ "{{=inst.name}}" ] },
"then": {{# def.instruction }}
},
{{~}}
{
"then": {
"title": "parallel execution",
"allOf": [
{
"title": "evaluate properties",
"description": "evaluates all properties using the same schema, properties-scripts are replaced with returned synchronous or asynchronous value",
"additionalProperties": { "$ref": "#" }
},
{
"title": "object to [async] value",
"description": "Merge object properties into a single [asynchronous] object value",
"objectToAsync": true
}
]
}
}
]
}
},
{
"if": { "type": "array" },
"then": {
"title": "sequential execution",
"description": "queues items so that the next items is executed only after the previous asynchronous value receives data",
"itemsSerial": { "$ref": "#" }
}
},
{
"then": {
"title": "scalar values",
"description": "convert scalar values to asynchronouse values",
"valueToAsync": true
}
}
]
},
{
"description": "store pointer to evaluted object and resolve pending references",
"resolvePendingRefs": true
}
]
}
{{## def.instruction:
{
"title": "instruction {{=inst.name}}",
"allOf": [
{{ var evalKeywords = inst.evaluate.keywords; }}
{{? !evalKeywords || evalKeywords.length }}
{
"title": "evaluate properties",
"description": "evaluates all or some keywords using this (full) schema, properties-scripts are replaced with returned synchronous or asynchronous value",
{{? evalKeywords }}
"properties": {
{{~ evalKeywords:keyword:i }}
{{?i}},{{?}}
"{{=keyword}}": { "$ref": "#" }
{{~}}
}
{{??}}
"additionalProperties": { "$ref": "#" }
{{?}}
},
{
"title": "object to [async] value",
"description": "Merge object properties into a single [asynchronous] object value",