drf_yasg remove specific url endpoint for drf-yasg==1214
To remove a specific URL endpoint in drf-yasg, you can use the exclude parameter in the SwaggerView class. Here's an example:
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="API",
default_version="v1",
),
public=True,
exclude=['/url/to/exclude/'],
)
In this example, the /url/to/exclude/ endpoint will not be included in the generated Swagger documentation. You can add multiple endpoints to the exclude list if needed.
原文地址: https://www.cveoy.top/t/topic/btWj 著作权归作者所有。请勿转载和采集!