_evaluate_recursive() now uses the correct vars

This commit is contained in:
JeremyStar™ 2024-05-11 11:55:04 +02:00
parent 5b0713f1cf
commit 8974d190cd
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -76,15 +76,15 @@ func _evaluate_recursive(random: String, schema_parent: Dictionary, data_parent:
failed.append(core.stringify_variables("Key %key% is present in schema but missing in data", { "key": path + "/" + key }))
else:
# Exists in data
if typeof(schema[key]) == TYPE_DICTIONARY:
if typeof(schema_parent[key]) == TYPE_DICTIONARY:
# Key is of type Dictionary, allow for recursion to happen
failed.append_array(_evaluate_recursive(random, schema[key], data[key], path + "/" + key))
failed.append_array(_evaluate_recursive(random, schema_parent[key], data_parent[key], path + "/" + key))
else:
# Key is not of type Dictionary, evaluate against data
schema[key].data = data[key]
if !schema[key].evaluate():
schema_parent[key].data = data_parent[key]
if !schema_parent[key].evaluate():
logger.error(core.stringify_variables("Validation for key %key% failed", { "key": path + "/" + key }))
for failure in schema[key].failures:
for failure in schema_parent[key].failures:
# Append failures from single
failed.append(key + ": " + failure)