在Django @schema(AutoSchema(manual_fields =

时间:2019-03-21 13:58:45

标签: python django django-rest-framework django-views

我正在使用django rest api来接收端点中的对象。

某些对象属性是必需的,而某些则不是。

我想在文档中显示此内容,但是我不知道如何使用手动字段显示对象。

现在我只有对象的名称,如:

@schema(AutoSchema(manual_fields=[
        coreapi.Field("node", required=True, location="query", description="Node Object")        
    ]))

这在文档中显示如下:

django documentation

1 个答案:

答案 0 :(得分:0)

使用coreschema设置描述。

php artisan route:clear
php artisan config:clear
php artisan cache:clear