Closed
Description
Discriminator methods are generated without the various discriminator options
E.g
@staticmethod
def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> Attachment:
"""
Creates a new instance of the appropriate class based on discriminator value
Args:
parseNode: The parse node to use to read the discriminator value and create the object
Returns: Attachment
"""
if parse_node is None:
raise Exception("parse_node cannot be undefined")
return Attachment()
should be
@staticmethod
def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> Attachment:
"""
Creates a new instance of the appropriate class based on discriminator value
Args:
parseNode: The parse node to use to read the discriminator value and create the object
Returns: Attachment
"""
if parse_node is None:
raise Exception("parse_node cannot be undefined")
mapping_value_node = parse_node.get_child_node("@odata.type")
if mapping_value_node:
mapping_value = mapping_value_node.get_str_value()
if mapping_value == "#microsoft.graph.fileAttachment":
return file_attachment.FileAttachment()
if mapping_value == "#microsoft.graph.itemAttachment":
return item_attachment.ItemAttachment()
if mapping_value == "#microsoft.graph.referenceAttachment":
return reference_attachment.ReferenceAttachment()
return Attachment()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Type
Projects
Status
Done ✔️