【发布时间】:2025-12-23 12:35:06
【问题描述】:
我的应用程序的响应如下所示:
{
"status": "success",
"data": {
"status": "ready"
},
"request_id": "string"
}
我试图在 Swagger 中定义响应
* @SWG\Response (
* response=200,
* description="Success response",
* @SWG\Schema (
* @SWG\Property(
* property="status",
* type="string",
* default="success"
* ),
* @SWG\Property(
* property="data",
* @SWG\Schema(
* ref="#/definitions/Service/models/Status"
* )
* ),
* @SWG\Property(
* property="request_id",
* type="string"
* ),
* )
* ),
但它不使用 Status 的 Schema 定义,所以我的回复实际上是这样的:
{
"status": "success",
"data": {},
"request_id": "string"
}
如何定义数据属性以使用架构定义?或者可以用其他方式完成吗?
【问题讨论】: