Project

Profile

Help

Story #6714

closed

[EPIC] drf builtin manage.py 'generateschema' command fails on pulp base viewsets

Added by alikins almost 4 years ago. Updated over 3 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Attempting to use DRF's builtin openapi schema generation tool fails in the base viewsets get_serializer_class().

The get_serializer_class() expects a self.request to exist, but it is None as run by the 'generateschema' command.

(.venv) [newswoop:F31:galaxy_ng (sync_model_46 %)]$ ./compose run --rm api manage generateschema Compose Profile alikins Starting galaxy_ng_redis_1 ... Starting galaxy_ng_redis_1 ... done Installing path django-extensions in editable mode. Installing path alogging in editable mode. Installing path galaxy_ng in editable mode. Installing path pulp_ansible in editable mode. Installing path pulpcore in editable mode. Traceback (most recent call last): File "/venv/bin/django-admin", line 8, in sys.exit(execute_from_command_line()) File "/venv/lib64/python3.6/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/venv/lib64/python3.6/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/venv/lib64/python3.6/site-packages/rest_framework/management/commands/generateschema.py", line 40, in handle schema = generator.get_schema(request=None, public=True) File "/venv/lib64/python3.6/site-packages/rest_framework/schemas/openapi.py", line 64, in get_schema paths = self.get_paths(None if public else request) File "/venv/lib64/python3.6/site-packages/rest_framework/schemas/openapi.py", line 47, in get_paths operation = view.schema.get_operation(path, method) File "/venv/lib64/python3.6/site-packages/rest_framework/schemas/openapi.py", line 104, in get_operation operation['responses'] = self._get_responses(path, method) File "/venv/lib64/python3.6/site-packages/rest_framework/schemas/openapi.py", line 489, in _get_responses serializer = self._get_serializer(path, method) File "/venv/lib64/python3.6/site-packages/rest_framework/schemas/openapi.py", line 446, in _get_serializer return view.get_serializer() File "/venv/lib64/python3.6/site-packages/rest_framework/generics.py", line 108, in get_serializer serializer_class = self.get_serializer_class() File "/src/pulpcore/pulpcore/app/viewsets/task.py", line 86, in get_serializer_class return super().get_serializer_class() File "/src/pulpcore/pulpcore/app/viewsets/base.py", line 105, in get_serializer_class if 'minimal' in self.request.query_params: AttributeError: 'NoneType' object has no attribute 'query_params'

Also available in: Atom PDF