【发布时间】:2017-12-31 00:02:07
【问题描述】:
在 Django rest 框架中,我正在使用 AutoSchema 类创建一个文档页面。对于选定的 API 端点,我使用 manual_fields 为各个字段添加文档条目。这些条目按预期出现在文档页面上,在漂亮的表格中,但“描述”列是空白的,即使我在 coreapi.Field() 构造函数中包含了描述 arg。如何让描述出现在表格中?
这是一个示例字段定义:
class FooList(APIView):
''' List the Foos
'''
schema = AutoSchema(
manual_fields=[
coreapi.Field(
name='format',
location='query',
description='The format in which to return results. One of: api, json',
required=False),
]
)
def get(request, format=None):
...
【问题讨论】: