当我使用招摇葡萄时,我可以形容复杂的参数:
PARAMS [:by_commentable] [:commentable_id] PARAMS [:by_commentable] [:commentable_type]
desc "Get a list of comments"
params do
group :by_commentable do
requires :commentable_id, type: Integer, desc: "Filter by: Commentable object ID"
requires :commentable_type, type: String, desc: "Filter by: Commentable object type"
end
paginatable_params.call Comment
end
get "", http_codes: standard_responses do
apply_scopes(Comment.order_recent).page(params[:page]).per_page(params[:per_page])
end
end
end
如何在Rails中做同样的事情?
谢谢!
答案 0 :(得分:0)
我找到了解决方案,这是工作:
swagger_api :index do
param :query, :by_text, :string, :optional, 'By Text'
param :query, 'listing[id]', :integer, :optional, 'Id'
end
谢谢!