| 1 | { |
| 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | "$id": "https://raw.githubusercontent.com/jsonpath-standard/jsonpath-compliance-test-suite/main/cts.schema.json", |
| 4 | "title": "Compliance Test Suite", |
| 5 | "description": "JSONPath Compliance Test Suite", |
| 6 | "type": "object", |
| 7 | "properties": { |
| 8 | "tests": { |
| 9 | "description": "Individual test cases", |
| 10 | "type": "array", |
| 11 | "items": { |
| 12 | "$ref": "#/$defs/test_case" |
| 13 | } |
| 14 | } |
| 15 | }, |
| 16 | "required": [ |
| 17 | "tests" |
| 18 | ], |
| 19 | "$defs": { |
| 20 | "test_case": { |
| 21 | "type": "object", |
| 22 | "properties": { |
| 23 | "name": { |
| 24 | "$ref": "#/$defs/test_case_name" |
| 25 | }, |
| 26 | "selector": { |
| 27 | "$ref": "#/$defs/selector" |
| 28 | }, |
| 29 | "document": { |
| 30 | "$ref": "#/$defs/document" |
| 31 | }, |
| 32 | "result": { |
| 33 | "$ref": "#/$defs/test_case_result" |
| 34 | }, |
| 35 | "results": { |
| 36 | "$ref": "#/$defs/test_case_results" |
| 37 | }, |
| 38 | "invalid_selector": { |
| 39 | "$ref": "#/$defs/invalid_selector" |
| 40 | } |
| 41 | }, |
| 42 | "required": [ |
| 43 | "name", |
| 44 | "selector" |
| 45 | ], |
| 46 | "oneOf": [ |
| 47 | { |
| 48 | "required": [ |
| 49 | "document", |
| 50 | "result" |
| 51 | ], |
| 52 | "properties": { |
| 53 | "invalid_selector": false, |
| 54 | "results": false |
| 55 | } |
| 56 | }, |
| 57 | { |
| 58 | "required": [ |
| 59 | "document", |
| 60 | "results" |
| 61 | ], |
| 62 | "properties": { |
| 63 | "invalid_selector": false, |
| 64 | "result": false |
| 65 | } |
| 66 | }, |
| 67 | { |
| 68 | "required": [ |
| 69 | "invalid_selector" |
| 70 | ], |
| 71 | "properties": { |
| 72 | "document": false, |
| 73 | "result": false, |
| 74 | "results": false |
| 75 | } |
| 76 | } |
| 77 | ] |
| 78 | }, |
| 79 | "test_case_name": { |
| 80 | "description": "The name of the test case", |
| 81 | "type": "string", |
| 82 | "pattern": "^\\S.*\\S$" |
| 83 | }, |
| 84 | "test_case_result": { |
| 85 | "type": "array", |
| 86 | "description": "The expected result of applying the selector to the document, contains all the matched values" |
| 87 | }, |
| 88 | "test_case_results": { |
| 89 | "type": "array", |
| 90 | "items": {"$ref": "#/$defs/test_case_result"}, |
| 91 | "minItems": 2, |
| 92 | "description": "An array of possible expected results of applying the selector to the document, each element of which contains all the matched values" |
| 93 | }, |
| 94 | "selector": { |
| 95 | "description": "The JSONPath selector", |
| 96 | "type": "string" |
| 97 | }, |
| 98 | "document": { |
| 99 | "description": "The document, the selector is applied to" |
| 100 | }, |
| 101 | "invalid_selector": { |
| 102 | "type": "boolean", |
| 103 | "const": true, |
| 104 | "description": "The flag indicating that the selector is not a valid JSONPath selector expression" |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 |