如何在 drf-yasg 库中为 swagger 文档添加自己的参数和响应值?

How to add own Parameters and Response values in the drf-yasg library for swagger documentation?

我使用 drf-yasg 库为开发人员前端生成项目文档。我不知道如何将我的数据添加到字段 ParametersResponses

比如这个class

class VendorsCreateView(APIView):
    """
    :param:
            data = {
            "vendor_name": "TestName",
            "country": "Belarus",
            "nda": "2020-12-12",
            "parent": "",
            "contacts": [{"contact_name": "Mrk", "phone": "2373823", "email": "dRqT@rgmail.com"},
                         {"contact_name": "Uio", "phone": "34567", "email": "rdq@gmail.com"}
                         ]
        }
    :return: swagger name
    """

但我并没有完全得到我想要的

如何添加这些参数?

@swagger_auto_schema decorator 就是您要找的。