REST API docs not supporting testing with parameters
Categories
(Tree Management :: Treeherder, defect, P5)
Tracking
(Not tracked)
People
(Reporter: armenzg, Unassigned)
Details
(Keywords: good-first-bug)
Attachments
(1 file)
|
692.38 KB,
image/png
|
Details |
I need to pass the parameter signature_id, push_id or job_id, however, I can't.
You can try this API:
https://treeherder.mozilla.org/docs/#project-performance-data-list
Comment 1•5 years ago
|
||
The problem is here: https://github.com/mozilla/treeherder/blob/89f7d4f46ce3a723d340fb111bdd3a2f23952df2/treeherder/webapp/api/performance_data.py#L199
Comment 2•5 years ago
|
||
I got what the problem might be
The code reads
if not (signature_ids or signature_hashes or push_ids or job_ids)
Which means that if any of these four is not present, an exception will be raised.
However, we want that if none of the four is present, exception should be raised.
Please confirm if I have understood the issue correctly and shall I go on solving it
Comment 3•5 years ago
|
||
Oh! Sorry. I just realized that I had understood it completely wrong.
| Reporter | ||
Comment 4•5 years ago
|
||
You're misunderstanding the problem.
The UI does not allow to pass those parameters. There are no fields to enter the values.
On another note, it seems that the docs URL is now hitting 500 error code.
Probably related to the Django or Django Rest framework update.
Stack trace
builtins:AttributeError: 'AutoSchema' object has no attribute 'get_link'
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 418, in _nr_wrapper_BaseHandler_get_response_
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 75, in get_response
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/whitenoise/middleware.py", line 58, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 1183, in _wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 539, in wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
File "/app/.heroku/python/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/component_djangorestframework.py", line 46, in _nr_wrapper_APIView_dispatch_
File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch
File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/component_djangorestframework.py", line 53, in _handle_exception_wrapper
File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/schemas/views.py", line 48, in handle_exception
File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception
File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch
File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/schemas/views.py", line 37, in get
File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/schemas/coreapi.py", line 156, in get_sche
Comment 5•5 years ago
|
||
Yes , it is giving error 500 due to a Django Rest Framework update.
We need adding
REST_FRAMEWORK = { 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema' }
to treeherder/config/settings.py. Workds well for me.
I also think that I understood the error now. Shall I try solving it and adding this line to settings.py too!
| Reporter | ||
Comment 6•5 years ago
|
||
Yes, please. Thank you so much!
Could you please make them separae PRs?
Comment 7•5 years ago
|
||
Sure. I have already added this line to enable using docs in one PR.
I will make a PR soon to solve the actual error too.
Comment 8•5 years ago
|
||
I think that I don't have data initialized in my localhost.
Sending mozilla-central as project in my localhost is giving undefined undefined
How can i add project
| Reporter | ||
Comment 9•5 years ago
|
||
As a norm to follow, always lay down what are the steps you took.
I don't know what you tried.
I would have done:
- Run
docker-compose up - Wait a bit until I see the backend running on port 8000
- Load http://localhost:8000/docs/#project-performance-data-list
- Click on "Interact" and add 'mozilla-central' to the field and "Send request"
- I get the 404 result with "Need to specify either signature_id, signatures, push_id, or job_id"
- This is the same as loading http://localhost:8000/api/project/mozilla-central/performance/data/
Comment 10•5 years ago
|
||
Oh! I was trying on port 5000.I will try to fix it within some time soon
| Assignee | ||
Updated•3 years ago
|
Description
•