summaryrefslogtreecommitdiff
path: root/json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-08-08 10:39:01 +0300
committerJulian Berman <Julian@GrayVines.com>2022-08-08 10:39:01 +0300
commita593a15341f3da9504219793732430fdee835645 (patch)
treeadf896170389baa07e42b93d64ff6701d7ba91df /json
parent658775f6c6228e2aff7a52ac4a20dd85369a304a (diff)
parent297cb8c4830ef4080d6ccf7ef7e0c0a4eb94342c (diff)
downloadjsonschema-a593a15341f3da9504219793732430fdee835645.tar.gz
Merge commit '297cb8c4830ef4080d6ccf7ef7e0c0a4eb94342c'
* commit '297cb8c4830ef4080d6ccf7ef7e0c0a4eb94342c': Squashed 'json/' changes from 0015d5242..597b1fb0d
Diffstat (limited to 'json')
-rw-r--r--json/tests/draft-next/properties.json54
-rw-r--r--json/tests/draft-next/required.json46
-rw-r--r--json/tests/draft2019-09/properties.json54
-rw-r--r--json/tests/draft2019-09/required.json46
-rw-r--r--json/tests/draft2020-12/properties.json54
-rw-r--r--json/tests/draft2020-12/required.json46
-rw-r--r--json/tests/draft4/properties.json54
-rw-r--r--json/tests/draft4/required.json46
-rw-r--r--json/tests/draft6/properties.json54
-rw-r--r--json/tests/draft6/required.json46
-rw-r--r--json/tests/draft7/properties.json54
-rw-r--r--json/tests/draft7/required.json46
12 files changed, 600 insertions, 0 deletions
diff --git a/json/tests/draft-next/properties.json b/json/tests/draft-next/properties.json
index 21a2e09..5b971ca 100644
--- a/json/tests/draft-next/properties.json
+++ b/json/tests/draft-next/properties.json
@@ -178,5 +178,59 @@
"valid": true
}
]
+ },
+ {
+ "description": "properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": {
+ "properties": {
+ "__proto__": {"type": "number"},
+ "toString": {
+ "properties": { "length": { "type": "string" } }
+ },
+ "constructor": {"type": "number"}
+ }
+ },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "__proto__ not valid",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString not valid",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor not valid",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present and valid",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft-next/required.json b/json/tests/draft-next/required.json
index abf18f3..8d8087a 100644
--- a/json/tests/draft-next/required.json
+++ b/json/tests/draft-next/required.json
@@ -101,5 +101,51 @@
"valid": false
}
]
+ },
+ {
+ "description": "required properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": { "required": ["__proto__", "toString", "constructor"] },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": false
+ },
+ {
+ "description": "__proto__ present",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString present",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor present",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/properties.json b/json/tests/draft2019-09/properties.json
index 21a2e09..5b971ca 100644
--- a/json/tests/draft2019-09/properties.json
+++ b/json/tests/draft2019-09/properties.json
@@ -178,5 +178,59 @@
"valid": true
}
]
+ },
+ {
+ "description": "properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": {
+ "properties": {
+ "__proto__": {"type": "number"},
+ "toString": {
+ "properties": { "length": { "type": "string" } }
+ },
+ "constructor": {"type": "number"}
+ }
+ },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "__proto__ not valid",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString not valid",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor not valid",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present and valid",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/required.json b/json/tests/draft2019-09/required.json
index abf18f3..8d8087a 100644
--- a/json/tests/draft2019-09/required.json
+++ b/json/tests/draft2019-09/required.json
@@ -101,5 +101,51 @@
"valid": false
}
]
+ },
+ {
+ "description": "required properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": { "required": ["__proto__", "toString", "constructor"] },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": false
+ },
+ {
+ "description": "__proto__ present",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString present",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor present",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft2020-12/properties.json b/json/tests/draft2020-12/properties.json
index 21a2e09..5b971ca 100644
--- a/json/tests/draft2020-12/properties.json
+++ b/json/tests/draft2020-12/properties.json
@@ -178,5 +178,59 @@
"valid": true
}
]
+ },
+ {
+ "description": "properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": {
+ "properties": {
+ "__proto__": {"type": "number"},
+ "toString": {
+ "properties": { "length": { "type": "string" } }
+ },
+ "constructor": {"type": "number"}
+ }
+ },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "__proto__ not valid",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString not valid",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor not valid",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present and valid",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft2020-12/required.json b/json/tests/draft2020-12/required.json
index abf18f3..8d8087a 100644
--- a/json/tests/draft2020-12/required.json
+++ b/json/tests/draft2020-12/required.json
@@ -101,5 +101,51 @@
"valid": false
}
]
+ },
+ {
+ "description": "required properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": { "required": ["__proto__", "toString", "constructor"] },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": false
+ },
+ {
+ "description": "__proto__ present",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString present",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor present",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft4/properties.json b/json/tests/draft4/properties.json
index 9d0f259..195159e 100644
--- a/json/tests/draft4/properties.json
+++ b/json/tests/draft4/properties.json
@@ -147,5 +147,59 @@
"valid": true
}
]
+ },
+ {
+ "description": "properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": {
+ "properties": {
+ "__proto__": {"type": "number"},
+ "toString": {
+ "properties": { "length": { "type": "string" } }
+ },
+ "constructor": {"type": "number"}
+ }
+ },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "__proto__ not valid",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString not valid",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor not valid",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present and valid",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft4/required.json b/json/tests/draft4/required.json
index 9b05318..6ccfdc2 100644
--- a/json/tests/draft4/required.json
+++ b/json/tests/draft4/required.json
@@ -85,5 +85,51 @@
"valid": false
}
]
+ },
+ {
+ "description": "required properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": { "required": ["__proto__", "toString", "constructor"] },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": false
+ },
+ {
+ "description": "__proto__ present",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString present",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor present",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft6/properties.json b/json/tests/draft6/properties.json
index 21a2e09..5b971ca 100644
--- a/json/tests/draft6/properties.json
+++ b/json/tests/draft6/properties.json
@@ -178,5 +178,59 @@
"valid": true
}
]
+ },
+ {
+ "description": "properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": {
+ "properties": {
+ "__proto__": {"type": "number"},
+ "toString": {
+ "properties": { "length": { "type": "string" } }
+ },
+ "constructor": {"type": "number"}
+ }
+ },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "__proto__ not valid",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString not valid",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor not valid",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present and valid",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft6/required.json b/json/tests/draft6/required.json
index abf18f3..8d8087a 100644
--- a/json/tests/draft6/required.json
+++ b/json/tests/draft6/required.json
@@ -101,5 +101,51 @@
"valid": false
}
]
+ },
+ {
+ "description": "required properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": { "required": ["__proto__", "toString", "constructor"] },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": false
+ },
+ {
+ "description": "__proto__ present",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString present",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor present",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft7/properties.json b/json/tests/draft7/properties.json
index 21a2e09..5b971ca 100644
--- a/json/tests/draft7/properties.json
+++ b/json/tests/draft7/properties.json
@@ -178,5 +178,59 @@
"valid": true
}
]
+ },
+ {
+ "description": "properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": {
+ "properties": {
+ "__proto__": {"type": "number"},
+ "toString": {
+ "properties": { "length": { "type": "string" } }
+ },
+ "constructor": {"type": "number"}
+ }
+ },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "__proto__ not valid",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString not valid",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor not valid",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present and valid",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft7/required.json b/json/tests/draft7/required.json
index abf18f3..8d8087a 100644
--- a/json/tests/draft7/required.json
+++ b/json/tests/draft7/required.json
@@ -101,5 +101,51 @@
"valid": false
}
]
+ },
+ {
+ "description": "required properties whose names are Javascript object property names",
+ "comment": "Ensure JS implementations don't universally consider e.g. __proto__ to always be present in an object.",
+ "schema": { "required": ["__proto__", "toString", "constructor"] },
+ "tests": [
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "none of the properties mentioned",
+ "data": {},
+ "valid": false
+ },
+ {
+ "description": "__proto__ present",
+ "data": { "__proto__": "foo" },
+ "valid": false
+ },
+ {
+ "description": "toString present",
+ "data": { "toString": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "constructor present",
+ "data": { "constructor": { "length": 37 } },
+ "valid": false
+ },
+ {
+ "description": "all present",
+ "data": {
+ "__proto__": 12,
+ "toString": { "length": "foo" },
+ "constructor": 37
+ },
+ "valid": true
+ }
+ ]
}
]