Skip to content

Commit 215c971

Browse files
committed
Fixes #228
Pydantic v2 .__dict__ has different behavior from what Pydantic v1 had and is not giving us `extra` fields anymore. On the other hand the iterator over the event gives us extras as well Signed-off-by: Yurii Serhiichuk <[email protected]>
1 parent 96407d0 commit 215c971

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cloudevents/pydantic/v2/event.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def _ce_json_dumps(self) -> typing.Dict[str, typing.Any]:
209209
def _get_attributes(self) -> typing.Dict[str, typing.Any]:
210210
return {
211211
key: conversion.best_effort_encode_attribute_value(value)
212-
for key, value in self.__dict__.items()
212+
for key, value in dict(BaseModel.__iter__(self)).items()
213213
if key not in ["data"]
214214
}
215215

0 commit comments

Comments
 (0)