Page MenuHomeSoftware Heritage

Add api_origin_metadata_search.
ClosedPublic

Authored by vlorentz on Nov 30 2018, 1:16 PM.

Diff Detail

Repository
rDWAPPS Web applications
Branch
api_origin_metadata_search
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 2740
Build 3430: tox-on-jenkinsJenkins
Build 3429: arc lint + arc unit

Event Timeline

Help wanted: currently failing, but I don't understand why. The code and tests should behave the same way as for api_origin_search

zack added inline comments.
swh/web/api/views/origin.py
192

We should've an hardcoded max for limit: uses can specify a larger value than that, but in that case the hardcoded value would win, restricting the result set size.

  • Fix api_origin_metadata_search.
anlambert added a subscriber: anlambert.
anlambert added inline comments.
swh/web/api/views/origin.py
218

You must raise a swh.web.common.exc.BadInputExc here.

An exception filter is set by the api_doc decorator that will translate it to a response with
status code 400.
By default the api endpoints must return list or dict that will get wrapped to a drf response
(see swh.web.api.apiresponse module). If you want to handle the response directly,
you must pass handle_response=True to the api_doc decorator.

This revision now requires changes to proceed.Dec 3 2018, 11:05 AM
  • Fix error handling + add test.
vlorentz added inline comments.
swh/web/api/views/origin.py
218

Fixed, thanks.

I also added a test for that, which fails because Django infinite-loops while handling the exception -_-

vlorentz added inline comments.
swh/web/api/views/origin.py
218

infinite-recurses *

swh/web/tests/api/views/test_origin.py
295

You should not pass the fulltext parameter for that test to succed no ?

vlorentz added inline comments.
swh/web/tests/api/views/test_origin.py
295

indeed, thanks -_-

This revision is now accepted and ready to land.Dec 3 2018, 11:31 AM
vlorentz marked an inline comment as done.
  • Fix limit handling.
  • Bound the limit to 100.
vlorentz marked an inline comment as done.
This revision was automatically updated to reflect the committed changes.