【问题标题】:is there a way to provide custom names for my drf-yasg endpoints?有没有办法为我的 drf-yasg 端点提供自定义名称?
【发布时间】:2023-01-30 22:49:55
【问题描述】:

我正在使用 django-rest-framework 实现一个 API,并使用 drf-yasg 来记录和命名我的端点 every post method ends with create

我尝试搜索文档,但找不到方法

【问题讨论】:

  • 使用@swagger_auto_schema(...)装饰器并设置operation_id参数。

标签: django django-rest-framework drf-yasg


【解决方案1】:

正如评论中提到的那样,您应该为您的 API 使用 @swagger_auto_schema() 装饰器以对其进行自定义。然后设置 operation_id 以在 swagger 文档中更改其名称。

这是一个可以解决您的问题的确切示例: drf-yasg: How to change operationId?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-14
    • 2011-01-31
    • 2019-04-28
    • 1970-01-01
    相关资源
    最近更新 更多