From 8974d190cda8860db562c170c9b5f14a35b2ea4f Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sat, 11 May 2024 11:55:04 +0200 Subject: [PATCH] _evaluate_recursive() now uses the correct vars --- src/classes/validationschema.gd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/classes/validationschema.gd b/src/classes/validationschema.gd index f52fd0c..6527e80 100644 --- a/src/classes/validationschema.gd +++ b/src/classes/validationschema.gd @@ -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)