所需的验证在Laravel Darkaonline摇摇欲坠的用户界面中不起作用

时间:2020-05-29 05:54:56

标签: laravel swagger openapi api-doc

我正在使用darkaonline/l5-swagger: 7.0生成基于OpenApi 3.0的swagger UI。但是问题是required验证仅适用于path参数,而不适用于表单数据属性。我尝试在数组中添加所需的属性名称,但它仅以红色显示required文本,但在执行时不进行验证。

/**
 * @OA\Post(
 *      path="/sign-in",
 *      operationId="signIn",
 *      tags={"Authentication"},
 *      summary="AuthenticationController@signIn",
 *      description="Login",
 *      @OA\RequestBody(
 *          required=true,
 *          @OA\MediaType(mediaType="multipart/form-data",
 *              @OA\Schema(
 *                  required={"email","password"},
 *                  @OA\Property(
 *                      property="email",
 *                      type="string",
 *                      description="Email"
 *                  ),
 *                  @OA\Property(
 *                      property="password",
 *                      type="string",
 *                      description="Password"
 *                  ),
 *             )
 *         )
 *      ),
 *       @OA\Response(
 *          response=200,
 *          description="Successful",
 *       ),
 *       @OA\Response(
 *          response=401,
 *          description="Unauthorized",
 *      ),
 *  )
 */

enter image description here

1 个答案:

答案 0 :(得分:0)

使用“ darkaonline / l5-swagger”:“ ^ 8.0” 在此版本中,您的验证将正常工作。

您已将必填字段标记为正确的,无需更改。

PFA的工作- enter image description here