I'd like to show the necessary permissions for each API endpoint in my Swagger UI. I'm not finding any relevant documentation.
So something like:
@extend_schema(
description="Get all responsible parties",
responses={200: ResponsiblePartySerializer},
permissions=[responsible_party.can_view_responsible_party]
)
Does this exist or how would you accomplish showing the permissions for each API route?
I couldn't find any way of generating documentation at view level. Something here would've been ideal:
Nevertheless, I found it's possible to generate documentation that affects all of a view's endpoints:
@extend_schema(summary='[IsSuperUser]')
class ActionsController(RetrieveModelMixin, ListModelMixin, BatchCreateControllerMixin):
Which results in:
Then, you can override this per endpoint when a different schema is needed. besides, extend_schema
supports many parameters, in my case, only a string naming the permission sufficed.