def flatten_attribute_type(self, target: Class, attr: Attr, attr_type: AttrType): """Flatten attribute type if it's a simple type otherwise check for circular reference or missing type.""" simple_source = self.find_attr_simple_type(target, attr_type) if simple_source: self.merge_attribute_type(simple_source, target, attr, attr_type) else: complex_source = self.find_attr_type(target, attr_type) if complex_source: attr_type.self_ref = self.class_depends_on( complex_source, target) else: logger.warning("Missing type: %s", attr_type.name) self.reset_attribute_type(attr_type)
def reset_attribute_type(cls, attr_type: AttrType): attr_type.name = DataType.STRING.code attr_type.native = True attr_type.self_ref = False attr_type.forward_ref = False