I am trying to customize the redoc documents using DRF-Spectacular.
For some reason, the extend_schema class is not updating the description, summary or tags on the document. How can I customize this?
@extend_schema(
summary="Get All Classes",
description='This endpoint will return all the classes created by your account.',
tags=["Class"]
)
def get_queryset(self):
return super().get_queryset().filter(taxonomy__is_public=True) | super().get_queryset().filter(taxonomy__client=Client.objects.get(user=self.request.user))
Referring to the comment. Yes annotating get_queryset
has no meaning because it makes little sense. But you don't need to do
@extend_schema(...)
def get(self, request, *args, **kwargs):
return super().get(request, *args, **kwargs)
just for the sake of annotation. Spectacular got another decorator for that:
@extend_schema_view(
get=extend_schema(description='get desc', responses=...),
post=extend_schema(description='post desc', request=..., responses=...),
)
class YourView(APIView):
...