Skip to content

adammartak/rack-swagger-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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: 'adammartak/rack-swagger-ui'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rack-swagger-ui

Usage example:

Add middleware to your config.ru:

require 'rack-swagger-ui'

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

run Rack::Swagger::Ui::Controller

and configure your grape:

class YourAPI < Grape::API
  version 'v1'
  format :json
  ...
  add_swagger_documentation :add_version => true,
                            :base_path => '/api'
end

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

If your api path is "api/v1" just go to

http://host:port/api/doc

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

About

Integrates swagger-ui with rack app

Resources

License

Stars

Watchers

Forks

Packages

No packages published