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

JJH*_*ter 9 php schema swagger

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

{
  "status": "success",
  "data": {
      "status": "ready"
   },
  "request_id": "string"
}
Run Code Online (Sandbox Code Playgroud)

我试图在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"
 *                  ),
 *              )
 *          ),
Run Code Online (Sandbox Code Playgroud)

但它没有使用状态的Schema定义,所以我的响应实际上看起来像:

{
  "status": "success",
  "data": {},
  "request_id": "string"
}
Run Code Online (Sandbox Code Playgroud)

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

JJH*_*ter 12

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

答案是:

*           @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"
 *                  ),
 *              )
 *          ),
Run Code Online (Sandbox Code Playgroud)