(validator, instance, schema)
return evaluated_keys
Get all keys of items that get evaluated under the current schema

    Covers all keywords related to unevaluatedProperties: properties,
    additionalProperties, unevaluatedProperties, patternProperties,
    dependentSchemas, allOf, oneOf, anyOf, if, then, else
Get all keys of items that get evaluated under the current schema
Get all keys of items that get evaluated under the current schema
def find_evaluated_property_keys_by_schema(validator, instance, schema):
    """
    Get all keys of items that get evaluated under the current schema

    Covers all keywords related to unevaluatedProperties: properties,
    additionalProperties, unevaluatedProperties, patternProperties,
    dependentSchemas, allOf, oneOf, anyOf, if, then, else
    """
    if validator.is_type(schema, "boolean"):
        return []
    evaluated_keys = []

    if "$ref" in schema:
        scope, resolved = validator.resolver.resolve(schema["$ref"])
        validator.resolver.push_scope(scope)

        try:
            evaluated_keys += find_evaluated_property_keys_by_schema(
                validator, instance, resolved,
            )
        finally:
            validator.resolver.pop_scope()

    for keyword in [
        "properties", "additionalProperties", "unevaluatedProperties",
    ]:
        if keyword in schema:
            if validator.is_type(schema[keyword], "boolean"):
                for property, value in instance.items():
                    if validator.evolve(schema=schema[keyword]).is_valid(
                        {property: value},
                    ):
                        evaluated_keys.append(property)

            if 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]):
                        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}):
                    evaluated_keys.append(property)

    if "dependentSchemas" in schema:
        for property, subschema in schema["dependentSchemas"].items():
            if property not in instance:
                continue
            evaluated_keys += find_evaluated_property_keys_by_schema(
                validator, instance, subschema,
            )

    for keyword in ["allOf", "oneOf", "anyOf"]:
        if keyword in schema:
            for subschema in schema[keyword]:
                errs = list(validator.descend(instance, subschema))
                if not errs:
                    evaluated_keys += find_evaluated_property_keys_by_schema(
                        validator, instance, subschema,
                    )

    if "if" in schema:
        if validator.evolve(schema=schema["if"]).is_valid(instance):
            evaluated_keys += find_evaluated_property_keys_by_schema(
                validator, instance, schema["if"],
            )
            if "then" in schema:
                evaluated_keys += find_evaluated_property_keys_by_schema(
                    validator, instance, schema["then"],
                )
        else:
            if "else" in schema:
                evaluated_keys += find_evaluated_property_keys_by_schema(
                    validator, instance, schema["else"],
                )

    return evaluated_keys
def find_evaluated_property_keys_by_schema ( validator , instance , schema ) : if validator . is_type ( schema , "boolean" ) : return [ ] evaluated_keys = [ ] if "$ref" in schema : scope , resolved = validator . resolver . resolve ( schema [ "$ref" ] ) validator . resolver . push_scope ( scope ) try : evaluated_keys += find_evaluated_property_keys_by_schema ( validator , instance , resolved , ) finally : validator . resolver . pop_scope ( ) for keyword in [ "properties" , "additionalProperties" , "unevaluatedProperties" , ] : if keyword in schema : if validator . is_type ( schema [ keyword ] , "boolean" ) : for property , value in instance . items ( ) : if validator . evolve ( schema = schema [ keyword ] ) . is_valid ( { property : value } , ) : evaluated_keys . append ( property ) if 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 ] ) : 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 } ) : evaluated_keys . append ( property ) if "dependentSchemas" in schema : for property , subschema in schema [ "dependentSchemas" ] . items ( ) : if property not in instance : continue evaluated_keys += find_evaluated_property_keys_by_schema ( validator , instance , subschema , ) for keyword in [ "allOf" , "oneOf" , "anyOf" ] : if keyword in schema : for subschema in schema [ keyword ] : errs = list ( validator . descend ( instance , subschema ) ) if not errs : evaluated_keys += find_evaluated_property_keys_by_schema ( validator , instance , subschema , ) if "if" in schema : if validator . evolve ( schema = schema [ "if" ] ) . is_valid ( instance ) : evaluated_keys += find_evaluated_property_keys_by_schema ( validator , instance , schema [ "if" ] , ) if "then" in schema : evaluated_keys += find_evaluated_property_keys_by_schema ( validator , instance , schema [ "then" ] , ) else : if "else" in schema : evaluated_keys += find_evaluated_property_keys_by_schema ( validator , instance , schema [ "else" ] , ) return evaluated_keys