Sometimes you have an API view (ie. GenericAPIView) class without a serializer. This causes the drf-yasg generator to throw an AssertionError exception saying class should either include a 'serializer_class' attribute, or override the 'get_serializer_class()' method.
You can fix this by adding the following to the view class:
def get_serializer(self, *args, **kwargs):
pass
def get_serializer_class(self):
pass
This should pass the drf-yasg serializer check.
Reference
No comments:
Post a Comment