You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Adds `payload_schema_dump: bool = True` arg to `dispatch`, `_derive_event_name_and_payload_from_pydantic_model` and `_validate_payload`. When `False`, the event handlers are called "live" pydantic model for payload. The default behaviour is unchanged.
- Updates tests for this new functionality.
Closesmelvinkcx#56
- Adds `payload_schema_dump: bool = True` arg to `dispatch`, `_derive_event_name_and_payload_from_pydantic_model` and `_validate_payload`. When `False`, the event handlers are called "live" pydantic model for payload. The default behaviour is unchanged.
- Updates tests for this new functionality.
Closesmelvinkcx#56
Request:
When using pydantic models for events, they are dumped to dict by
fastapi-events
.Motivation
This is convenient but restrictive. A pydantic model is often more useful for a handler than a dict:
isinstance
on it. This is particularly useful for events where one handler callback handles multiple event types.Proposed API
Add arg
payload_schema_dump: bool = True
todispatch
.The default behaviour is unchanged. When this is set to
False
, handlers are called with the pydantic model as the payload.If
validate_payload is True
, we still do the round-trip to re-validate the payload, but skip the final dump.The text was updated successfully, but these errors were encountered: