5

I am using darkaonline/l5-swagger: 7.0 for generate swagger UI which based on OpenApi 3.0. But the problem is required validation only works for path params and not with form-data properties. I tried adding required property names in an array but it only shows required text in red color but not validates when execute.

/**
 * @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

Randika
  • 683
  • 3
  • 11
  • 32

1 Answers1

0

Use "darkaonline/l5-swagger": "^8.0" In this version, your validation will work properly.

You have marked the field as required is correct, no need to change.

PFA its working- enter image description here

Ranjan Fadia
  • 1,363
  • 1
  • 14
  • 18