Multiple @OA\Response() with the same response=200 error showing in: (Laravel swagger)

474 Views Asked by At

Locally apache server documentation properly Running but when it deploy the live server then showing error,



LOG.error: ErrorException: Multiple @OA\Response() with the same response="200" :
  \App\Http\Controllers\LoginController->login() in /home/api.iqsbd.com/app/Http/Controllers/LoginController.php on line 58
  \App\Http\Controllers\AuthController->logout() in /home/api.iqsbd.com/app/Http/Controllers/AuthController.php on line 66 in /home/iqsbdcom/api.iqsbd.com/vendor/zircote/swagger-php/src/Loggers/DefaultLogger.php:31

This is LoginController and login method:

<?php

    namespace App\Http\Controllers;

    use Exception;
    use App\Traits\ResponseTrait;
    use Illuminate\Http\JsonResponse;
    use App\Http\Requests\LoginRequest;
    use App\Repositories\AuthRepository;
    
    class LoginController extends Controller
    {
        use ResponseTrait;
        public function __construct(private AuthRepository $auth)
        {
            $this->auth = $auth;
        }
        /**
         * @OA\POST(
         *     path="/api/login",
         *     tags={"Authentication"},
         *     summary="Login",
         *     description="Login to system.",
         *     operationId="login",
         *     @OA\RequestBody(
         *         description="Pet object that needs to be added to the store",
         *         required=true,
         *         @OA\MediaType(
         *             mediaType="application/x-www-form-urlencoded",
         *            @OA\Schema(
         *                 type="object",
         *                 @OA\Property(
         *                     property="email",
         *                     description="User Email",
         *                     type="string"
         *                 ),
         *                 @OA\Property(
         *                     property="password",
         *                     description="User password",
         *                     type="string"
         *                 ),
         *                 required={"email", "password"}
         *             )
         *         ),
         *     ),
         *     @OA\Response(
         *         response=200,
         *         description="successful operation",
         *     ),
         *     @OA\Response(
         *         response=400,
         *         description="Invalid input"
         *     )
         * )
         */
        public function login(LoginRequest $request): JsonResponse
        {
            try {
                $data = $this->auth->login($request->all());
                return $this->responseSuccess($data, 'Logged in successfully');
            } catch (Exception $e) {
                return $this->responseError([], $e->getMessage());
            }
        }
    }

This code properly working in local server.But when i deploy shared hosting server then this problem arrive.

Why is this problem happening? Anyone face this problem? What can be the solution?

0

There are 0 best solutions below