django-rest-framework icon indicating copy to clipboard operation
django-rest-framework copied to clipboard

[Built-in Docs]Add option to exclude an endpoint from the documentation.

Open bkovacev opened this issue 9 years ago • 1 comments

Checklist

  • [X] I have verified that that issue exists against the master branch 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'), ),
]

bkovacev avatar Mar 23 '17 14:03 bkovacev

Will be solved by #4979

xordoquy avatar Mar 23 '17 15:03 xordoquy