diff options
-rw-r--r-- | jsonschema/_utils.py | 19 |
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: |