33from typing import Any , Optional , Union
44from uuid import uuid4
55
6- from pydantic import BaseModel , Field , field_serializer , field_validator
6+ from pydantic import AliasChoices , BaseModel , Field , field_serializer , field_validator
77from pydantic_extra_types .color import Color , ColorType
88
99from .options import CaptionAlignment
@@ -19,9 +19,15 @@ class Relationship(BaseModel, extra="allow"):
1919 default_factory = lambda : uuid4 ().hex , description = "Unique identifier for the relationship"
2020 )
2121 source : Union [str , int ] = Field (
22- serialization_alias = "from" , description = "Node ID where the relationship points from"
22+ serialization_alias = "from" ,
23+ validation_alias = AliasChoices ("source" , "sourceNodeId" , "source_node_id" , "from" ),
24+ description = "Node ID where the relationship points from" ,
25+ )
26+ target : Union [str , int ] = Field (
27+ serialization_alias = "to" ,
28+ validation_alias = AliasChoices ("target" , "targetNodeId" , "target_node_id" , "to" ),
29+ description = "Node ID where the relationship points to" ,
2330 )
24- target : Union [str , int ] = Field (serialization_alias = "to" , description = "Node ID where the relationship points to" )
2531 caption : Optional [str ] = Field (None , description = "The caption of the relationship" )
2632 caption_align : Optional [CaptionAlignment ] = Field (
2733 None , serialization_alias = "captionAlign" , description = "The alignment of the caption text"
0 commit comments