Swagger PHP:如何声明 属性 以使用模式定义?

Swagger PHP: how to declare property to use schema definition?

我的应用程序的响应如下所示:

{
  "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": "success",
  "data": {},
  "request_id": "string"
}

如何定义数据 属性 以使用模式定义?或者可以用不同的方式完成吗?

有趣的是,人们有时会在发布问题后立即找到答案。

答案是:

*           @SWG\Response (
 *              response=200,
 *              description="Success response",
 *              @SWG\Schema (
 *                  @SWG\Property(
 *                      property="status",
 *                      type="string",
 *                      default="success"
 *                  ),
 *                  @SWG\Property(
 *                      property="data",
 *                      ref="#/definitions/Service/models/Status"
 *                  ),
 *                  @SWG\Property(
 *                      property="request_id",
 *                      type="string"
 *                  ),
 *              )
 *          ),