From 748ba9eaa0c1afebe7fcaf5cec5543958c5a2d12 Mon Sep 17 00:00:00 2001 From: Abi Ullattil Date: Thu, 27 Mar 2025 22:03:24 -0700 Subject: [PATCH] fix: Bug in pdl_schema_error_analyzer that raises exception during analysis When the PDL doesn't match the schema, the error analysis fails as it attempts to retrieve the field names without verifying that `"properties"` key exists in `ref_type`. This change returns an empty `dict` if `properties` key doesn't exist in `ref_type` to allow the error analysis to complete successfully. Signed-off-by: Abi Ullattil --- src/pdl/pdl_schema_error_analyzer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdl/pdl_schema_error_analyzer.py b/src/pdl/pdl_schema_error_analyzer.py index 9d797017d..96a7f6129 100644 --- a/src/pdl/pdl_schema_error_analyzer.py +++ b/src/pdl/pdl_schema_error_analyzer.py @@ -48,7 +48,7 @@ def get_non_null_type(schema): def match(ref_type, data): - all_fields = ref_type["properties"].keys() + all_fields = ref_type.get("properties", {}).keys() intersection = list(set(data.keys()) & set(all_fields)) return len(intersection)