Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swagger UI Not Loading

Swagger UI is not loading, Json is loading as expected but issue exists with supported js, css files.

you can see the issues in this images

like image 660
Sampat Avatar asked Dec 18 '22 19:12

Sampat


1 Answers

Try to copy the /dist directory in vendor/swagger-api/swagger-ui inside your project. I'm not sure about the proper way, but I was facing the same issue and it worked for me. Also, try to provide more details of the issue you are facing, maybe code snippets too. Alternatively, try the following :

  1. Check if all your controller methods have [http] tag. If they all do and still doesn't work go to step 2
  2. In your configure function to ensure that you have app.UseStaticFiles(); If it still doesn't work go to step 3
  3. Uninstall and reinstall swagger. If it doesn't work go to step 4 (Core Only)
  4. If you are using Core Install Microsoft.AspNetCore.StaticFiles and reference it in your project.
like image 110
Gurpreet_Carmel_5 Avatar answered Dec 28 '22 07:12

Gurpreet_Carmel_5