python - 记录 Django Rest 框架 API
问题描述
为 django rest 框架应用程序寻找自我描述 api
我们正在使用 Django 2 和 Django Rest Framework 3.7.3 我们正在寻找基于视图文档字符串或元数据的 api 我尝试过 drf docs 和 drf auto docs 但似乎不支持我们的应用程序有人提到 pydocs ,但不要认为这会起作用我们更糟糕的情况是我认为使用 Sphinx
我们想要一个理想地给出示例的 api
示例请求:
GET /tests HTTP/1.1
示例响应:
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"name": "test1",
},
{
"name": "test2",
}
]
状态码:
200 OK – List of a tests.
解决方案
您可以尝试支持生成 redoc 或 swagger 文档的drf-yasg 。
推荐阅读
- javascript - 如何获取谷歌日历中可用的所有时间/免费书籍插槽列表
- uwp - 未观察到拖动接受的操作
- api - InvalidRequestError:在调用 openAI API 以生成文本时必须提供“引擎”参数
- javascript - 在相应链接之后将带有 jQuery 的链接中的标题内容写入 DOM
- php - 为 WooCommerce 购物车中的每个项目创建单独的订单
- node.js - ostrio:logger 没有客户端日志
- openshift - 在 Openshift v3.X 中编辑standalone.xml
- azure - Azure 应用注册中的客户端机密有什么用?
- android - 颤振蓝牙扫描 - 未检测到覆盆子
- ansible - SSH 连接有效,但无法连接