Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pydantic custom attributes #229

Merged
merged 9 commits into from
Oct 30, 2023
Merged

Fix Pydantic custom attributes #229

merged 9 commits into from
Oct 30, 2023

Conversation

xSAVIKx
Copy link
Member

@xSAVIKx xSAVIKx commented Oct 29, 2023

Fixes #228

Changes

The Pydantic v2 __dict__ does not provide extras anymore, so making sure we're catching them using Pydantic's parent model iteration.

  • Tests pass

Replicates bug test data from the #228

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
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>
Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
@xSAVIKx xSAVIKx self-assigned this Oct 29, 2023
Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
@xSAVIKx xSAVIKx requested a review from a team October 29, 2023 21:35
Copy link

@Klaudioz Klaudioz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xSAVIKx xSAVIKx merged commit 21572af into main Oct 30, 2023
33 checks passed
@xSAVIKx xSAVIKx deleted the fix/cloudevents-custom-attrs branch October 30, 2023 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

to_json on a pydantic.CloudEvent does not include extension values
2 participants