I have a large API REST project with Django Rest Framework, and I want to document it with Django REST Swagger, but I want this Swagger documentation to include only some of the endpoints of my whole project.
This is my urls.py where I set Swagger in my project:
from rest_framework_swagger.views import get_swagger_view
urlpatterns = i18n_patterns(
path('api-token-auth/', views.obtain_auth_token),
path('', include('FrontEndApp.urls')),
path('admin/', admin.site.urls),
path('api-auth/', include('rest_framework.urls')),
path('docs/',get_swagger_view(title="Intellibook API")),
path('rosetta/', include('rosetta.urls')),
path('general/', include('GeneralApp.urls')),
path('operations_manager/', include('OperationsManagerApp.urls')),
path('payments_manager/', include('PaymentsManagerApp.urls')),
#path('providers_manager/', include('ProvidersManagerApp.urls')),
path('rates_manager/', include('RatesManagerApp.urls')),
path('reports_manager/', include('ReportsManagerApp.urls')),
path('reservations_manager/', include('ReservationsManagerApp.urls')),
path('users_manager/', include('UsersManagerApp.urls')),
path('excursions_manager/', include('ExcursionsManagerApp.urls')),
path('invoices_manager/', include('InvoicesManagerApp.urls'))
)
Currently, Swagger publishes all the endpoints that are in all urls.py along the whole project. I want to set it to publish only the endpoints in ursl.py of only on of the apps of the project.
Look into
Unfortunately, I couldn't find the docs. But if I get this right, you should split your urlpatterns into two parts, one for published, second for non published.