@@ -574,6 +574,7 @@ def process_post_validation(self) -> None:
574574 self .process_dropdowns ()
575575 self .process_relationships ()
576576 self .process_human_friendly_id ()
577+ self .register_human_friendly_id ()
577578
578579 def _generate_identifier_string (self , node_kind : str , peer_kind : str ) -> str :
579580 return "__" .join (sorted ([node_kind , peer_kind ])).lower ()
@@ -909,7 +910,6 @@ def _is_attr_combination_unique(
909910 return False
910911
911912 def validate_human_friendly_id (self ) -> None :
912- self .hfids = HFIDs ()
913913 for name in self .generic_names_without_templates + self .node_names :
914914 node_schema = self .get (name = name , duplicate = False )
915915
@@ -943,11 +943,6 @@ def validate_human_friendly_id(self) -> None:
943943 rel_schemas_to_paths [rel_identifier ] = (schema_path .related_schema , [])
944944 rel_schemas_to_paths [rel_identifier ][1 ].append (schema_path .attribute_path_as_str )
945945
946- if node_schema .is_node_schema and node_schema .namespace not in ["Schema" , "Internal" ]:
947- self .hfids .register_hfid_schema_path (
948- kind = node_schema .kind , schema_path = schema_path , hfid = node_schema .human_friendly_id
949- )
950-
951946 if config .SETTINGS .main .schema_strict_mode :
952947 # For every relationship referred within hfid, check whether the combination of attributes is unique is the peer schema node
953948 for related_schema , attrs_paths in rel_schemas_to_paths .values ():
@@ -1549,6 +1544,34 @@ def process_human_friendly_id(self) -> None:
15491544 node .uniqueness_constraints = [hfid_uniqueness_constraint ]
15501545 self .set (name = node .kind , schema = node )
15511546
1547+ def register_human_friendly_id (self ) -> None :
1548+ """Register HFID automations
1549+
1550+ Register the HFIDs after all processing and validation has been done.
1551+ """
1552+
1553+ self .hfids = HFIDs ()
1554+ for name in self .generic_names_without_templates + self .node_names :
1555+ node_schema = self .get (name = name , duplicate = False )
1556+
1557+ if not node_schema .human_friendly_id :
1558+ continue
1559+
1560+ allowed_types = SchemaElementPathType .ATTR_WITH_PROP | SchemaElementPathType .REL_ONE_MANDATORY_ATTR
1561+
1562+ for hfid_path in node_schema .human_friendly_id :
1563+ schema_path = self .validate_schema_path (
1564+ node_schema = node_schema ,
1565+ path = hfid_path ,
1566+ allowed_path_types = allowed_types ,
1567+ element_name = "human_friendly_id" ,
1568+ )
1569+
1570+ if node_schema .is_node_schema and node_schema .namespace not in ["Schema" , "Internal" ]:
1571+ self .hfids .register_hfid_schema_path (
1572+ kind = node_schema .kind , schema_path = schema_path , hfid = node_schema .human_friendly_id
1573+ )
1574+
15521575 def process_hierarchy (self ) -> None :
15531576 for name in self .nodes .keys ():
15541577 node = self .get_node (name = name , duplicate = False )
0 commit comments