Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move reference_resolver into address_resolver #688

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion src/services/document_service/document_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down