sunscrapers/djoser

TokenDestroyView has no serializer class

Closed this issue · 3 comments

Hello! I was generating an openapi schema with drf-spectacular using following command:

python ./application/manage.py spectacular --color --file ./application/schema.yml

and have encountered an error:

.venv/lib/python3.9/site-packages/djoser/views.py:30: Error [TokenDestroyView]: unable to guess serializer. This is graceful fallback handling for APIViews. Consider using GenericAPIView as view base class, if view is under your control. Either way you may want to add a serializer_class (or method). Ignoring view for now.

I guess the solution would be to add empty serializer getters to the TokenDestroyView (if you don't need real ones):

def get_serializer(self, *args, **kwargs):
    pass

def get_serializer_class(self):
    pass

I was using the latest version of djoser (2.2.2)

Thank you for point that out! I think it makes sense. When I use tooling like that I usually return just empty Serializer class from DRF and it works well.

PR for is welcome!

@haxoza Greetings! Did as you said: added empty Serializer to views instead of using methods.

released in 2.2.3. Thank you!