Class: SwaggerDocsRails::SwaggerController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/swagger_docs_rails/swagger_controller.rb

Constant Summary collapse

SWAGGER_UI_CDN =
"https://cdn.jsdelivr.net/npm/swagger-ui-dist@5"

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.cached_docObject

Returns the value of attribute cached_doc.



23
24
25
# File 'app/controllers/swagger_docs_rails/swagger_controller.rb', line 23

def cached_doc
  @cached_doc
end

Instance Method Details

#docObject



13
14
15
# File 'app/controllers/swagger_docs_rails/swagger_controller.rb', line 13

def doc
  render json: JSON.parse(build_doc(resolved_server_url))
end

#resetObject



17
18
19
20
# File 'app/controllers/swagger_docs_rails/swagger_controller.rb', line 17

def reset
  self.class.cached_doc = nil
  render json: { message: "Cache do Swagger limpo. Acesse /swagger para regenerar." }, status: :ok
end

#uiObject



9
10
11
# File 'app/controllers/swagger_docs_rails/swagger_controller.rb', line 9

def ui
  render html: html_page.html_safe, layout: false
end