我正在使用swagger doc在grape api中生成API文档。 API参数定义如下:
desc "Get results by query"
params do
requires :type, type: String, desc: "search type"
requires :body, type: Hash, desc: "query body"
optional :user, type: Hash, desc: "support search as other user, otherwise search as current user" do
requires :id, type: String, desc: "user id"
requires :name, type: String, desc: "user name (dn)"
requires :directory, type: String, desc: "directory user belongs to"
end
end
post :query do
The generated JSON仅显示与用户相关的参数。如何定义其键不受限制且可以在API文档中生成的哈希参数?