To exclude a view from the DRF-YASG documentation, you can use the 'swagger_auto_schema' decorator with the 'exclude' parameter set to 'True'.

For example, if you have a view called 'MyView' that you want to exclude from the documentation, you can add the following decorator to your view:

from drf_yasg.utils import swagger_auto_schema

@swagger_auto_schema(exclude=True)
class MyView(APIView):
    # view code

This will exclude the 'MyView' from the generated documentation.

Alternatively, you can also use the 'swagger_auto_schema' decorator to customize the documentation for a specific view. For example, you can use it to add custom descriptions, parameters, or response schemas.


原文地址: https://www.cveoy.top/t/topic/mXCP 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录