我正在寻找将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/