首页 > 解决方案 > 在 flask_restplus python3 中使用 fields.Wildcard() 的问题

问题描述

我正在尝试为以下结构构建一个烧瓶 restplus 模型。

"data": {
            "file1": 79,
            "file2": 72
        }

file1 和 file2 是文件名,每次运行应用程序时都会更改。我能想到的最佳解决方案是使用通配符字段。

wild = fields.Wildcard(fields.String)
wildcard_fields = {'*': wild}

当我跑步时,我得到AttributeError: module 'flask_restplus.fields' has no attribute 'Wildcard'

请帮助我解决此问题或任何其他解决方案也值得赞赏。

谢谢!

标签: pythonflaskswagger-uipython-3.7flask-restplus

解决方案


您是否尝试更新您的库?通配符是最近的,所以它可能是问题所在。


推荐阅读