Skip to content

Commit

Permalink
refactor: move everything into address_resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
pbullhove committed Oct 31, 2023
1 parent bc86a4e commit 4cbad2a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,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(
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
4 changes: 3 additions & 1 deletion src/services/document_service/document_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
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,
Expand Down

0 comments on commit 4cbad2a

Please sign in to comment.