-
Notifications
You must be signed in to change notification settings - Fork 43
Example application
Zuzanna Stolińska edited this page May 24, 2017
·
2 revisions
Here's an example use of SwaggerUiEngine in Rails application.
SwaggerUIEngine | Ruby | Rails versions |
---|---|---|
1.0.0 | 2.4.1 | 5.1.0 |
gem 'swagger_ui_engine'
# config/initializers/swagger_ui_engine.rb
SwaggerUiEngine.configure do |config|
config.swagger_url = {
v1: '/doc/v1/swagger.yaml',
v2: '/doc/v2/swagger.yaml'
}
config.doc_expansion = 'full'
config.model_rendering = 'model'
config.validator_enabled = true
config.admin_username = 'admin'
config.admin_password = 'password'
end
# config/routes.rb
Rails.application.routes.draw do
mount SwaggerUiEngine::Engine, at: '/'
end
Swagger Petstore minimal YAML documentation
# public/doc/swagger.yaml
---
swagger: "2.0"
info:
version: "1.0.0"
title: "Swagger Petstore"
...
The username and password for basic auth are: admin
and password
- as defined in the example configuration.