Skip to content

Commit

Permalink
refactor: reference resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
pbullhove committed Nov 7, 2023
1 parent b8934ea commit 961b332
Showing 1 changed file with 13 additions and 33 deletions.
46 changes: 13 additions & 33 deletions src/common/providers/address_resolver/reference_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 961b332

Please sign in to comment.