summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Konstantinov <ilya.konstantinov@gmail.com>2023-03-27 21:23:56 -0400
committerIlya Konstantinov <ilya.konstantinov@gmail.com>2023-03-27 21:23:56 -0400
commit1583370bc1cba5adf1da3db090f3711f2e90213c (patch)
tree222110cc6d70fcb91cf1f8c27f34a0c143bf09a6
parentd09feb650ba8d8af88b4f4e193b50e959bcb4a96 (diff)
downloadjsonschema-1583370bc1cba5adf1da3db090f3711f2e90213c.tar.gz
Do not validate for unevaluatedProperties
-rw-r--r--jsonschema/_utils.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/jsonschema/_utils.py b/jsonschema/_utils.py
index 3f1a440..223f2df 100644
--- a/jsonschema/_utils.py
+++ b/jsonschema/_utils.py
@@ -275,26 +275,19 @@ def find_evaluated_property_keys_by_schema(validator, instance, schema):
"properties", "additionalProperties", "unevaluatedProperties",
]:
if keyword in schema:
- if validator.is_type(schema[keyword], "boolean"):
+ if validator.is_type(schema[keyword], "boolean") and schema[keyword]:
for property, value in instance.items():
- if validator.evolve(schema=schema[keyword]).is_valid(
- {property: value},
- ):
- evaluated_keys.append(property)
+ evaluated_keys.append(property)
- if validator.is_type(schema[keyword], "object"):
+ elif validator.is_type(schema[keyword], "object"):
for property, subschema in schema[keyword].items():
- if property in instance and validator.evolve(
- schema=subschema,
- ).is_valid(instance[property]):
+ if property in instance:
evaluated_keys.append(property)
if "patternProperties" in schema:
for property, value in instance.items():
- for pattern, _ in schema["patternProperties"].items():
- if re.search(pattern, property) and validator.evolve(
- schema=schema["patternProperties"],
- ).is_valid({property: value}):
+ for pattern in schema["patternProperties"]:
+ if re.search(pattern, property):
evaluated_keys.append(property)
if "dependentSchemas" in schema: