Reputation: 1037
i have installed laravel 5.6 with Swagger with DarkaOnLine/L5-Swagger package, i have followed the installation instructions that is
php composer require "darkaonline/l5-swagger:5.6.*"
php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"
i have also set
L5_SWAGGER_GENERATE_ALWAYS=true
in my env and created a controller and added
/**
* @SWG\Swagger(
* schemes={"http","https"},
* host="api.host.com",
* basePath="/",
* @SWG\Info(
* version="1.0.0",
* title="This is my website cool API",
* description="Api description...",
* termsOfService="",
* @SWG\Contact(
* email="[email protected]"
* ),
* @SWG\License(
* name="Private License",
* url="URL to the license"
* )
* ),
* @SWG\ExternalDocumentation(
* description="Find out more about my website",
* url="http..."
* )
* )
*/
after that i typed
php artisan l5-swagger:generate
php artisan vendor:publish
when i visit /api/documentation i get a white screen and in the console i am getting the following error
your help will be highly appreciated.
Upvotes: 4
Views: 11785
Reputation: 366
For darkaonline/l5-swagger 8.5 and above copy the content of the folder vendor/swagger-api/swagger-ui/dist into public/docs/asset
Upvotes: 1
Reputation: 11
Maybe you use common settings for nginx:
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
expires max;
try_files $uri =404;
}
Need add:
location ~ (^/docs/asset/.*) {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
expires max;
try_files $uri =404;
}
Or wait - https://github.com/DarkaOnLine/L5-Swagger/pull/503
Upvotes: 1
Reputation: 4959
in Laravel 8. The documentation says that it uses a package auto-discovery feature. But it's not true.
You have to add to your config/app.php in the providers section:
L5Swagger\L5SwaggerServiceProvider::class,
Then, you have to run the
php artisan config:cache
And only then, you can run the
php artisan vendor:publish --provider 'L5Swagger\L5SwaggerServiceProvider'
Upvotes: 0
Reputation: 11
1 - try to copy the /dist
directory in \vendor\swagger-api\swagger-ui
to \public_html\swagger-api\
2 - change "swagger_ui_assets_path"
address from \config\l5-swagger.php
to 'public_html\swagger-api\'
3 - change all links in link and script tag in view file \resources\views\vendor\l5-swagger\index.blade.php
4- type command php artisan l5-swagger:generate
or add L5_SWAGGER_GENERATE_ALWAYS=true
in .env file
Upvotes: 1
Reputation: 790
I have fixed that issue by steps:
just copied files from vendor folder and added in the specific path.
Copy all the files from : laravel-yourapp\vendor\swagger-api\swagger-ui\dist
Then paste all files in path: laravel-yourapp\public\docs\asset
Upvotes: 10