-
-
Notifications
You must be signed in to change notification settings - Fork 931
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
Give user registered types priority when encoding / decoding JSON #2188
base: main
Are you sure you want to change the base?
Give user registered types priority when encoding / decoding JSON #2188
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2188 +/- ##
==========================================
+ Coverage 81.50% 81.51% +0.01%
==========================================
Files 77 77
Lines 9522 9533 +11
Branches 1151 1156 +5
==========================================
+ Hits 7761 7771 +10
Misses 1569 1569
- Partials 192 193 +1 ☔ View full report in Codecov by Sentry. |
52b2f86
to
247cf3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix the lint errors as well
e9cfe80
to
21430db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I briefly reviewed the PR and it looks nice but I wonder if anything might break due to the split, even though it makes sense.
21430db
to
b3d4bb7
Compare
b3d4bb7
to
7a20cbd
Compare
technically the change is a breaking change |
we have to release in in a new major version like 5.5/5.6 |
User registered types should take priority over default types in Kombu.
Although users can currently override the encoder/decoder for a Kombu registered type by calling
register_type
(for example callingregister_type(Decimal, ...)
in their own code), this doesn't work well when it comes to subclassing. If users currently need to pass subclasses of any Celery registered types (datetime, date, time, Decimal or UUID) they would be forced to either:_encoders
dictionary in the Kombu json module, pop the value for the superclass, add their subclass, and then re-add the superclass.By separating user registered types and Kombu registered types into separate dictionaries, we can always give priority to user registered types instead, which simplifies this process for users (although technically it is a breaking change from existing behaviour).
Solves #1895