[英]How to mark a method as deprecated with swagger_auto_schema?
I'm using swagger-auto-schema
to document my endpoints API using django-rest-framework
, swagger
, and drf-yasg
.我正在使用swagger-auto-schema
使用django-rest-framework
、 swagger
和drf-yasg
来记录我的端点 API。 Is there a way to mark the API endpoints in the documentation as deprecated?有没有办法将文档中的 API 端点标记为已弃用?
You should set deprecated=True
parameter on the swagger_auto_schema decorator.您应该在swagger_auto_schema装饰器上设置deprecated=True
参数。
Example:例子:
class MyViewSet(viewsets.ModelViewSet):
...
@swagger_auto_schema(deprecated=True)
def list(self, request, *args, **kwargs):
return super().list(request, *args, **kwargs)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.