如何在哈希或数组中显示Grape API的参数,并且不使用swagger doc定义内部值

时间:2018-01-23 07:12:24

标签: ruby swagger swagger-ui grape-api

我正在使用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文档中生成的哈希参数?

0 个答案:

没有答案