-
Notifications
You must be signed in to change notification settings - Fork 217
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
Remove MediaViewSet's lookup regex #5273
Conversation
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.
The change looks good. I couldn't find any preexisting tests for bad regexes in the path, should we add one to api/test/unit/views/test_media_views.py
?
@dhruvkb There is a test for the detail view: openverse/api/test/integration/test_media_integration.py Lines 312 to 316 in c4acdf8
Of course, I can also add another one for the related endpoint. However, this starts to step into the realm of testing Django Rest Framework functionality. I'll need some help with the error from the schemathesis tests, tho. It's failing because the content types are not matching, which makes sense, but I don't see where that can be fixed. Perhaps you or @obulat, who has more knowledge of these tests, can identify it more easily. Those docs tests have been highly inconsistent in my local environment, too.
|
556698e
to
041735b
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.
The changes look good to me, thanks for monitoring TODO
s and resolving them.
I found a few things missing, and a fix for schemathesis that I've pushed to a follow up PR #5276. Please review that PR, merge it into this and then this into main
.
Description
Since the upstream issue (encode/django-rest-framework#6789) is fixed, it's safe to remove this workaround to handle invalid UUID-like strings. This way, DRF handles better these requests and responses are consistent with the rest.
Response in production
https://api.openverse.org/v1/images/000000000000000000000000000000000000/related/
Response in this branch
http://localhost:50280/v1/images/000000000000000000000000000000000000/related/
Testing Instructions
Run the API,
just api/up
, and check other invalid UUIDs from the original issue (WordPress/openverse-api#729) if you wish.Checklist
Update index.md
).main
) or a parent feature branch.ov just catalog/generate-docs
for catalog PRs) or the media properties generator (ov just catalog/generate-docs media-props
for the catalog orov just api/generate-docs
for the API) where applicable.Developer Certificate of Origin
Developer Certificate of Origin