python - flask restplus模型

标签 python flask flask-restplus

我正在寻找将restplus Api.model表示为字典的方法,这是我在调用后数据上收到的API,例如

{"name": "the_name",
 "data": {"data_specific_key", "value", "key2": "value2" .... } 
}
// The data is dynamic, no way to know what fields will have. 

不幸的是,在restplus Api中我只有一种方法来表示ListFields。

我正在看https://flask-restplus.readthedocs.io/en/stable/marshalling.html#nested-field但不确定是否有帮助,也许我需要对 https://flask-restplus.readthedocs.io/en/stable/api.html#flask_restplus.fields.Raw 进行子类化并创建我自己的领域,谢谢。

最佳答案

仅供引用 - 我直接使用 fields.Raw,这被翻译为 swagger 中的 object ,又名 py 中的 dictionary

关于python - flask restplus模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49392527/

相关文章:

python - 是否可以使用 `mlxtend.plotting` 设置底部区域的颜色?

ios - 将较小的音频文件从iOS应用上传到Python-Flask服务器

python - Flask 静态文件 Cache-Control

python - 如何使用 swagger 和 Flask Restplus 正确渲染数组参数?

python解析xml以获取大于给定值的字符串

python - 处理缺失值(条件插补) Pandas

deployment - 503 服务在 Openshift Flask 应用程序中暂时不可用

Python restplus API上传下载文件

如果身份验证已开启,flask-restplus/flask-restx 会自动将 401 响应添加到 Swagger 文档

python - 关于导入的新手 python 错误