From c7c564fac25d5e12e33468c3056c1291c97a3389 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sat, 11 May 2024 11:51:15 +0200 Subject: [PATCH] Rename all 'parent_dict' to 'schema_parent' It's a much more fitting name --- src/classes/validationschema.gd | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/classes/validationschema.gd b/src/classes/validationschema.gd index 30efe96..e83b2bb 100644 --- a/src/classes/validationschema.gd +++ b/src/classes/validationschema.gd @@ -42,21 +42,21 @@ func _init(core_new: Core, schema_new: Dictionary, data_new: Dictionary, parent_ # Check Dictionary _check_dictionary_recursive(schema) -func _check_dictionary_recursive(parent_dict: Dictionary, path: String = "") -> bool: +func _check_dictionary_recursive(schema_parent: Dictionary, path: String = "") -> bool: var success: bool = false - for key in parent_dict: - if typeof(key) != TYPE_STRING: + for key in schema_parent: + if typeof(key) != TYPE_STRING: logger.error(core.stringify_variables("Could not parse schema: Schema key %key% is not of type String", { "key": path + "/" + key })) success = false continue - match(typeof(parent_dict[key])): + match(typeof(schema_parent[key])): TYPE_OBJECT: - if parent_dict[key].get_class() != "Node": + if schema_parent[key].get_class() != "Node": logger.error(core.stringify_variables("Could not parse schema: Schema value of %key% is not of type Node", { "key": path + "/" + key })) success = false continue TYPE_DICTIONARY: - _check_dictionary_recursive(parent_dict[key], path + "/" + key) + _check_dictionary_recursive(schema_parent[key], path + "/" + key) _: logger.error(core.stringify_variables("Could not parse schema: Schema value of %key% is not of type CoreValidationSingle or Dictionary", { "key": path + "/" + key })) success = false @@ -67,9 +67,9 @@ func _check_dictionary_recursive(parent_dict: Dictionary, path: String = "") -> func evaluate() -> Array[String]: return _evaluate_recursive(str(randf()).repeat(50), schema) -func _evaluate_recursive(random: String, parent_dict: Dictionary, path: String = "") -> Array[String]: +func _evaluate_recursive(random: String, schema_parent: Dictionary, path: String = "") -> Array[String]: var failed: Array[String] = [] - for key in parent_dict: + for key in schema_parent: # Check if key exists in data if str(data.get(key, random)) == random: # Does not exist, append error