2

I am using swagger doc to generate API document in grape api. API parameters are defined like:

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 only shows the user related parameters. How can I define the hash parameters whose key is not restricted and could be generated in API document?

sawa
  • 165,429
  • 45
  • 277
  • 381
李梦驰
  • 59
  • 3

0 Answers0