Documenting @api_view() methods properly

24 views
Skip to first unread message

silverj87

unread,
Jan 26, 2018, 1:55:42 PM1/26/18
to Django REST framework
Hello,

I am new to django rest framework but have several back-end endpoints that are wrapped by @api_view (they do not relate to a model) and return JSON responses.

Is there a best practice for documentation? I attempted to use django-rest-swagger but have not found a good way of informing the doc generation of the input param types and a good description of the end point. django-rest-swagger deprecated the YAML doc strings prior to version 2.0 and I'm having a hard time finding an approach that will work for sphinx and the api documentation simultaneously.


Restriction:

- Sphinx is used to document the project in it's entirety (so .rst files using doc strings formatted with restructred text)

Versions:
python 3.6.2
django 1.11.7
djangrestframework 3.7.3

Any help or examples would be greatly appreciated.

Jason

unread,
Jan 27, 2018, 9:18:54 AM1/27/18
to Django REST framework
FWIW, I tend to make subclasses of APIView and implement the functionality there

silverj87

unread,
Jan 27, 2018, 1:40:11 PM1/27/18
to Django REST framework
Thanks for the advice. I saw that... little more verbose but if it helps make documentation easier to follow I suppose it's a good practice. Thanks!
Reply all
Reply to author
Forward
0 new messages