【问题标题】:Trying to create an array with multiple items In swagger UI试图在招摇 UI 中创建一个包含多个项目的数组
【发布时间】:2018-11-02 17:35:02
【问题描述】:

我正在尝试为具有多个输入的 Swagger UI 创建一个数组,但我不知道如何。我目前看到的只是 Swagger UI 中的一个字段。

代码:

    /**
     * @return \Illuminate\Http\JsonResponse
     * @SWG\Post(
     *     path="/api/v1/test",
     *     description="tester",
     *     operationId="tester",
     *     produces={"application/json"},
     *     tags={"Test endpoints"},
     *     @SWG\Parameter(
     *         name="test",
     *         description="Tester",
     *         in="query",
     *         type="array",
     *         items={
     *             "type": "text",
     *         },
     *         collectionFormat="csv",
     *         required=true,
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="test saved"
     *     ),
     *     @SWG\Response(
     *         response=401,
     *         description="test couldn't be save.",
     *     )
     * )
     */

【问题讨论】:

    标签: laravel laravel-5 swagger swagger-ui swagger-php


    【解决方案1】:

    替换

         *         items={
         *             "type": "text",
         *         },
    

         *         @SWG\Items(type="string"),
    

    您可能还需要删除 ) 右括号之前的多余逗号。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-15
      • 2012-07-30
      • 2021-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-26
      • 2022-08-17
      相关资源
      最近更新 更多