I am trying to integrate django-rest-swagger==2.1.1
with my existing project that uses djangorestframework==3.5.3
.
The project has some Class based views and some Function based views. After integrating swagger, It displays input boxes for POST requests of "Class Based views"(which have serializers obviously), but does not show for "function based views". The question has been asked several times, I have tried following solutions:
and few others too, but did not work for my case. Is there any possible way to do that for 'function based views' or I ll have to convert them to class based views?
YAML docstring parser is deprecated in REST Swagger>=2.0
What I did is to override the SchemaGenerator class to parse the view's docstring by my own conventions.
Create this module anywhere in project structure. Import
get_swagger_view
from this module inproject/urls.py
. And, then remove theget_swagger_view
method from thedjango_rest_swagger
module.Ref: Comment by daimon99 in REST Swagger Issues
Update: As from
django-rest-framework
version 3.7, there are breaking changes due to which above code won't work, the solution would be Comment by GuillaumeCisco