summaryrefslogtreecommitdiff
path: root/tests/draft2019-09/optional/format/regex.json
diff options
context:
space:
mode:
Diffstat (limited to 'tests/draft2019-09/optional/format/regex.json')
-rw-r--r--tests/draft2019-09/optional/format/regex.json51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/draft2019-09/optional/format/regex.json b/tests/draft2019-09/optional/format/regex.json
new file mode 100644
index 0000000..da32401
--- /dev/null
+++ b/tests/draft2019-09/optional/format/regex.json
@@ -0,0 +1,51 @@
+[
+ {
+ "description": "validation of regular expressions",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "format": "regex"
+ },
+ "tests": [
+ {
+ "description": "all string formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
+ "description": "a valid regular expression",
+ "data": "([abc])+\\s+$",
+ "valid": true
+ },
+ {
+ "description": "a regular expression with unclosed parens is invalid",
+ "data": "^(abc]",
+ "valid": false
+ }
+ ]
+ }
+]