Skip to content

BrandyMint/rack-swagger-ui

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rack::Swagger::Ui

Integrates swagger-ui with your "grapified" Rack application.

Dependencies

Add swagger compliant documentation to your grape API

An opinionated micro-framework for creating REST-like APIs in Ruby

Installation

Add this line to your application's Gemfile:

gem 'rack-swagger-ui', github: 'BrandyMint/rack-swagger-ui'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rack-swagger-ui

Usage example:

Configure your grape:

class YourAPI < Grape::API
  version 'v1'
  format :json
  ...
  add_swagger_documentation 
end

Add middleware to your config.ru:

require 'rack-swagger-ui'

use Rack::Static,
  urls: ['/javascripts', '/stylesheets', '/images'],
  root: File.join(Rack::Swagger::Ui.root, 'public')

map '/swagger' do
  run Rack::Swagger::Ui::Controller.new
end
# OR
run Rack::Cascade.new([YourAPI.new,
                       Rack::Swagger::Ui::Controller.new('/swagger')])

See https://github.com/ruby-grape/grape-swagger#configure for more configuration settings.

The Swagger UI page will be located at

http://host:port/swagger

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

MIT License, full text of license see here

Packages

No packages published

Languages

  • CSS 89.2%
  • Ruby 6.3%
  • HTML 4.5%