Class: OpenapiRuby::UiController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/openapi_ruby/ui_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/openapi_ruby/ui_controller.rb', line 7

def index
  return head :not_found unless OpenapiRuby.configuration.ui_enabled

  config = OpenapiRuby.configuration
  @schemas = config.schemas.keys.map(&:to_s)
  @default_schema = @schemas.first
  @ui_config = config.ui_config
  @schema_url = openapi_ruby.schema_path(@default_schema, format: schema_format)

  render html: swagger_ui_html.html_safe
end