| 1 |
[ |
| 2 |
{ |
| 3 |
"description": "pattern validation", |
| 4 |
"schema": { |
| 5 |
"$schema": "https://json-schema.org/draft/2020-12/schema", |
| 6 |
"pattern": "^a*$" |
| 7 |
}, |
| 8 |
"tests": [ |
| 9 |
{ |
| 10 |
"description": "a matching pattern is valid", |
| 11 |
"data": "aaa", |
| 12 |
"valid": true |
| 13 |
}, |
| 14 |
{ |
| 15 |
"description": "a non-matching pattern is invalid", |
| 16 |
"data": "abc", |
| 17 |
"valid": false |
| 18 |
}, |
| 19 |
{ |
| 20 |
"description": "ignores booleans", |
| 21 |
"data": true, |
| 22 |
"valid": true |
| 23 |
}, |
| 24 |
{ |
| 25 |
"description": "ignores integers", |
| 26 |
"data": 123, |
| 27 |
"valid": true |
| 28 |
}, |
| 29 |
{ |
| 30 |
"description": "ignores floats", |
| 31 |
"data": 1.0, |
| 32 |
"valid": true |
| 33 |
}, |
| 34 |
{ |
| 35 |
"description": "ignores objects", |
| 36 |
"data": {}, |
| 37 |
"valid": true |
| 38 |
}, |
| 39 |
{ |
| 40 |
"description": "ignores arrays", |
| 41 |
"data": [], |
| 42 |
"valid": true |
| 43 |
}, |
| 44 |
{ |
| 45 |
"description": "ignores null", |
| 46 |
"data": null, |
| 47 |
"valid": true |
| 48 |
} |
| 49 |
] |
| 50 |
}, |
| 51 |
{ |
| 52 |
"description": "pattern is not anchored", |
| 53 |
"schema": { |
| 54 |
"$schema": "https://json-schema.org/draft/2020-12/schema", |
| 55 |
"pattern": "a+" |
| 56 |
}, |
| 57 |
"tests": [ |
| 58 |
{ |
| 59 |
"description": "matches a substring", |
| 60 |
"data": "xxaayy", |
| 61 |
"valid": true |
| 62 |
} |
| 63 |
] |
| 64 |
}, |
| 65 |
{ |
| 66 |
"description": "pattern with Unicode property escape requires unicode mode", |
| 67 |
"schema": { |
| 68 |
"$schema": "https://json-schema.org/draft/2020-12/schema", |
| 69 |
"type": "string", |
| 70 |
"pattern": "^\\p{Letter}+$" |
| 71 |
}, |
| 72 |
"tests": [ |
| 73 |
{ |
| 74 |
"description": "ASCII letters match", |
| 75 |
"data": "Hello", |
| 76 |
"valid": true |
| 77 |
}, |
| 78 |
{ |
| 79 |
"description": "Non-ASCII letters match", |
| 80 |
"data": "π", |
| 81 |
"valid": true |
| 82 |
}, |
| 83 |
{ |
| 84 |
"description": "Digits do not match", |
| 85 |
"data": "123", |
| 86 |
"valid": false |
| 87 |
} |
| 88 |
] |
| 89 |
} |
| 90 |
] |