Skip to content

[LOOKING FOR MAINTAINER] swagger-ui as mountable rails engine

License

Notifications You must be signed in to change notification settings

tleish/swagger_engine

 
 

Repository files navigation

LOOKING FOR MAINTAINER

I'm sorry but I can't maintain this project anymore.

If you want to maintain this project, contact me (batdevis[at]gmail.com) and I will transfer the ownership.

SwaggerEngine

Include swagger-ui as rails engine.

Swagger specifications

https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md

Install

Add to Gemfile

gem 'swagger_engine'

Add to your config/routes.rb

mount SwaggerEngine::Engine, at: "/api-docs"

Protect your route

Devise

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

Basic http auth

Set username and password in config/initializers/swagger_engine.rb:

SwaggerEngine.configure do |config|
  config.admin_username = ENV['ADMIN_USERNAME']
  config.admin_password = ENV['ADMIN_PASSWORD']
end

Configure

Json files

Set the path of your json files in a initializer:

#config/initializers/swagger_engine.rb

SwaggerEngine.configure do |config|
  config.json_files = {
    v1: "lib/swagger/swagger_v1.json",
    v2: "lib/swagger/swagger_v2.json"
  }
end

lib/swagger/ is a good place to place them..

Edit your json files

Use Swagger editor.

License

This project rocks and uses MIT-LICENSE.

Developed in collaboration with

Rawfish

Rawfish Logo

About

[LOOKING FOR MAINTAINER] swagger-ui as mountable rails engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 66.3%
  • HTML 26.2%
  • JavaScript 4.6%
  • CSS 2.9%