flask:用flasgger显示响应体文档
一,例子:
def user_center():
"""
用户中心
---
tags:
- 用户
description:
用户中心
responses:
200:
description: 成功
schema:
properties:
status:
type: integer
description: 当前状态:0,未处理,1,暂存,2,保存后,待提交,3, 已提交,待打印,4,已退回,5,已通过,6,不通过
example: 1
status_str:
type: string
description: 当前状态的中文描述:0,未处理,1,暂存,2,保存后,待提交,3, 已提交,待打印,4,已退回,5,已通过,6,不通过
example: 暂存
file_name:
type: string
description: 文件名
example: "企业工业设计中心-认定申请表"
file_date:
type: string
description: 2026-04-16 17:13:21
example: 30
attach_list:
type: array
items:
$ref: '#/definitions/Attach' # 引用下方定义的字典结构
400:
description: 参数错误
500:
description: 服务器错误
definitions:
Attach:
type: object
properties:
id:
type: String
description: 附件id
example: aaa
name:
type: string
description: 附件文件名
example: "jietu.png"
thumb_urls:
type: object
description: 附件url信息
properties:
full_url:
type: String
description: 附件的完整url
example: http://127.0.0.1:8025/cdn/company/material/20260420/69e59bb75a23f02cc2945f1c/origin.png
"""
说明:
字典嵌套字典,用properties增加下级属性即可
列表: 用type: array来表示
二,测试效果:

浙公网安备 33010602011771号