Python flask swagger ID并返回一系列内容
我们使用flask swagger来记录我们的flask/Python REST API 在许多情况下,我返回一个Python flask swagger ID并返回一系列内容,python,swagger,Python,Swagger,我们使用flask swagger来记录我们的flask/Python REST API 在许多情况下,我返回一个a_名称: schema: id: a_name properties: first_name: type: string description: first name last_name: type: string descr
a_名称
:
schema:
id: a_name
properties:
first_name:
type: string
description: first name
last_name:
type: string
description: last name
因此,我定义了一次,然后我的端点只引用模式ID。也就是说,如果我将以下内容放入新端点中:
schema:
id: a_name
然后,斯威格吸收了前面对a_name
的定义。太好了
但是,在我的“get all”端点中,我返回一个a_name
数组。如果不复制/粘贴单个a_name
的模式定义,我怎么能大摇大摆地展示这一点
编辑:在这里
responses:
200:
description: a_names successfully retrieved
schema:
properties:
names:
type: array
items:
schema:
id: a_names
这将产生:
{
"names": [
{
"first_name": "string",
"last_name": "string",
}
]
}