简体   繁体   中英

With drf-yasg, how to use statics schemas and manage custom permissions?

I am a little confused how to develop the documentation using the drf-yasg library. So I would like to ask exactly:

  1. How can I use a static swagger.json file created by swagger editor online with drf-yasg ? (There are endpoints in my project that don't have serializers and models, so i created the schema manually!)

  2. My project use a permissions control with custom management. Is there any way to manage the endpoints urls in the schema if the user is not allowed permission to view specific endpoint?

  • drf-yasg creates the swagger.json file by crawling your django-rest-framework application. You cannot use it to merge an existing swagger.json file.

  • You can specify permissions using permission_classes=(permissions.AllowAny,), . See related .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM