@@ -14,13 +14,23 @@ class AAPIJob:
1414
1515
1616class AAPIObject :
17- def as_aapi_dict (self ):
17+ def as_aapi_dict (self , ignore_event_type = True ):
18+
19+ # Import inside the method to prevent circular import issues
20+ from aapi .ifbase import IfCompletionStatus
21+
1822 res = {}
1923
20- if "_type" in attrs .fields_dict (self .__class__ ):
21- if not self ._type .startswith ("Condition" ) or self ._type .startswith ("Event" ):
22- res ["Type" ] = self ._type
24+ if '_type' in attrs .fields_dict (self .__class__ ):
25+ is_condition_or_event = self ._type .startswith (('Condition' , 'Event' ))
26+
27+ if ignore_event_type :
28+ if not is_condition_or_event :
29+ res ['Type' ] = self ._type
30+ elif self ._type .startswith ('Event' ):
31+ res ['Type' ] = self ._type
2332
33+
2434 if attrs .has (self ):
2535 for field in attrs .fields (self .__class__ ):
2636 value = self .__getattribute__ (field .name )
@@ -49,7 +59,10 @@ def as_aapi_dict(self):
4959
5060 elif field .metadata .get ("_abstract_aapi_container_" ):
5161 for obj in value :
52- res [obj .object_name ] = obj .as_aapi_dict ()
62+ obj_ignore_type = ignore_event_type
63+ if isinstance (self , IfCompletionStatus ):
64+ obj_ignore_type = False
65+ res [obj .object_name ] = obj .as_aapi_dict (ignore_event_type = obj_ignore_type )
5366
5467 else :
5568 res ["attrsibutes_valid" ] = False
0 commit comments