diff --git a/src/common/providers/reference_resolver.py b/src/common/providers/address_resolver/reference_resolver.py similarity index 74% rename from src/common/providers/reference_resolver.py rename to src/common/providers/address_resolver/reference_resolver.py index ae1cdfba1..790fafdca 100644 --- a/src/common/providers/reference_resolver.py +++ b/src/common/providers/address_resolver/reference_resolver.py @@ -123,39 +123,19 @@ def resolve_references_in_entity( return entity for key, value in entity.items(): - if isinstance(value, dict) or isinstance(value, list): # Potentially complex - if not value: - continue - if isinstance(value, list): # If it's a list, resolve any references - entity[key] = _resolve_reference_list( - value, - data_source, - get_data_source, - current_id, - depth, - depth_count + 1, + if not value: + continue + elif isinstance(value, list): # If it's a list, resolve any references + entity[key] = _resolve_reference_list( + value, data_source, get_data_source, current_id, depth, depth_count + 1 + ) + elif isinstance(value, dict): + if is_reference(value): + entity[key] = _get_complete_sys_document( + value, data_source, get_data_source, current_id, depth, depth_count + 1 ) else: - if is_reference(value): - if depth_count <= depth: - entity[key] = _get_complete_sys_document( - value, - data_source, - get_data_source, - current_id, - depth, - depth_count + 1, - ) - continue - entity[key] = value - else: - entity[key] = resolve_references_in_entity( - value, - data_source, - get_data_source, - current_id, - depth, - depth_count + 1, - ) - + entity[key] = resolve_references_in_entity( + value, data_source, get_data_source, current_id, depth, depth_count + 1 + ) return entity diff --git a/src/services/document_service/document_service.py b/src/services/document_service/document_service.py index 6363f6532..4bdf1ab88 100644 --- a/src/services/document_service/document_service.py +++ b/src/services/document_service/document_service.py @@ -17,8 +17,8 @@ ResolvedAddress, resolve_address, ) +from common.providers.address_resolver.reference_resolver import resolve_references_in_entity from common.providers.blueprint_provider import get_blueprint_provider -from common.providers.reference_resolver import resolve_references_in_entity from common.providers.storage_recipe_provider import ( create_default_storage_recipe, storage_recipe_provider,