Skip to content

Commit

Permalink
fix: pydantic v2 deprecation warning for dict
Browse files Browse the repository at this point in the history
  • Loading branch information
psychedelicious committed Feb 19, 2024
1 parent ecef554 commit f1593b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fastapi_events/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ def _derive_event_name_and_payload_from_pydantic_model(

if not payload:
payload_schema_cls_dict_args = payload_schema_cls_dict_args or DEFAULT_PAYLOAD_SCHEMA_CLS_DICT_ARGS
payload = event_name_or_model.dict(**payload_schema_cls_dict_args)
if IS_PYDANTIC_V1:
payload = event_name_or_model.dict(**payload_schema_cls_dict_args)
else:
payload = event_name_or_model.model_dump(**payload_schema_cls_dict_args)

return event_name, payload

Expand Down

0 comments on commit f1593b3

Please sign in to comment.