0.0
The project is in a healthy, maintained state
This gem is almost a straight copy and paste of https://github.com/rswag/rswag/tree/master/rswag-specs with the Rails specific code stripped out so it can be used in Rack applications that don't use Rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 6.1.0
~> 3.9.0
~> 1.48.0
~> 2.19.0

Runtime

 Project Readme

Swagalicious

This gem is an implementation of https://github.com/rswag/rswag/blob/master/rswag-specs that does not rely on Rails. Most of the code is a blatant copy/paste from that repo, most of the credit goes to them.

Currenty it does not implement any API or UI. In the application that is using this gem, we are using https://github.com/Redocly/redoc that is accessed through a rack middleware.

Installation

Add this line to your application's Gemfile:

gem 'swagalicious'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install swagalicious

Usage

Add the following to your spec_helper.rb or add a new swagger_helper.rb

require 'swagalicious`

RSpec.configure do |c|
  c.swagger_root = "public/swagger_docs" # This is the relative path where the swagger docs will be output
  c.swagger_docs = {
    "path/to/swagger_doc.json" => {
      openapi:  "3.0.3",
      basePath: "/api/",
      version:  "v1",
      info:     {
        title: "Namespace for my API"
      },
      components: {
        securitySchemes: {
          apiKey: {
            type: :apiKey,
            name: "authorization",
            in:   :header,
          }
        }
      },
    }
  }
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ehowe/swagalicious.

License

The gem is available as open source under the terms of the MIT License.