-
Notifications
You must be signed in to change notification settings - Fork 116
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 Any serializer type regression breaking Ruby bindings #5936
Fix Any serializer type regression breaking Ruby bindings #5936
Conversation
I'd like to request that 3.63 receive the back port since that's what's in the Katello 4.15 matrix. |
pulpcore/app/serializers/fields.py
Outdated
@extend_schema_field(OpenApiTypes.OBJECT) | ||
class JSONObjectField(serializers.JSONField): | ||
"""A drf JSONField override to force openapi schema to use 'object' type. | ||
|
||
Not strictly correct, but we relied on that for a long time. | ||
See: https://github.com/tfranzel/drf-spectacular/issues/1095 | ||
""" |
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.
Let me understand this right. It sounds like a stop gap solution. But I think we are rather close to a good solution here. Most of our JSONFields actually require an object/dict. So how about we call this thing a JSONDictField
(IMHO, the domain of the problem here is rather a python dev then an OpenAPIv3 connoisseur. So I prefer Dict over Object.) and it suddenly does not sound like an accident anymore. Instead when you use that field on a serializer, you are explicit about it needing a dictionary. At the same time we just ban the use of an un-annotated plain JSONField.
(Obviously, now this means, search and replace without reviewing is a bad idea again.)
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.
"Object" here is about the Json spec object structure: https://datatracker.ietf.org/doc/html/rfc7159#section-4
The correct name for this field as it is now would be JSONPrimitiveField (as drf docs calls a any-json entity), which reflects it can be any primitive.
I would like to get the fields right, which would involve switching to DictField and ListFIeld, mosly. I opened this PR on RPM which does that with some care, but the concern is that it changes/breaks the API pulp/pulp_rpm#3657 (comment).
ed1fd6d
to
738216c
Compare
Changed the name. Also here is the 3.63 backport: #5938 |
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.
Thank you! I'd really like to make it sound less like an accident. Also we may want to export this helper in the plugin api.
That would be OK as a follow up PR.
Yeah, agree |
Backport to 3.21: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 58425d7 on top of patchback/backports/3.21/58425d791296752be427a43cda9df0d2403bc7bc/pr-5936 Backporting merged PR #5936 into main
🤖 @patchback |
Backport to 3.22: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 58425d7 on top of patchback/backports/3.22/58425d791296752be427a43cda9df0d2403bc7bc/pr-5936 Backporting merged PR #5936 into main
🤖 @patchback |
Backport to 3.39: 💚 backport PR created✅ Backport PR branch: Backported as #5944 🤖 @patchback |
Backport to 3.28: 💚 backport PR created✅ Backport PR branch: Backported as #5945 🤖 @patchback |
Backport to 3.49: 💚 backport PR created✅ Backport PR branch: Backported as #5946 🤖 @patchback |
Backport to 3.66: 💚 backport PR created✅ Backport PR branch: Backported as #5947 🤖 @patchback |
See pulp/pulp_rpm#3639