Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arlexw90 opened this issue Jan 27, 2023 · 2 comments
Open

Comments

@arlexw90
Copy link

arlexw90 commented Jan 27, 2023

  • 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.

@DarkaOnLine
Copy link
Owner

You need to check your base path is set correctly: https://github.com/DarkaOnLine/L5-Swagger/blob/master/config/l5-swagger.php#L90

@gioid
Copy link

gioid commented Mar 13, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants