|
| 1 | +{ |
| 2 | + "id": "http://www.json-script.com/schema/macro.json#", |
| 3 | + "$schema": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#", |
| 4 | + "description": "schema for macro definition", |
| 5 | + "type": "object", |
| 6 | + "required": [ "name", "description", "rules" ], |
| 7 | + "additionalProperties": false, |
| 8 | + "properties": { |
| 9 | + "name": { |
| 10 | + "decription": "macro name", |
| 11 | + "$ref": "#nonEmptyString" |
| 12 | + }, |
| 13 | + "description": { |
| 14 | + "$ref": "#nonEmptyString" |
| 15 | + }, |
| 16 | + "rules": { |
| 17 | + "description": "macro rules", |
| 18 | + "type": "array", |
| 19 | + "minItems": 1, |
| 20 | + "items": { |
| 21 | + "type": "object", |
| 22 | + "required": [ "description", "pattern", "script" ], |
| 23 | + "additionalProperties": false, |
| 24 | + "properties": { |
| 25 | + "description": { "$ref": "#nonEmptyString" }, |
| 26 | + "pattern": { |
| 27 | + "type": "object", |
| 28 | + "minProperties": 1, |
| 29 | + "maxProperties": 1, |
| 30 | + "additionalProperties": { |
| 31 | + "description": "property itself should be a valid regular expression", |
| 32 | + "type": "integer" |
| 33 | + } |
| 34 | + }, |
| 35 | + "script": { |
| 36 | + "type": "object", |
| 37 | + "additionalProperties": false, |
| 38 | + "patternProperties": { |
| 39 | + "^\\$[a-z]+$": { |
| 40 | + "anyOf": [ |
| 41 | + { |
| 42 | + "description": "this string referes to the partial match in macro pattern", |
| 43 | + "type": "string", |
| 44 | + "pattern": "^\\$[1-9]$" |
| 45 | + }, |
| 46 | + { |
| 47 | + "description": "object with a single property that refers to the match; the value of the property is a substitution map", |
| 48 | + "type": "object", |
| 49 | + "minProperties": 1, |
| 50 | + "maxProperties": 1, |
| 51 | + "additionalProperties": false, |
| 52 | + "patternProperties": { |
| 53 | + "^\\$[1-9]$": { |
| 54 | + "type": "object", |
| 55 | + "additionalProperties": { |
| 56 | + "type": "string" |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | + }, |
| 61 | + { |
| 62 | + "description": "this number referes to the value in the macro", |
| 63 | + "type": "integer" |
| 64 | + }, |
| 65 | + { |
| 66 | + "description": "any valid JSONScript" |
| 67 | + } |
| 68 | + ] |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + }, |
| 76 | + "definitions": { |
| 77 | + "nonEmptyString": { |
| 78 | + "id": "#nonEmptyString", |
| 79 | + "type": "string", |
| 80 | + "minLength": 1 |
| 81 | + } |
| 82 | + } |
| 83 | +} |
0 commit comments