feat: Add flow_id serialization in Message class
This commit adds the `serialize_flow_id` method to the `Message` class in the `message.py` file. This method serializes the `flow_id` attribute of a `Message` object, converting it to a UUID if it is a string. This ensures consistent serialization of the `flow_id` attribute when working with the `Message` class.
This commit is contained in:
parent
46dcc2ef56
commit
f7a61f5847
1 changed files with 6 additions and 0 deletions
|
|
@ -41,6 +41,12 @@ class Message(Data):
|
|||
value = str(value)
|
||||
return value
|
||||
|
||||
@field_serializer("flow_id")
|
||||
def serialize_flow_id(value):
|
||||
if isinstance(value, str):
|
||||
return UUID(value)
|
||||
return value
|
||||
|
||||
@field_validator("files", mode="before")
|
||||
@classmethod
|
||||
def validate_files(cls, value):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue