django-rest-framework
django-rest-framework copied to clipboard
[Built-in Docs]Add option to exclude an endpoint from the documentation.
Checklist
- [X] I have verified that that issue exists against the
masterbranch of Django REST framework. - [X] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- [X] This is not a usage question. (Those should be directed to the discussion group instead.)
- [X] This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
- [X] I have reduced the issue to the simplest possible case.
- [ ] I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)
Use Case
I want to disable certain endpoints from showing up in the documentation .
Djoser urls for instance don't have a queryset for the automatic built in docs and that causes an error, so I just want an option to exclude them.
Steps to reproduce
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^auth/', include('djoser.urls')),
url(r'^api/drivers/', include('drivers.urls')),
url(r'^api/driver_state_history/(?P<pk>[0-9]+)/', include('driver_state_history.urls'), name='Driver State History'),
]
All of the views are included in the docs.
Expected behavior
urlpatterns = [
url(r'^admin/', admin.site.urls),
# added docs='exclude'
url(r'^auth/', include('djoser.urls'), docs='exclude'),
# or just make them to be automatically included.
url(r'^api/drivers/', include('drivers.urls'), docs='include'),
url(r'^api/driver_state_history/(?P<pk>[0-9]+)/', include('driver_state_history.urls'), ),
]
Will be solved by #4979