如何在 Marshmallow 中添加字段注释或描述?
我想用 Apispec 之类的东西来展示它。
这是 APISpec 的 Marshmallow 扩展的现有但未记录的功能。如果您的 Marhshmallow 字段具有此列表中的任何属性,APISpec 将在生成的 Swagger 规范中使用它。例如,我将此作为我的模式定义之一:
class ErrorSchema(Schema):
code = fields.Int(description="An API specific Error code", required=True)
message = fields.String(description="A user readable message")
这会导致 APISpec 生成以下内容:
ErrorSchema {
message (string, optional): A user readable message,
code (integer): An API specific Error code
}
我真的 喜欢你的每一首歌,我无法告诉你,你从 6 岁开始创作音乐受到了多大的启发,我现在 13 岁了,但仍然是你的忠实粉丝,喜欢你的歌曲❤️🎶继续创作歌曲,感谢最好的 EDM在世界上