Reputation: 76
I have the following settings for REST_FRAMEWORK in my django project:
REST_FRAMEWORK = {
...
'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticatedOrReadOnly',),
...
}
I want to see all methods in rest_framework_swagger without authorization. I know that by default swagger doesn't show the methods you don't have access to. How can I override it?
I have already tried to experiment with SWAGGER_SETTINGS in my settings.py file but it seems to me that is hasn't 'no authorization' option.
Upvotes: 0
Views: 1126
Reputation: 1847
If you are using drf_yasg
library for swagger, which is recommended by DRF, you can use these schema_view settings:
# urls.py
from rest_framework import permissions
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
schema_view = get_schema_view(
openapi.Info(
title="My API"
# other info...
),
public=True,
permission_classes=(permissions.AllowAny,),
)
Upvotes: 3