Include swagger-ui as rails engine.
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
Add to Gemfile
gem 'swagger_engine', git: 'https://github.com/batdevis/swagger_engine.git'
Add to your config/routes.rb
mount SwaggerEngine::Engine, at: "/api-docs"
authenticate :user do
mount SwaggerEngine::Engine, at: "/api-docs"
end
or
authenticate :user, lambda { |u| u.admin } do
mount SwaggerEngine::Engine, at: "/api-docs"
end
Set the url of your json file in the environment variable ENV['SWAGGER_JSON_URL']
,
or place it in app/assets/javascripts/swagger_engine/swagger.json
.
Use Swagger editor.
This project rocks and uses MIT-LICENSE.