How to Hide Some APIs in Django REST Swagger
Hiding APIs in Django REST Swagger can be achieved using two methods:
- Using `swagger_schema = None`
- Using the `@swagger_auto_schema` decorator
This method is used to exclude a specific view from schema generation. To use this method, add the following code above the view in your `views.py` file:
from drf_yasg.utils import swagger_auto_schema @swagger_auto_schema(auto_schema=None) def get(self, request): pass
This method is used to hide a specific view from schema generation. To use this method, add the following code above the view in your `views.py` file:
from drf_yasg.utils import swagger_auto_schema @swagger_auto_schema(auto_schema=False) def get(self, request): pass