Swaggervel
Swaggervel copied to clipboard
Page Not Found error when accessing api-docs
When I setup my composer.json to use the master-dev branch I get pageNotFound error, if I use the 2.0 branch like the readme says I get Class Swagger/Swagger not found Error.
So far the only way to get the project working is to use the the forked branch https://github.com/tralves/Swaggervel in my composer.json this fork however uses the swagger-ui from the 1.0 spec but then uses the swagger-php from the 2.0 spec so I also had to force composer to use swagger 1.0 with "zircote/swagger-php": "1.0" then go back to 1.0 annotation...
That was my only solution after fighting with this until 4am, but would love to use the 2,0 annotations. I might try just downloading the master branch manually and replacing the files in the public vendor folder manually to see if that updates this tralves fork swagger-ui to 2.0. UPDATE: copying the public vendor files manually did not work, it gave javascript errors invalid tokens on <! document, and undefined class SwaggerUI even though the script include for swager-ui.js in the header was valid and readable.
UPDATE: I have Swagger UI working with 2.0 swagger annotations! Finally! Here is what I had to do: I used the master-dev branch in composer for slampenny/swaggervel I had to change the route.php file under jlapp/swaggervel/routes.php to the one from https://github.com/tralves/Swaggervel that stops the pagenotfound error! Magic. Next I was getting a bunch of JS errors on api-docs page and it wasnt loading annotations. I noticed the blade template in /resources/vendor/swaggervel/index.blade.php was using handlebars 1.0 js file so I changed this to the new 2.0 that swagger-ui now uses. I then removed swagger.js and shred script includes as they were not found, and then finally I had to remove all the log('Loaded Swagger') commands for some reason it could not find the log command even though I did see it inside swagger-ui.js
After all that it works, I think i may create a fork with all the changes so the next person can just use that fork in there composer.js and BAM a working version of swaggervel!
Ok I think the problem with the master branch was only the route is pointing to api/docs instead of api-docs, when I changed it to api-docs everything is working so I think its just a typo in the latest branch. That and the wrong version of handlebars was in the view along with probs source includes.
I have created a fork here https://github.com/krisbray/swaggervel I was able to test a new branch of my project and pull from my fork instead using composer and everything works right off the hop. hope this saves someone else the time I had to put in to figure it out! :D