1

"nelmio/api-doc-bundle": "^3.6@dev" 我需要带有属性产品的模型响应,该模型Product和属性计数相等,但是当我使用 Mode 注释时,我遇到了问题,响应模型生成为 array Product。我做错了什么?

     * @SWG\Response(
     *     response=200,
     *     description="Json collection object Products",
     *     @SWG\Schema(
     *         type="object",
     *         properties={
     *             @SWG\Property(property="product",
     *                  @Model(type=Product::class, groups={Product::SERIALIZED_GROUP_LIST})),
     *                  @SWG\Property(property="count", type="integer")
     *         }
     *     )
     * )


{
  "product": [
    {
      "id": 0
    }
  ],
  "count": 0
}

我期望的结果是这样的:

{
  "product":
    {
      "id": 0
    },
  "count": 0
}
4

0 回答 0