如何使用 drf-yasg 在 django-rest-framework 中为文件上传 API [Post Method] 制作 swagger 模式?

问题描述

@swagger_auto_schema(method = "post",request_body = openapi.Schema(type = openapi.TYPE_OBJECT,properties = {
        "Organizationlogo": openapi.Schema(type = openapi.TYPE_FILE,description = "logo of Organization")
    }))
@api_view(['POST'])
@parser_classes([FileUploadParser])
@decorators.permission_classes([permissions.AllowAny])
def CreateOrganization(request):
    ...

即使在定义@parser_classes([FileUploadParser]) 之后,我也无法在 Swagger-UI 中获取文件上传按钮。请帮助...!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)