Skip to content

Commit

Permalink
Fixes #228
Browse files Browse the repository at this point in the history
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 <savik.ne@gmail.com>
  • Loading branch information
xSAVIKx committed Oct 29, 2023
1 parent 96407d0 commit 215c971
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cloudevents/pydantic/v2/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def _ce_json_dumps(self) -> typing.Dict[str, typing.Any]:
def _get_attributes(self) -> typing.Dict[str, typing.Any]:
return {
key: conversion.best_effort_encode_attribute_value(value)
for key, value in self.__dict__.items()
for key, value in dict(BaseModel.__iter__(self)).items()
if key not in ["data"]
}

Expand Down

0 comments on commit 215c971

Please sign in to comment.