Skip to content

Commit a66abc1

Browse files
Fix linting issue with minor refactoring.
1 parent 0597033 commit a66abc1

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

infrahub_sdk/spec/object.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -479,17 +479,10 @@ async def create_node(
479479
# - if the relationship is not bidirectional, then we need to create the related object First
480480
if rel_info.format == RelationshipDataFormat.MANY_REF and isinstance(value, list):
481481
# Cardinality-many reference: normalize string HFIDs to list format if peer has HFID defined
482-
if rel_info.peer_has_hfid:
483-
clean_data[key] = normalize_hfid_references(value)
484-
else:
485-
clean_data[key] = value
482+
clean_data[key] = normalize_hfid_references(value) if rel_info.peer_has_hfid else value
486483
elif rel_info.format == RelationshipDataFormat.ONE_REF:
487-
# Cardinality-one reference: normalize string to HFID list format only if peer has HFID defined
488-
if rel_info.peer_has_hfid:
489-
clean_data[key] = normalize_hfid_reference(value)
490-
else:
491-
# No HFID defined, pass value as-is (string becomes {"id": ...}, list stays as-is)
492-
clean_data[key] = value
484+
# Cardinality-one reference: normalize string to HFID list if peer has HFID, else pass as-is
485+
clean_data[key] = normalize_hfid_reference(value) if rel_info.peer_has_hfid else value
493486
elif not rel_info.is_reference and rel_info.is_bidirectional and rel_info.is_mandatory:
494487
remaining_rels.append(key)
495488
elif not rel_info.is_reference and not rel_info.is_mandatory:

0 commit comments

Comments
 (0)