Does Django Rest Framework have third party apps to auto generate swagger.yaml file?

只谈情不闲聊 提交于 2019-12-11 01:23:35

问题


I have large amount of API endpoints written in django-rest-framework and it keeps increasing and updating. How can I create & maintain API documentation that should be up-to-date?

My current version is

  1. Create swagger.yaml file and somehow auto generate everytime any endpoint changes.
  2. Then use this file as an input to readme.io, ReDoc or other alternatives to provide visualization to external folks.

If you have an experience on this or any similar solution, please share I really appreciate it!


回答1:


Yes, you could take a look at drf-yasg:

drf-yasg docs

The quickstart shows how 4 endpoints are created including one which outputs swagger.yaml file. Once you have included drf-yasg, you can navigate to:

http://localhost:8000/swagger.yaml

which will then allow you to save the swagger docs to disk.



来源:https://stackoverflow.com/questions/51343394/does-django-rest-framework-have-third-party-apps-to-auto-generate-swagger-yaml-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!