Chore: Swagger Docs V1 (#546)

This commit is contained in:
Sony Mathew
2020-02-23 12:54:29 +05:30
committed by GitHub
parent eea92bd0ac
commit e2688d5176
25 changed files with 739 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
class SwaggerController < ApplicationController
def respond
if Rails.env.development? || Rails.env.test?
render inline: File.read(Rails.root.join('swagger', derived_path))
else
head 404
end
end
private
def derived_path
params[:path] ||= 'index.html'
path = params[:path]
path << ".#{params[:format]}" unless path.ends_with?(params[:format].to_s)
path
end
end