我试图从我的控制器中取出我的文档,不确定这是否可能以及如何操作。
所以示例Controller有这个
class VI::SomeController < ActionController::API
include Swagger::Blocks
end
在我的Apidocs控制器中,这是定义
class ApidocsController < ActionController::API
include Swagger::Blocks
swagger_root do
key :swagger, '2.0'
info do
key :version, '1.0.0'
key :title, 'Loanplus API'
key :description, 'Loanplus API Specification'
end
# tag do
# key :name, 'mortgage_loans'
# key :description, 'Get mortgage loans'
# end
key :host, HOST
key :basePath, '/api/v1'
key :consumes, ['application/json']
key :produces, ['application/json']
# security_definition :api_key do
# key :type, :apiKey
# key :name, :api_key
# key :in, :query
# end
#
# security do
# key :api_key, []
# end
end
# A list of all classes that have swagger_* declarations.
SWAGGERED_CLASSES = [V1::LpDeveloperReferralsController, self].freeze
def index
result = Swagger::Blocks.build_root_json(SWAGGERED_CLASSES)
render json: result
end
end
我如何将文档放在其他地方。我尝试将文档放在一个问题上并从那里调用它但不起作用。任何其他选项