diff --git a/cloudevents/pydantic/v2/event.py b/cloudevents/pydantic/v2/event.py index 890c03d1..4ae8bb5c 100644 --- a/cloudevents/pydantic/v2/event.py +++ b/cloudevents/pydantic/v2/event.py @@ -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"] }