Exclude Views from drf_yasg Swagger Documentation
To exclude a view from drf_yasg, you can use the @swagger_auto_schema decorator with the exclude parameter set to True. Here's an example:
from drf_yasg.utils import swagger_auto_schema
class MyView(APIView):
@swagger_auto_schema(exclude=True)
def post(self, request):
'This endpoint is excluded from Swagger documentation.'
# Your view code here
In this example, the post method of MyView will not be included in the Swagger documentation because we've set exclude=True in the swagger_auto_schema decorator.
原文地址: https://www.cveoy.top/t/topic/mXCw 著作权归作者所有。请勿转载和采集!