ruby-grape / ruby-grape/grape-swagger

Array of Entities

Open
#628 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Ruby
Stars
1.1k
Forks
479
Avg merge
2d 14h
Merged PRs (30d)
6

Description

Hi,

Could you please tell me if there is a way to accept the array of entities in the params with content/type application json

Example
screen shot 2017-07-31 at 13 10 48

code

params do optional :requests, type: API::V1::Entities::Body, desc: '...' end

But I would like to have array of requests as below

{ "requests": [ { "method": "string", "path": "string" }, { "method": "string", "path": "string" } ] }

Also tried using param_type: 'body' and is_array: true

params do optional :requests, type: API::V1::Entities::Body, documentation: { is_array: true, param_type: 'body'}, desc: '...' end
It ignores the outer hash when sending the application/json
screen shot 2017-07-31 at 15 41 31

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the params block and the application/json handling described in the issue, then reproduce the documented request shape with an array of requests. Trace how the outer hash and entity type are represented, and consider the work done when the generated API documentation and request handling both preserve the requested structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.