DarkaOnLine/l5-swagger Laravel 数组输入错误

DarkaOnLine/l5-swagger Laravel Array Input Incorrect

我正在尝试使用 swagger 发送数组。但是当我在检查模式下检查数组时,我注意到正在发送的数组只是一个字符串而不是数组

/**
     * @OA\Post(
     * path="/api/update-landing-page",
     * summary="Update Landing Page",
     * description="Update Landing Page",
     * tags={"Landing Page Backend"},
     * security={{"bearer": {} }},
     *   @OA\RequestBody(
     *       required=true,
     *       @OA\MediaType(
     *           mediaType="multipart/form-data",
     *           @OA\Schema(
     *               required={"businesses","image"},
     *               @OA\Property(
     *                   property="businesses",
     *                   description="Business ID",
     *                   type="array",
     *                  @OA\Items(type="string", format="id"),
     *              ),
     *              @OA\Property(property="image", type="string", format="binary")
     *           )
     *       )
     *   ),
     * @OA\Response(
     *    response=200,
     *    description="",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *          )
     *     )
     * )
     */

我想要一组企业 ID。看起来像这样 企业:[1,2,3].

但是当我在检查模式下单击时,我注意到它变成了一个字符串

如何让它变成数组?

感谢您抽出宝贵时间。

我设法解决了这个问题:

@OA\Property(
    property="businesses[]",
    description="Business ID",
    type="array",
    collectionFormat="multi",
   @OA\Items(type="string", format="id"),
),

不确定这是否对其他人有帮助,但这对我有用。