DarkaOnLine / L5-Swagger

OpenApi or Swagger integration to Laravel

Home Page:https://github.com/DarkaOnLine/L5-Swagger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hit JavaScript error when you press the execute button on the docs page

arlexw90 opened this issue · comments

  • L5-Swagger Version: 5.5.*
  • PHP Version (php -v): 7.4
  • Laravel Version: 5.5.*

Description:

L5 Swagger UI - Google Chrome 2023-01-27 09 24 46

Steps To Reproduce:

.../app/Http/Controllers/Controller.php

/**
 * @SWG\Swagger(
 *   @SWG\Info(
 *     title="Site Title",
 *     version="1.0",
 *     description="Site description",
 *     @SWG\Contact(
 *         email="xyz@xyz.com"
 *     )
 *   )
 * )
 */

../app/Http/Controllers/ProductController.php

/**
     * @SWG\Get(
     *      path="/api/products",
     *      summary="Get list User",
     *      description="Returns User data",
     *      security={{"bearerAuth":{}}},
     *      @SWG\Response(
     *          response=200,
     *          description="Successful operation",
     *       ),
     *      @SWG\Response(
     *          response=400,
     *          description="Bad Request"
     *      ),
     *      @SWG\Response(
     *          response=401,
     *          description="Unauthenticated",
     *      ),
     *      @SWG\Response(
     *          response=403,
     *          description="Forbidden"
     *      )
     * )
     */

Access http://127.0.0.1:8000/api/documentation then click the execute button, it doesn't render any response but I noticed some error shown on the console area, you can check my screenshot at above.

I have the same problem.
I tried to set the base path through L5_SWAGGER_BASE_PATH on the .env file, but I get this error:

$ php artisan l5-swagger:generate
Regenerating docs

In Logger.php line 39:
                                                                                                                                                            
  Unexpected field "basePath" for @OA\OpenApi(), expecting "openapi", "info", "servers", "paths", "components", "security", "tags", "externalDocs", "x" in 
 

I think this PR is missing on the 5.5x branch, right? #147