mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 07:16:40 +00:00
Initial commit
This commit is contained in:
14
app/controllers/swagger_rails/swagger_docs_controller.rb
Normal file
14
app/controllers/swagger_rails/swagger_docs_controller.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
module SwaggerRails
|
||||
class SwaggerDocsController < ApplicationController
|
||||
|
||||
def show
|
||||
render file: swagger_file_path_for(params[:api_version]), layout: false
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def swagger_file_path_for(api_version)
|
||||
File.join(Rails.root, 'config', 'swagger', "#{api_version}.json")
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/controllers/swagger_rails/swagger_ui_controller.rb
Normal file
8
app/controllers/swagger_rails/swagger_ui_controller.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
module SwaggerRails
|
||||
class SwaggerUiController < ApplicationController
|
||||
|
||||
def show
|
||||
@discovery_url = request.path.gsub('/ui', '/docs/v1')
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user