我正在使用django==2.0中的redoc来记录一些django应用程序接口。我注意到,默认情况下,redoc会自动命名端点,如下图左侧所示。最有可能的是,我不想使用生成的名称,而是想自定义名称。来自有redoc文档经验的人,您能给点建议吗?

发布于 2019-07-10 10:28:29
如果您使用的是drf-yasg,则可以使用swagger_auto_schema装饰器来配置operation_id。
from drf_yasg.utils import swagger_auto_schema
from django.utils.decorators import method_decorator
@method_decorator(name='get', decorator=swagger_auto_schema(operation_id='List Widgets', operation_description='List all available widgets'))
class WidgetListView(ListAPIView):
serializer_class = WidgetSerializer
def get_queryset(self):
return Widget.objects.all()发布于 2020-02-06 18:24:04
这些摘要实际上是从输入JSON填充的,可以在源["paths"][path][method]["summary"]中的以下路径中找到。您可能想要编辑这些内容,以便更改摘要。如果您不想更改源输入,可以在REDOC加载后更改DOM元素的文本。
https://stackoverflow.com/questions/55392959
复制相似问题