Class: Apicasso::ApidocsController

Inherits:
ApplicationController show all
Includes:
Swagger::Blocks
Defined in:
app/controllers/apicasso/apidocs_controller.rb

Overview

Controller used to generate an application Swagger JSON, used by SwaggerUI to generate beautiful API documentation

Constant Summary collapse

SWAGGERED_CLASSES =

A list of all classes that have swagger_* declarations, which gets injected by this gem in all ‘ActiveRecord::Base` classes

[
  *ActiveRecord::Base.descendants,
  self
].freeze
ASSOCIATION_EXCLUDED =
[
  'ActiveStorage::Attachment',
  'ActiveStorage::Blob'
].freeze

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_ability

Instance Method Details

#indexObject

Method that serves the generated Swagger JSON



506
507
508
# File 'app/controllers/apicasso/apidocs_controller.rb', line 506

def index
  render json: Swagger::Blocks.build_root_json(SWAGGERED_CLASSES).to_json
end